0
$\begingroup$

Well, I will start directly in my problem. I'm working on a project and I only have 10 days left. The idea is simple, a wheeled robot with 3 ultrasonic sensors to avoid obstacles. I've developed a code and it's working fine. I'm using: Arduino Uno, L293D driver for the 2 dc motors, 3 HC-SR04 ultrasonic sensors and the Newping library.

I've made some kind of a shield where I soldered common points for gnd and 5V in order to connect the L293 ic and the sensors pins easily. The problem is that the ultrasonic sensors only functioned once in the expected behavior! After that they were always sending the zero result and sometimes a number is showed when i disconnect the sensor! Is it a power problem? I'm using the usb cable to power the arduino and the sensors (motors are powered using 2 Li-po batteries) kindly provide me with guidance

$\endgroup$

3 Answers 3

2
$\begingroup$

Well.. It was a power issue! I'm using one of the arduino replicas and the 5v pins is only outputting 4.5v instead of 5. The problem was solved by providing an external power source. I don't find it cool to power robots externally but this is the only way in my case.

$\endgroup$
0
$\begingroup$

You can convert Line follower PID robot to obstacle avoiding robot. At page 18 write new 3 sensor values instead of 5 line sensors (i assume that you can reduce number sensor and convert follower to avoider)

$\endgroup$
5
  • $\begingroup$ thanks for your reply but my problem is getting the ultrasonic sensors to work properly in the first place $\endgroup$
    – DieDen
    May 19, 2015 at 18:18
  • $\begingroup$ Just attach their trig and echo pins to digital pins. You can use NewPing Library code.google.com/p/arduino-new-ping/downloads/… or alternatvely youcan count pulses like this instructables.com/id/Simple-Arduino-and-HC-SR04-Example/… $\endgroup$
    – acs
    May 19, 2015 at 19:57
  • 1
    $\begingroup$ I'm already using newping library and when using the trig and echo pins only the sensor gives a non-logical result.. for example it keeps giving 180cm even when an obstacle is very close $\endgroup$
    – DieDen
    May 20, 2015 at 17:58
  • $\begingroup$ Did you check reflections $\endgroup$
    – acs
    May 20, 2015 at 18:35
  • $\begingroup$ Yes it was a plane obstacle in front of it. anyway it's at least giving me a result, i'll try to optimize the code and give you the feedback hoping your solution will work with me $\endgroup$
    – DieDen
    May 20, 2015 at 20:34
0
$\begingroup$

This is a little trick with the HC-SR04s. Power it on, so its in the broken state.

Flick the wire mesh piece.

The reason might be it doesn't reset itself. These components might be cheap clones and not the real ones, and some of the clones have this problem. Then when you flick it, it resets the depressed component.

More info here: http://forum.arduino.cc/index.php?topic=55119.0

$\endgroup$
1
  • $\begingroup$ Thanks for your response but unfortunately it didn't work. However, it should be an autonomous robot so this trick won't be permanent if it worked $\endgroup$
    – DieDen
    May 20, 2015 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.