I am doing a small beginners project & have a problem !
Now the project is some what as follows :
There is a LDR and a laser mechanism which detects if anything cuts the laser.
LDR values is given as analog input to arduino and when laser is cut a variable increments.
Now when laser is cut 10 times i.e the variable value becomes 10 the motor moves.
I have connected 2 dc motors to L293D IC and given 9v as supply voltage.
I have not connected any diodes or capacitors anywhere in my circuit.
I have connected a 16 * 2 LCD to arduino showing the value of variable (i.e how many times the laser has been cut)
Initially up to count of 10 everything works fine, the moment motor moves LCD displays random characters.
I have tried removing just the supply i.e. 9v and rest of L293D, LCD, Sensor circuit same then lcd displays the count perfectly.
so basically the movement of motors is causing the problem.
I have also connected the 5v arduino supply as common to lcd and L293D both.
so is that common supply to lcd & l293d causing the problem (mostly not because initially everything is fine until motor moves) or backemf from motor ?
please help asap.
Thank you in advance
Motor is an inductive load - this is causing transients on power and data lines Goin to LCD. How far is the LCD and its cable from motor and its power cable? How long is the cable going to LCD? Simple but very dirty solution is to call lcd.begin in your loop every few seconds.
I have not connected any diodes or capacitors anywhere in my circuit.
Then put some in, you will continue to have trouble until you do. You need decoupling capacitors on your supply, you need reverse biased diodes on your motors.
No software is going to compensate for a poor circuit.
waski:
Motor is an inductive load - this is causing transients on power and data lines Goin to LCD. How far is the LCD and its cable from motor and its power cable? How long is the cable going to LCD? Simple but very dirty solution is to call lcd.begin in your loop every few seconds.
Thanks waski,
The lcd power supply are close to motors like 60cms away approx is that too close ?
yes i will surely try lcd.begin() but this will still be causing problem at the back !
can i avoid the transient power going in data lines & supply with some Circuit ?
I have not connected any diodes or capacitors anywhere in my circuit.
Then put some in, you will continue to have trouble until you do. You need decoupling capacitors on your supply, you need reverse biased diodes on your motors.
No software is going to compensate for a poor circuit.
Thanks Mike,
Can you put some link on how to use capacitors for decoupling on supply ?
and i have tried putting Reverse biased diodes (only diodes though) on motors it didn't worked !
and LCD displays but data is random so data lines are having problem due to motors !
where to connect the capacitors ?
pl. send a link or explain
Try to solder 100nF capacitor on VCC ang GND ( + and - ) of your LCD ( as close to LCD as possible ) . Are you using any cable beetween arduino and lcd ? If so, you can wrap it with tin foil and connect one end to GND ( It's just an "experiment" ) . If you are powering your arduino and LCD from the same powe supply as motor, try to separate them - use another power supply for arduino and LCD. Fighting with transiens and electrical noise is pain in ***** .. In one of my devices, i needed to put lcd.begin() firing every 10s permanently .
I referred the decoupling link ! It was really really helpful
I put the diodes back across the motors and also a 0.1microF and a 47microF Cap.
I used a 1 milli henery inductor also in series and this worked !
Now there is no transient power going to the data lines