# Arduino project. USB+external power source - works fine. No USB - everything goes crazy

I have this circuit:

It is a simple project - a focus system for a taken lens and anamorphic adaptor. I have three pots. The first one I use as a manipulator. The second is used to get the position of the continuous rotation servo (JX DC6015 Mod) - motor#1. The third pot is used to control the position of the other continuous rotation servo (JX DC6015 Mod) - motor#2. There are also some buttons and diodes for calibration purposes. Motor#1 rotates the taken lens and motor#2 rotates the adaptor.

Well, let's look at the circuit. I also have there a 1N4007 diode and a 47uF cap. I use this scheme because the circuit even didn't turned on when I tried to power it from a battery. Now at least it turns on. But let's leave it aside for a moment.

The main problem is that everything works perfect when I use an external AC-DC adaptor (or battery) with Nano's USB connected to my laptop. As soon as I unplug the USB cable the system goes crazy. In case it is connected to the AC-DC adaptor it just starts rotating servos several turns CW and then backwards. In case it is powered just with a battery the servos just rotates CCW or CW very fast and never stop.

It looks for me like I have a GND loop problem. I tried to decouple my pots by adding 3 caps for each pot connecting a signal pin with GND, but things went even worse. It didn't work even with USB connected to Arduino. Servos rotated CW and CCW changing the direction very fast.

I tried two other Arduino controllers, but it was all the same.

I've tested all the GNDs. They are all connected together.

Then I decided to try to isolate VCC and GND from servo putting NME0505SC between power source and Arduino. But it didn't help as well.

What could be done to make it work just from one power source?

• Fritzing should be able to give you a circuit schematic rather than the wiring diagram you have posted. The schematic is preferred on this site but both might be useful in this case. – Transistor Apr 14 '18 at 9:15
• Try powering the Nano from a USB phone charger. If this works in the same manner as connecting to the laptop then I suspect that the Nano cannot tolerate the noise on the motor supply. – Transistor Apr 14 '18 at 9:18
• But I need it to be powered just from one supply. Is it worth to try an RC filter. But I don't know the frequency of this noise. I found a processing project making an oscilloscope out of Arduino. I will try to measure noise on 5V Arduino and see if it changes when servo starts. – Anton Zimin Apr 14 '18 at 9:52
• The most obvious issue I see is you are not supplying enough voltage to the VIN power pin. The documentation for the Arduino Nano states that VIN must be 7-12VDC, and you are supplying 5.6VDC (battery) - 0.6VDC (across that diode), leaving only 5VDC at VIN. So you are not meeting the drop-out specification for the onboard 5VDC linear voltage regulator, and that's why you're not getting regulated 5VDC power on the board, and that's why the board is behaving erratically. – Jim Fischer Apr 14 '18 at 12:21
• I believe you misconstrued the concept of "ground loop noise problem". The ground loop problem occurs when TWO grounds to TWO different sources are used. And, according to you, when two sources are used, this is exactly where you have no problem, which is opposite to what sometimes occurs with ground loops. – Ale..chenski Apr 14 '18 at 19:19

In addition to my comment regarding the requirement that the voltage on the Arduino Nano's $V_{IN}$ power pin must at all times be 7 – 12 VDC, here are some additional troubleshooting suggestions.

