My Circuit Kills Arduinos and It's Slowly Killing Me

Thread Starter

cowhock35

Joined Dec 25, 2012
48
Hi All,

I am working on an Arduino based project that controls a motor based on temperature and light feedback. The temp and light cutoffs are adjusted by pots, and the motor driver is a dual driver PCB off Amazon. I plan to run the L9110s off board with the below trimmed down circuit, but currently the motor driver circuit is slightly different than the diagram. The unit will also have an optional off grid system with a small solar panel to trickle charge the system. I am considering running the Atmega off board as well, but undecided on that. The manual door option is not yet implemented either.

I've had seemingly endless little issues with this circuit, but mainly I have blown two Arduino's so far in not very much time. The first one blew the serial port so I couldn't upload any code and the second one took out the voltage reg (I assume, as it was blazing hot) and the 5V output was pushing 5.68V.

Are these flukes from prototyping and banging wires together or are there some issues with the circuit? Almost everything is soldered directly, as we were initially having issues with loose wires. Unfortunately, that makes swapping Unos a real bear. I was attempting to implement a motor voltage spike monitor system on pins A4 and A5 to act as endstops for the door. Worked perfectly on a different board with a basic circuit, I added it to this circuit and I just starting getting wild voltage fluctuations on the scope, with over a 5V swing. I started poking around and thats when I noticed the high rail voltage and the warm board. Previously I had endstop switches on digital pins to 5V with pulldowns to GND, pretty basic.

Apologies for the poor convention and hand drawn circuit, it's been a few years since working on any significant EE projects.
IMG_0070.jpg

I would really appreciate any help you can offer!
 

Attachments

BR-549

Joined Sep 22, 2013
4,928
6 volts is right at the limit. 7-12 is recommended.....6-20 is the limit. For Uno rev3.

"The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts."

I/O....5 V...20 ma....40 ma max....chip damage.
 

ericgibbs

Joined Jan 29, 2010
18,766
hi 35,
Your diagrams do not show the actual power/signal grounding/0v lines/paths.?
How are the power lines and grounds connected, photo image would help.?
E
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
6 volts is right at the limit. 7-12 is recommended.....6-20 is the limit. For Uno rev3.

"The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts."

I/O....5 V...20 ma....40 ma max....chip damage.
Gotcha. So what are my options then for running it on a supply putting out 6.5-6.25 volts? You can run them off a 5V serial from a computer no problem, so can I regulate the 6v down to 5v with a LM7805 before it goes to the Uno and dump power.....directly into the 5V rail maybe? I'm using a geared down DC motor, its only like 190 rpm so its taking about 130ma when hooked directly to the battery and the rest of my circuit shouldn't be much of a draw.

I would rather not dump out my whole system for 12v equipment. Sadly, mid-sized SLA batteries aren't readily available in 9v, and 12v is reasonably hard to keep charged with solar on a trickle system like I have in mind.
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
hi 35,
Your diagrams do not show the actual power/signal grounding/0v lines/paths.?
How are the power lines and grounds connected, photo image would help.?
E
Yikes, I'm afraid a pic won't help much but here you go. It has to fit in a very confined space and run a pile of leads to the lid of the unit for controls so its pretty hard to read. But everything is soldered in, I have 3 rails on each side with GND, ~6.5V direct from the PS or Bat, and signal 5V which comes from the Arudino 5V output. The arduino had been putting out a perfect 5.00-5.01v down the 5V output so I scrapped the LM7805 I had powering the rail. The next version will have the controls directly on the board and eliminate some of that wire scramble.
IMG_0071.jpg
 

philba

Joined Aug 17, 2017
959
On the power supply, I would use an LDO regulator to go from 6ish to 5V. Feed the arduino 5V on it's 5V pin.

I would feed the motor driver with the 6ish supply (assuming it can handle it).

I see a problem with A4 and A5 going directly to the motor terminals. What are you trying to do there? I think you're asking for trouble with that arrangement.
 

Raymond Genovese

