Navgun
Newbie level 2
I am making a college project which is a blind walking stick using Micr AT89c2051 interfaced with Ultrasonic Sensor (HC-SR04).
I did all the coding part and did burn the code in the Micr. +ve pin of the buzzer is connected to Vcc ...and the other one to the port pin...
I am giving '1' to that pin, ...
but after i start on the power, the micr doesnt checks the condition to be true and starts buzzing the buzzer.
-----------
*should i use a npn transistor OR
*should i try giving '0' to that pin OR
*somethng else?
-----------
This is the atual Schematic of our project.
**broken link removed**
-----------
This is the Code used
-----------
The working is
*A Trigger signal of at least 10microseconds will be generated on pin 2 of the microcontroller.
*This signal will make the ultrasonic module to transmit 8 40 kHz waves from the transmitter.
*The received signal would be automatically decoded by the module. And results would be sent on pin 3 of the microcontroller via echo pin.
*Meanwhile, pin 11 will be used to sense water. It will be done by the simple principal of ‘salt water conduction’.
*A dc signal will be sent to the lower side of the stick via wires.
*If no water is sensed, the circuit would be open, and no o/p would be given to the buzzer.
*If water is sensed, the circuit will be a closed circuit. And buzzer output would be given.
----------
any help would be very much appreciated.. :-(
I did all the coding part and did burn the code in the Micr. +ve pin of the buzzer is connected to Vcc ...and the other one to the port pin...
I am giving '1' to that pin, ...
but after i start on the power, the micr doesnt checks the condition to be true and starts buzzing the buzzer.
-----------
*should i use a npn transistor OR
*should i try giving '0' to that pin OR
*somethng else?
-----------
This is the atual Schematic of our project.
**broken link removed**
-----------
This is the Code used
Code:
#include<reg51.h>
void t0m1delay(void);
sbit trig= P3^0;
sbit echo= P3^1;
sbit buzz= P1^7;
sbit water= P3^7;
void msdelay(unsigned char);
void main (void)
{
water=1;
echo=1;
while(1)
{
trig=0;
msdelay(2);
trig=1;
t0m1delay();
trig=0;
msdelay(8);
if(echo==1)
buzz=1;
if(water==1)
{
buzz=1;
msdelay(256);
msdelay(256);
buzz=0;
msdelay(256);
msdelay(256);
}
}
}
void t0m1delay(void)
{
TMOD=0x01;
TL0=0x0f6;
TH0=0x0ff;
TR0=0;
TF0=0;
}
void msdelay (unsigned int itime)
{
unsigned int i,j;
for(i=0; i<itime; i++)
for(j=0; j<1275; j++);
}
-----------
The working is
*A Trigger signal of at least 10microseconds will be generated on pin 2 of the microcontroller.
*This signal will make the ultrasonic module to transmit 8 40 kHz waves from the transmitter.
*The received signal would be automatically decoded by the module. And results would be sent on pin 3 of the microcontroller via echo pin.
*Meanwhile, pin 11 will be used to sense water. It will be done by the simple principal of ‘salt water conduction’.
*A dc signal will be sent to the lower side of the stick via wires.
*If no water is sensed, the circuit would be open, and no o/p would be given to the buzzer.
*If water is sensed, the circuit will be a closed circuit. And buzzer output would be given.
----------
any help would be very much appreciated.. :-(