1. When troubleshooting a power supply problems, do not use a voltmeter. ALWAYS use a digital storage oscilloscope (DSO) (preferred), or an analog storage oscilloscope with sufficient storage persistence (if you don't have a DSO), to observe the power supply's voltage versus time behavior over a sensible time period—e.g, 200 – 500 milliseconds.

2. Using a DSO, observe the unregulated voltage at the Nano's $V_{IN}$ power input pin. Ensure $V_{IN}$ never drops below the regulator's minimum input voltage, which for the Arduino Nano would be 7 VDC (see the data sheet for the Arduino Nano). Ensure this unregulated voltage does not exhibit unacceptable problems such as: large voltage spikes; large ripple; the voltage occasionally exits the 7 – 12 VDC window, etc.

3. Using a DSO, observe the voltage at the Nano's 5 VDC and 3.3 VDC power output pins WHILE YOUR SOFTWARE IS RUNNING. Ensure the voltage at the 5 VDC output power pin is between 4.95 – 5.05 VDC (see the LM1117 data sheet), and the voltage at the 3.3 VDC power output pin is between 3.267 – 3.333 VDC (see the LM1117 data sheet). Check for the presence of large voltage spikes, voltage droops, excessive ripple, etc.—i.e., anything that is abnormal on a DC power supply rail that could cause the Arduino or the surrounding circuitry to "hickup": spontaneous resets, analog-to-digital conversion failures, etc.

One last comment. The Arduino Store webpage for the Arduino Nano gives conflicting values for the required voltage range for VIN. The "Tech Specs" section states VIN's required range is 7 – 12 VDC, which seems sensible (correct) to me. But the "Documentation > Power" section claims VIN's required range is 6 – 12 VDC. That 6 VDC spec is BELOW the LM1117IMPX-5.0's spec'd dropout of 6.2 VDC (see the LM1117 data sheet), which is risky business for a production product. If VIN droops below 6.2 VDC even a little bit, you get "unspecified behavior" from the Nano's LM1117IMPX-5.0 voltage regulator.

• Why do you think it works well with another servo? – Anton Zimin Apr 14 '18 at 22:45
• @AntonZimin, Jim Fischer (and myself) do not "think". We are confident that your problem is in insufficient saggy power supply. The other servo works because it likely has less inrush current when controlled, and the power supply sags less. It works by accident. You can call it "noise". But if your ambient temperature changes or battery goes down a bit, it will stop working again. Fix the input voltage, or regulator. At very least, remove your in-series diode. – Ale..chenski Apr 15 '18 at 1:11
• @AntonZimin, don't spend too much time trying to guess what the problem might be. Use test equipment, and specifically a DSO, to make useful measurements/tests that can tell you with certainty what is happening at the Nano's VIN power input pin, and 3.3V and 5V power output pins. We can try to speculate and guess all day long what the problem might be, but that's usually a waste of time. Fifteen minutes of testing with a DSO can tell you whether the Nano's voltage regulators are functioning nominally or not. – Jim Fischer Apr 15 '18 at 5:14
• When I remove the diode it even doesn’t turn on if I try to power it with a battery. I’ve tried to give Arduino a separate 12v with all the grounds connected and it turnered off in 10 seconds because of overheating. – Anton Zimin Apr 15 '18 at 10:33

Some additional thoughts and troubleshooting suggestions.

Thoughts

1. There are numerous articles on the Internet that discuss power supply noise problems caused by connecting together analog circuitry, digital circuitry, and electrically noisy components like DC motors. These articles discuss various strategies for reducing power supply noise in mixed domain circuits. Try an Internet search using the keywords "mixed signal grounding" or "+breadboard mixed signal grounding" for breadboard-related articles. For example: See Walt Kester's Analog Dialog article titled "Grounding and Decoupling: Learn Basics Now and Save Yourself Much Grief Later! Part 1: Grounding". (n.b. Use the download link to get the PDF version of this article. The webpage cuts off some of the information at the end of the article.)

2. Your original post makes no mention of your potentiometer's resistance value. Keep in mind that those three pots are connected in parallel across the Nano's 5 VDC power and GND pins. For example, if each pot has a resistive track (end-to-end) resistance of 100 ohms, the equivalent resistance of those three pots in parallel is 100/3=33.3 ohms, which would continuously draw about 150 mA from the Nano's 5 VDC power pin. That's bad.

3. Ensure your pots are wired properly so that each pot's end-to-end "track" resistance terminals are wired across the Nano's 5 VDC and GND pins. Ensure that each pot's wiper terminal is not connected to either the 5 VDC or GND pin on the Nano.

simulate this circuit – Schematic created using CircuitLab

Troubleshooting Suggestions

1. Remove all of the peripheral circuits from the breadboard and from the Arduino Nano—i.e., remove the LEDs, the potentiometers, the pushbutton switches, and the servomotors.

2. Connect a 12 VDC power source to the Nano's VIN and GND pins and run your code on the Nano. Using a DSO or DC voltmeter monitor the Nano's 5 VDC power pin for a period of at least five minutes. Verify that the Nano's onboard LM1117IMPX-5.0 linear voltage regulator does not overheat and shut itself down, which would cause the voltage at the Nano's 5 VDC pin to drop to (approximately) zero.

3. Disconnect the 12 VDC power source from the Nano's VIN and GND pins. Reinstall ONLY the three pushbutton switches. Using the procedure from step 2, monitor the voltage at the Nano's 5 VDC power pin for five minutes.

4. Assuming no problems are discovered during step 3, do the following. Modify your source code to turn ON the three LEDs and never turn them OFF. Leave the pushbutton switches in place and repeat step 3 for the three LED circuits—i.e., in step 3 replace "the three pushbutton switches" with "the three LED circuits". Ensure the board does not overheat when running the LEDs continuously for five minutes.

5. Assuming no problems are discovered during step 4, keep the pushbutton switches and LEDs in place, and perform step 3 for the three potentiometers. Use the same software from step 4 that turns ON the LEDs and does not turn them OFF. Ensure the board does not overheat when running this combination of circuits continuously for five minutes.

6. Assuming no problems are discovered during step 5, keep the pushbutton switches, the LEDs, and the potentiometers in place, and perform step 3 for the two servomotors. Use the same software from step that turns ON the LEDs and does not turn them OFF. Ensure the board does not overheat when running this combination of circuits continuously for five minutes.

I added shottky diode and a cap 2200uF before the vin and it solved the problem. It’s true it was a power problem but I didn’t raised the voltage, just put a big cap and it works fine with ac-dc. As for the battery, it seems I have to try another one or double it.