Joined Mar 5, 2016
1,653
On the power supply, I would use an LDO regulator to go from 6ish to 5V. Feed the arduino 5V on it's 5V pin.

I see a problem with A4 and A5 going directly to the motor terminals. What are you trying to do there? I think you're asking for trouble with that arrangement.
I think that is changed on pics #2 and #3
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
I think that is changed on pics #2 and #3
Didn't mean to upload 2 and 3, they were previous circuit designs. I am measuring the motor voltage on those pins and using it as endstops. When the motor starts to stall out from the door closing against its stop, the voltage drops and it is coded to stop driving the motor. It doesn't work very well though. When I ran the system off board with a separate simple circuit and motor, it worked perfectly....input hovered at 1023 and if you gave it resistance, it slowly reduced up to a cutoff. Now, the voltage bounces all over. Mainly hovers at the top end but its not very responsive and gives erratic outputs. If I measure the voltage with a meter its stable, but if I put a scope on, its a wave with 5v fluctuations that spends most of its time at the correct voltage, but it must be sampling at some of the other points which is giving me the erratic readings.

Is there a better way to measure that voltage? Removing the physical endstop switches is a huge design improvement and if there is any way to avoid it we would like to.

Currently, I rebuilt the circuit with a 7805 powering the 5v rail and haven't blown the Uno yet or had any issues other than the persistent one I just mentioned that behaved similarly on the previous circuit design.
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
How much current are you drawing from the Arduino 5v pin? This looks like it could be a problem in addition to the 6v in issue already raised (see here for example).
Not much, I haven't measured the current there specifically, but the motor should be the only major draw and it's taking less than 150mA
 

BR-549

Joined Sep 22, 2013
4,928
How many Arduinos do you usually stock? What is a cowhock anyway?.......I have heard of cowlick, but not cowhock.
 
Didn't mean to upload 2 and 3, they were previous circuit designs. I am measuring the motor voltage on those pins and using it as endstops. When the motor starts to stall out from the door closing against its stop, the voltage drops and it is coded to stop driving the motor. It doesn't work very well though. When I ran the system off board with a separate simple circuit and motor, it worked perfectly....input hovered at 1023 and if you gave it resistance, it slowly reduced up to a cutoff. Now, the voltage bounces all over. Mainly hovers at the top end but its not very responsive and gives erratic outputs. If I measure the voltage with a meter its stable, but if I put a scope on, its a wave with 5v fluctuations that spends most of its time at the correct voltage, but it must be sampling at some of the other points which is giving me the erratic readings.

Is there a better way to measure that voltage? Removing the physical endstop switches is a huge design improvement and if there is any way to avoid it we would like to.

Currently, I rebuilt the circuit with a 7805 powering the 5v rail and haven't blown the Uno yet or had any issues other than the persistent one I just mentioned that behaved similarly on the previous circuit design.
I have to think about this and I'm not that smart. I think I am understanding now what you are doing with A4/A5 and it smells bad, intuitively. I think the better way would be some kind of tachometer to measure revolutions directly, which is what you want. Of course, that adds more circuitry.

Just a check:
This is the circuit you are currently using except for the added 5v regulator...IMG_0070r.jpg
and there is nothing special on the driver - it's basically this?
 

be80be

Joined Jul 5, 2008
2,072
You can not read the motor like you have that's what's killing your uno
You can't read across the motor you have emf from it who knows what voltage you end up on the power rail of the arduino.
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
How many Arduinos do you usually stock? What is a cowhock anyway?.......I have heard of cowlick, but not cowhock.
Hundreds. We sell a 3D scanner based on an arduino board so I can just rob out stock as much as needed. Knockoff Uno clones, anyway.

Uhhhh....well it was a combo of Cowboy and Hockey as those were my interests back in high school and usernames tend to stick around with you lol.
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
Just a check:
This is the circuit you are currently using except for the added 5v regulator...View attachment 142975
and there is nothing special on the driver - it's basically this?
[/QUOTE]
Correct. Turned out we started blowing these drivers and had to step up to a heavier duty L298N.

