Work in progress...
The objective of this work is to design and manufacture a machine to measure distances using an ultrasonic sensor. Because sound speed variation with temperature, will be implemented and a temperature sensor, which will increase measurement accuracy.
The objective of this work is to design and manufacture a machine to measure distances using an ultrasonic sensor. Because sound speed variation with temperature, will be implemented and a temperature sensor, which will increase measurement accuracy.
The schematics:
The PCB:
The components:
IC1 – ATMEGA8,
IC2 – LM7805,
D1 – 1N4004,
C6,C7 – 47uF,
C2,C3 – 22pF,
C1,C4,C5,C8,C9,C12 – 100nF,
R1,R4 – 10K,
R2 – 330R,
R3 – 220R,
R7 – 1K,
Trimmer 10K,
Q1 – 16MHz,
L1,L2 – Led,
Code i used for testing:
///----------------------------------------///
/// by gabimincu 10.05.2012 ///
/// masurarea distantelor cu ultrasunete ///
/// gabimincu@gmail.com ///
/// www.robot-fun.blogspot.com ///
///----------------------------------------///
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int pingPin = 7; // pin trig senzor
const int inPin = 9; // pin echo senzor
int t=0;
int i;
float tempc = 0,temp; //variabile temperatura
int d;
float durata,cm; //variabile distanta
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(8,INPUT);
}
void loop()
{
afisare();
Do you want the rest of the code?
Next step: construction of box