ARDUINO HC SR04 AND SERVO MOTOR HAPTIC FEEDBACK

want help guys!!
making a project to let the blind people know of the distance before them...so principle is>>>calculate the distance and let the blind person know of the obstacle how much closer is the object by haptic feedback.....i.e...if the object is closer...the haptic feedback should be more strong..and if the obstacle is far away, the feedback shud be of less magnitude..
P.S: Haptic feedback---touchin or vibrating a motor in different patterns to the user...

if the obstacle is in the range
calculated distance through hc sr04 (with sonar principle).
and arduino..
anticipating the reply soon
also shud i take a servo motor or a dc motor of 2.5 volts reading to make the vibrations known to the user(here a blind person)..

Thanks for sharing i like the idea, utilize a vibration motor , a servo motor is something not good to use here, now the problem with vibration motor is that they are hardly available in stores freely so as such buy a old nokia and hack the same , do not get the arduino out of it just use its body and keep the vibration motor in it only and take the other stuff out then use a arduino mini or nano smd based to control sonar and vibration motor etc.

here you go in this way you do not even have to worry about encasing your project.

not clear !!wat u said..do u want us to use the vibration of nokia phone..and use its casing!?

You asked whether you ppl should use servos or motors for making the wearing person note the signal i told you to get vibration motors but also told you guys that finding them is hard and as such where you will get them , that is in Nokia old phones and also you can use the same nokia phone casing so as to hold your project.

also, i suggest you people utilise a arduino mini series.

You can find an example of using HC SR04 here

The next step will be to convert the distance to a value in the interval 0-255 that can control the vibration motor using a PWM pin like fx:

analogWrite(motorPin, value);

@NI$HANT
Vibration Motor - ROB-08449 - SparkFun Electronics and lots of othher online stores

You should be careful when choosing vibra motors; the simple DC motor types are easiest to drive, but the linear ones generally need AC.

Erni , Awol and Nishant!!
thanx for ur time .I'm a high school guy who took an over ambitious project suggested by my uncle..finding difficulties
So the following may b stupid questions for u..But do care to answer them please
...wat's ur logic by converting this to a numeric value.is that a count of the no. of rotation the vibrator would do .?
do vibration motors (we r gonna use dc motors) ,when given this value will run at a different vibratory pattern or frequency?
also my friend has this theory>>
if distance<=0.5 metres --buzzer (or vibrator)pattern 1 will go on
if distance>0.5m and<=1.5 m--buzzer pattern 2 will go on
likewise!! upto the range of 4m .

for producing that..what will we hv to do..pls sir guide us through this..we hv just a week to present our project..
also we want to use rechargeable battery for the whole setup..
Also coming to the interfacing part >>how to interface the whole thing!!!we hv got numerous sites abt how to do that..but can u giv me a more clear picture..of what r u thinking abt how the whole thing shud work..
SOME more questions>>1.we hv the same code as suggested by u.but sometimes when uploaded into the arduino dueminalove board, it gives errant results..wat to do abt that..
2. how to make it wearable on the hand of the blind man or the walking cane..friends are suggesting to make the assembly on a cane..will that b gud..if yes cn u provide some input abt that..nokia cases idea..i liked it..but they aren't sturdy at all..

also why in the program, there's a delay of1000us...as we wanted 10us bursts of triggering?but still it works..why?

/*
HC-SR04 Ping distance sensor]
VCC to arduino 5v GND to arduino GND
Echo to Arduino pin 13 Trig to Arduino pin 12
More info at: http://goo.gl/kJ8Gl
*/

#define trigPin 11
#define echoPin 12

void setup() {
Serial.begin (9600);

pinMode(trigPin,OUTPUT);
}

void loop() {
int duration, distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance >= 400 || distance <= 0)
{
Serial.println("Out of range");
}

else {
Serial.print(distance);
Serial.println(" cm");

}
delay(250);
}
results are erratic..as sometimes the obstacle is at a distance of say 300cm..then its showing 14 or 16 cm..also gives out of range message between the range of distance in the program..why do we hv to run the arduino at 9600 baud rate only?what does baud rate mean?

also the bold part of the program..is the values in cm or wat?
Explain how to convert distance into the count between 0-255.?

distance of say 300cm..then its showing 14 or 16 cm.

its happening bcz of this statement distance = (duration/2) / 29.1;

.why do we hv to run the arduino at 9600 baud rate only?what does baud rate mean?

you can run arduino at higher and lower baud rates too, its the speed of serial connection of arduino with computer.

Nishant sir..thnx..more questions above..please answer them

also the bold part of the program..is the values in cm or wat?

Please read the text in the example, the distance is in cm.

Explain how to convert distance into the count between 0-255.?

Untested:

#define motorPin 11; //Connect motor to a pin supporting PWM
.
.
.
.
.
if (distance< 100 && distance>80)
{
  analogWrite(motorPin, 100);
}
else if (distance< 80 && distance>50)
{
  analogWrite(motorPin, 180);
}
else
{
  analogWrite(motorPin, 255);
}

If your motor is using more than 20mA, you should use a transitor driver, fx. this example.

The flywheel diode is necessary in any case

thnx erni and nishant..but motors were vibrating properly in accordance with the distance everytime.....but now our max. analog distance of obstacle detected is around 160cm..checked its Vin voltage..its proper..our prof. is not able to decode the problem.we chnged the breadboard a numerous times.but bad luck..what to do?
also do we need to get another sensor in addition to this for the obstacle detection for the blind.. as today when we were calibrating and noting down all the results with different objects,we were getting the output for a beam angle of ..say 15-20 degrees.
Real time obstacle detection is OK..but for making the blind person to know about how fast the obstacle is moving(so that he can take necessary steps to avoid collision)through VIBRATION for all time may be not good for the skin..am i rite?
please provide with some other ideas.
also we wanted batteries to power up the arduino.so we brought a duracell battery..now a crazy idea that came up in my mind..can we recharge these batteries with USB or something of that sort...since after all this,, we think our project code is very simple...waiting for ur reply eagerly