The whole motor voltage thing worked great off this circuit. Flawlessly. But since I added everything together its been wack. In fact, the positive voltage side is so erratic, I have been measuring up from the negative side, if that makes sense. Its currently operating...but I feel like it is covered with a bandaid as opposed to a true solution. Why shouldn't it work though? It is essentially just making a voltmeter out of the Uno, and the uno happens to also be controlling the motor being measured.

A motor with a rotary encoder was our initial thought, but you still need at least one end stop so it knows where home is. Otherwise if it was ever shut off mid stroke, the poor door wouldn't know how many steps to close. This was the only way we thought of to eliminate both stops. Also, if there is some kind of blockage, it will protect the motor and shut it off so it doesn't stall out forever.
 

philba

Joined Aug 17, 2017
959
Funny how people see different things in the same post!

Position data is best taken from endstops like you mentioned or some sort of rotary encoder. Even a disk with a hole in it and some sort of optosensor to read it works. You might be able to detect a blockage by measuring current draw on the motor driver (easier at the ground return of the driver). If you see the stall current, stop the motor. You'll need to characterize your motor for stall current.

Note also that feeding any microcontroller and a motor off the same power rail is going to have problems due to the electrical noise the motor puts out. Also current draw fluctuations of the motor can be problematic. I'd use a separate LDO regulator with a blocking diode for microcontroller. This to prevent sag on the motor pulling the LDO output down. Use a largish cap as a reservior on the regulator side of the diode. Getting power distribution right is a key, but often ignore, part of any project.
 

BR-549

Joined Sep 22, 2013
4,928
cowhock35........digital electronics are like commissioned officers......or women. They require special attention and maintenance. The power supply can't be too low or too high.....it needs to be just right. And it has to be fresh and clean.......no second hand voltage.

And you can not abuse, but must pamper an I/O pin. Manners mean everything.

A data sheet lists the manners.
 

dendad

Joined Feb 20, 2016
4,451
Hooking the analog inputs to the motor like that is a big no no!
If you need to do it that way, add series resistors between the motor and the Arduino and clamp diodes to protect the Arduino inputs from voltage spikes. It is generally never a good idea to connect analog inputs directly to the voltage source. Always add series Rs and leave provision to have bypass caps on the Arduino inputs too. Clamp diodes to 5 volts and gnd help clip the spikes.
ArduiniAIn.jpg
 

Thread Starter

cowhock35

Joined Dec 25, 2012
48
UPDATE:

Door is currently working flawlessly, with the only changes being powering the Arduino 5V rail with the 7805.

I am running the motor leads directly to the Arduino. They are only coming in at 4.5-5.5 volts, which isn't way outside the realm of safe, but it seems like a general consensus that this is a very bad idea. Especially notable is that I have a very brief time-frame to get this product to market (hopefully to Amazon by April), and I won't have time to do more than a month of two of consumer testing, so I would like to ensure that from a theoretical standpoint at least, the electronics should function for at least a few years. The motor will only run twice per day, but it will be hanging around checking for light input much more than that.

Hooking the analog inputs to the motor like that is a big no no!
If you need to do it that way, add series resistors between the motor and the Arduino and clamp diodes to protect the Arduino inputs from voltage spikes. It is generally never a good idea to connect analog inputs directly to the voltage source. Always add series Rs and leave provision to have bypass caps on the Arduino inputs too. Clamp diodes to 5 volts and gnd help clip the spikes.
View attachment 142992
Thanks Dendad, I'm afraid I don't have any other slick ways of shutting the motor on and off without endstops than a current or voltage spike. However, couldn't I go about it totally differently with say...transistors? Run the motor leads to a transistor with appropriate gate current which would just switch a Digital pin high or low as sensor to the Uno? This would protect the board and also leave me with a clean circuit.

If not, would a protection circuit like the one you drew be a safe enough way to implement this project? A few passives is essentially no added expense at the fab house and would be easier than redesigning a new transistor circuit. I am not familiar with clamp circuits though, so not totally sure what is going on the schematic you sketched or what values would be good to start with. A lot of the example circuits I have seen have a cap not a resistor in the Vin line.
 
Top