issue with using stepper motor and US sensor SR04

Hello,
I am trying to build up a distance measuring device with Arduino UNO. I am driving Bipolar stepper motor with L293 driver and using HC-SR04 ultrasonic sensor. The +V terminal of L293 and Vcc of US sensor is attached to +5 terminal of arduino. What I am observing is if +V terminal of L293 is disconnected, US gives correct output, but once stepper is turned on (connecting +V of l293 to +V of arduino), US starts giving arbitrary readings.
Also sometime I observed that with +v of l293 connected to arduino, uploading program to arduino doesnt work, though thats of secondary importance to me right now.

So I am trying to understand what the problem US sensor may have working with stepper motor.

Appreciate your help regarding same.

Prasad

Quite often a stepper motor will require more current than the Arduino can spare. This will drag down the voltage and cause resets or other problems. You should not try to supply power o the stepper though the Arduino. Use a 7V to 9V power supply (about 2A) and then connect the L293 to the "Vin" pin (raw 7V to 9V power). This will take the load off the 5V regulator.

Thanks for reply. I was thinking of something like that happening, but didnt thought of using different power source. I actually tried converting one of the output pin of arduino to power by making it HIGH, but it didnt work :).

With connecting US sensor and Stepper motor (l293) parallel to the same power source help? I have a 2 x 3.7 V batteries on module and dont have option to add on another set of batteries.

Thank you.

prasadkm:
With connecting US sensor and Stepper motor (l293) parallel to the same power source help? I have a 2 x 3.7 V batteries on module and dont have option to add on another set of batteries.

So you are running 7.4V to the Arduino's power jack? That should let you get 7.4V for the L293 from the "Vin" pin and 5V for the ultrasonic sensor from the +5V pin.

yes I connected l293 pins to the terminals of my 7.4 v battery. actually two nokia mobile batteries connected in series. but its not helping in turning the stepper motor. and with l293 and Us sensor connected to v+ of arduino US sensor is not working.. I am kind of lost now about how to proceed.....

You have not given the specs of the stepper. What is the coil resistance?

Hello,

I tried two things, but none worked. system has one bipolar stepper motor (5 pin) and one SR04 ultrasonic sensor.

  1. Power SR04 through Arduino and Stepper motor through external stepped down 5 V source: In this case, stepper motor is just doing some sound and moving slightly. Not as expected or coded. SR04 readings are perfect.

  2. Power SR04 through external stepped down 5V source and stepper through arduino : In this case, stepper motor is working just fine, but SR04 gives 0 reading all the time.

  3. Power SR04 and stepper motor through arduino, makes SR04 gives random readings.

Scenario 1 appears to be closest to be the working one, but stepper motor response is not as desired. Probably current supplied may be too less or too much. What could be the reason if stepper motor is not moving as per coded. Means I can see some rotation but its very small compared to what is asked for.

Thank you,
Prasad

system has one bipolar stepper motor (5 pin)

Bipolar motors have 4 or 6 connections. 5 connections usually indicates unipolar. Have you verified the coil wiring. Incorrect connections can lead to the symptoms observed.

Ohh. I checked with measure resistances of coils. with ground terminal coil resistance is coming half as compared to any other pin combinations. Also same connection used with arduino power to l293 works fine. but when l293 is powered with external power it gives humming sound and stepper motor doesnt spin fast.

Have you goit a proper common ground connection? You should show the exact wiring diagram.