Smart Stick Project with Arduino

Hello, I have a project to complete about Smart Stick for Blind People.

I have

-3 ultrasonic sensor,
-3.5 Mm Audio Jack Female,
-9V battery,
-Earphone,
-Stick.

I have to change the three things based on the different scenarios.

  1. Frequency of the sound
  2. Intensity of the beeps
  3. Sides of the Earphone (Left and Right)

-If the obstacle is on the right, then Arduino will send a signal at regular intervals to the only right-side earphone.
-If the obstacle is on the left, then Arduino will send a signal at regular intervals to the only left-side earphone.
-If the obstacle is on the front, then Arduino will send a signal at regular intervals to both sides of the earphone.

-If the obstacle is both on the right and front, then Arduino will send a signal to both sides of the earphone, but the frequency will be different.
-If the obstacle is both on the left and right, then Arduino will send a signal to both sides of the earphone, but the frequency will be different.
-If the obstacle is both on the left and front, then Arduino will send a signal to both sides of the earphone, but the frequency will be different.

Also, the intensity of the sound will increase as the obstacle approaches. (like a car reverse parking sensors)

I generally used 'delay' in my code, but I couldn't simultaneously get a signal from the ultrasonic sensor and send a signal to the earphone because of the blocking code.

Could you help me with my project? Thank you in advance.

Don’t use delay()

For extra information and examples look at Using millis() for timing. A beginners guide and Several things at the same time

2 Likes

Please post your complete (updated) code using code tags as described in How to get the best out of this forum.

2 Likes

Usually you can't with ultrasonic sensor. You need to activate them one after the other with some time in between so that you don't get echos from one into the other.

but that can be "fast enough" for a blind walker...

2 Likes

Well, because you can't do that. Each sensor will hear the pulse or echo from the other device. You just have to know when both sensors have received and echo.
Try the logic of operating each sensor, one after the other and and only then testing to see of both are receiving an echo. If not both, then did either one receive and echo.

2 Likes

When I write code that runs both sensors one after the other, one works fine, but the other displays a value of 0.

Are you delaying the second sensor long enough so the pulse and echo from the first has gone away?

1 Like

show us the code you used for that

remember you need at least 30-millisecond between 2 consecutive pulses so that there is no influence from the first signal on the second read

1 Like

Post #5 ?

OK - possible

I had assumed OP had written another code handling both pings and then dealing with the result as a suggestion from @Paul_KD7HB

(using the newPing library could help too)

1 Like

It works, but unfortunately, I cannot send signals simultaneously to both sides of the earphone. Only one side gets a signal.. (so, only one side makes a sound)

All jacks are female. Plugs are male.

But, how do you have this wired? Is it really a stereo jack and plug with three connections?

1 Like

Actually, it has five connections. One of them is ground, and the other two are Left and Right. ( I use only three pins in the stereo jack and don't know what the rest of them are used for) I have soldered wires to the pins.

That suggests the other two are a switch that opens and closes when you plug into the jack. Your DMM will show the resistance between the two connections is zero with nothing plugged in and infinite resistance when plugged in. OR perhaps not, you need to figure out what you have.

1 Like

it's really not bad

Tone can only work on one pin at a time. You need to handle the sound without than function

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.