Introduction: Electronic Cane for Blind People
This is a simple project can make a big difference in someone's life and you are here because you are interested
what you need to know about this project:
I used a wood cane and customize it the way I need for electronic parts like Arduino, ultrasonic, PCB etc...
How the electronics work together:
So I put the ultrasonic sensor in the top of servo motor that rotate about 90 degrees (Like Radar) to scan the area in front, Right and Left of blind patient, when this radar see's something closer than Ex:10 cm it give an alert through vibrating motor(I used two of them you can use more to increase accuracy).
But what if the patient lost his cane ?!
I used a Bluetooth HC-05 to give an alert through android app to cane so a buzzer on the cane make noise then the patient find the cane.
that's it.
Step 1: We Need to Build Our Pcb
you can see the circuit I built on Eagle software.
Parts you need:
1- Two vibrate motors you can use mobile vibrator for better results.
2- Any kind of Arduino chips but this project built on Arduino uno R3.
3- Bluetooth module Hc-05 (i used) or Hc-06.
4- Buzzer.
5- 2×lm7805 volt regulator.
6- 3×Bc337 transistor.
7- 3×Diodes any kind can handle 5 volt can work with you.
Step 2: Connect Every Thing Together
Alert: if you power up this project from the arduino say good bye to the chip because it needs a lot of current that your arduino can't handel.
some parts like Bluetooth and servo i attached directly to arduino without connecting to PCB to shorten the wires.
The connection between arduino and PCB is simple, just follow the numbers on each line to the destination, not so hard.
If you have any question about connections send me Email.
Step 3: Upload the Code
i attached the arduino code, you have to put this file on a Folder with the same name on English directory or it will not work for you.
you can edit the code the way you want like servo angle and the rules when the motors work and delay duration's.
Hope you enjoy.
#include
/*------------"int timer 2"---------*/
void Timer2init() {
// Setup Timer2 overflow to fire every 8ms (125Hz)
// period [sec] = (1 / f_clock [sec]) * prescale * (255-count)
// (1/16000000) * 1024 * (255-130) = .008 sec
TCCR2B = 0x00; // Disable Timer2 while we set it up
TCNT2 = 130; // Reset Timer Count (255-130) = execute ev 125-th T/C clock
TIFR2 = 0x00; // Timer2 INT Flag Reg: Clear Timer Overflow Flag
TIMSK2 = 0x01; // Timer2 INT Reg: Timer2 Overflow Interrupt Enable
TCCR2A = 0x00; // Timer2 Control Reg A: Wave Gen Mode normal
TCCR2B = 0x07; // Timer2 Control Reg B: Timer Prescaler set to 1024
}
void measure(void);
int trig = 6; // attach pin 6 to Trig
int echo = 7; //attach pin 7 to Echo
int L_motor =8;
int R_motor =4;
long duration, cm,dis; //for Echo calc
float Light = 0; //for analog light sensor
int buzzer =9;
int Light_int_b =2; //if high measure light
int state =0; //for blutooth state
Servo myservo; // create servo object to control a servo
int pos = 45; // variable to store the servo position
void setup() {
// put your setup code here, to run once:
/*---------------Echo-------------------*/
pinMode(trig, OUTPUT);
pinMode(echo,INPUT);
/*--------------serial------------------*/
Serial.begin(9600);
pinMode(L_motor,OUTPUT);
pinMode(R_motor,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(Light_int_b,INPUT);
myservo.attach(3); // attaches the servo on pin 3 to the servo object
Timer2init();
sei();
}
void loop() {
// put your main code here, to run repeatedly:
dis=Distance(); //measure distance
test_m(); //test if there is an object in front of sensor
blutooth(); //test blutooth
delay(2);
}
//------------------loop end-----------------------
int Distance()
{
digitalWrite(trig,LOW);
delayMicroseconds(2);
digitalWrite(trig,HIGH);
delayMicroseconds(10);
digitalWrite(trig,LOW);
duration=pulseIn(echo,HIGH);
cm=duration*0.034/2;
Serial.print(cm);
Serial.println();
return cm;
}
void test_m()
{
if(dis>=5 && dis<=100)
{
if(pos>=45 && pos<=60)
{
//Serial.print("L");
//Serial.println();
digitalWrite(L_motor,HIGH);
delay(500);
digitalWrite(L_motor,LOW);
}
else if(pos >=61 && pos<=120)
{
//Serial.print("F");
//Serial.println();
digitalWrite(R_motor,HIGH);
digitalWrite(L_motor,HIGH);
delay(500);
digitalWrite(R_motor,LOW);
digitalWrite(L_motor,LOW);
}
else if(pos>=121 && pos<=135)
{
//Serial.print("R");
//Serial.println();
digitalWrite(R_motor,HIGH);
delay(500);
digitalWrite(R_motor,LOW);
}
}
}
void blutooth()
{
while (Serial.available() > 0) {
state = Serial.read();
}
if(state =='0'){
digitalWrite(buzzer,LOW);
state = 0;
}
if(state =='1'){
digitalWrite(buzzer,HIGH);
state=0;
}
}
ISR(TIMER2_OVF_vect) {
myservo.write(pos); //servo rotate
pos++;
if(pos>=135)
{
pos=45;
}
TCNT2 = 130; // reset timer ct to 130 out of 255
TIFR2 = 0x00; // timer2 int flag reg: clear timer overflow flag
};
Attachments
Step 4: We Are Done
download the android app to control the buzzer (on or off)
hit the Bluetooth picture on the app and connect to HC-05 then it will say connected and you are done.
you can use any app and send '1' or '0' if this not work for you try to send 1 0
Enjoy
Attachments
Step 5: Contact Me
you can contact me on:
Email: alaanasef159357@gmail.com
FB: https://www.facebook.com/alaa.alnasef
linked in: alaa naser alnasef
Yt: alaa nasef
4 Comments
5 years ago
Hello I am visually impaired, , I am trying to develop a electronic stick , with your same idea, I mean a sensor with a servo, really I wanted to use a TimeOfFlight laser sensor but also ultrasonic should be ok.
I have some question about your project , I can't see the ultrasonic sensor model in the description , could you please add it, I found that the cheap HCS04 have a large beam so it is not very useful to find a little obstacle of to find the hole of a door for example.
The second question is , how to use the TIMER in arduino, I guess to move the servo and check obstacle in the same time?
Thanks in advance.
Luca
Reply 5 years ago
Hi qeilucpa,
I use HCS04 ultrasonic sensor for my project, but if you want more accurate sensor you can use TimeOfFlight laser but these kind of laser sensors don't give you same range of ultrasonic ones, on the other hand you will not use the sensor for 4m range so it will not be a big problem.
for the second question, yes you will have to use a timer I have a behave on how to program avr controllers with C and how to use timers and the Arduino use avr atmega 328p so you can program inside Arduino ide on c language and you will have no errors. you can google it or copy paste my code.
I hope I answer your questions. :)
5 years ago
That's a neat idea :) Do you have any progress photos from when you built the cane itself?
Reply 5 years ago
Thank you,
Unfortunately, I did not document this, but you can buy any wooden stick and build a sandal with suitable dimensions to contain Arduino and Pcb