I'm not expert in electrical circuits, maybe I am making a very simple mistake or missing some basic points with my circuit.

What I'm trying to achieve is simple, to run 2 DC motors with an ultrasonic sensor to detect obstacles and change direction. When I unplug the ultrasonic sensor everything is working fine as expected without obstacle detection but when I connect the ultrasonic sensor, sensor always responds with 0 cm distance. Then I removed 9 V battery from the circuit and plug Arduino to computer via USB, sensor works fine but motors are not working properly, it looks like the power from USB is not enough to drive motors at the same time. I've added my circuit scheme below:

Circuit Scheme

  • Measure the voltage (Vin, 5V, 3V). Check the power consumption for the motors. What type of 9V battery? Can it provide the power required? By measuring the voltage drop you might get a better understand of the issue(s). – Mikael Patel Feb 22 '16 at 10:28
  • Thank you Mikael, I will check the values. Between the power source is a standard Duracell 9v battery. – Sarpkaya Feb 22 '16 at 10:44
  • 1
    A 9V battery may have a hard time providing power for both the motors and the board. You might need to rethink this. Or at least use a separate battery for the board. – Mikael Patel Feb 22 '16 at 15:23

How (acoustically) loud are the motors? If they're the typical RC car motors, they can screech harmonics right up into the 40 KHz range typical of ultrasound ranging sensors, interfering with the sensor's ability to work at all.

How (electrically) loud are the motors? If RC as above, they throw all sorts of transients onto the power lines (and everything else within electrical pickup range). You might want to put some ceramic capacitors across the motor leads to absorb some of those transients.

Kudos for the suggestions to provide separate power supplies for the motors and the Arduino / sensor combination. I'd go even further, and provide separate power for all three, and use opto-isolators for the connection between the ultrasound and the Arduino.

Some years ago I used two Novak Super-Rooster motor drivers for a battle-bot competition. They were driven by PWM outputs of an Arduino, where 50% duty cycle was off, 0% was full speed reverse, and 100% was full speed ahead. These were powered by a sealed lead acid battery, and driven full-out, the motors got +/- 12VDC at about 40 amps. There was a common ground with the Arduino, going to the Super Roosters, but not the motors, and the drivers took care of the electrical shielding, with a little help from the ceramic bypass capacitors I mentioned. Worked great!

  • Thank you for your detail explanation. I think you hit a good point with the high frequency sound issue. I'll look for ceramic capacitors etc. and let you know about my progress. – Sarpkaya Feb 23 '16 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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