Arduino Servo Knob - with an external power supply [solved]

I put together the Arduino UNO - Knob example for controlling a single servo (https://www.arduino.cc/en/Tutorial/Knob).

Using built-in 5V and ground pins from the Arduino, it worked nicely. Next, I tried an external power supply, built around the L7805CV, 5V 1.5 Amp voltage Regulator, from this website: ( http://learn.explorelabs.com/category/diy-kits/)

As you can see from the Fritzing diagram, Arduino UNO is getting its power from the USB port. It's not getting power from the external power supply.

It worked fine. Even better, with the external power supply, I got smooth, jitter-free response out of the servo (TowerPro MG995).

BUT, when I disconnected the Arduino UNO from the USB port, and the potentiometer was in the 1023 position (turned full to the right), the "ON" and "L" lights on the Arduino UNO turned on.

This spooked me since I feared I was about to fry the Arduino UNO. I quickly disconnected the Analog 0 and Digital 9 wires.

Fortunately, I've been using the Arduino UNO without problems for other examples; But I just can't figure it out why the lights were on if I disconnected it from the USB port.

Is it picking power through the Analog 0 or Digital 9 pins? Will this harm the Arduino UNO in the long run? How can I prevent this from happening?

Any advise is greatly appreciated.

Pendequan:
Is it picking power through the Analog 0 or Digital 9 pins?

Of course.

Pendequan:
Will this harm the Arduino UNO in the long run?

Yes.

Pendequan:
How can I prevent this from happening?

Never connect an external source of power to Arduino pins.

It's called "BACKFEEDING" and it will draw the entire 55mA necessary to power the arduino througg the analog pins. Obviously, Paul is NOT saying "Do not connect analog voltages to the analog pins , as that would not make any sense. What he is saying is NEVER disconnect the arduino's power when you have any wires connected to either Digital pins or Analog pins.
I have verified that Backfeeding affects both.
Thi requires you implement a power-down protocol of Shutting down ALL powered devices connected to arduino before shutting down arduino. In case you are wondering , this does in fact mean you need all digital and analog pins isolated by arduino controlled relays or manually disconnect the wires ir make sure external devices have their own power before you power off the arduino.
If it requires power , it must have it's own or be disonnected before powering down arduino. The backfeeding is occurring through protection diodes that are only rated for 100 mA.

Hi, raschemmel

What a great reply to my issue. It really helps to advance the knowledge of many newbies like me, wanting to learn more about the Arduino. Thank you very much.

As you surely know, jittering is a common problem many Arduino users encounter when using servos.

Now, if I understood correctly, I first power down the servo power supply, then the Arduino UNO, would that be a safe solution in the long run?

Also, I was considering to implement an ATMega328 setup (Arduino on a breadboard) and draw its power from the same power supply; in that way, both the servo and the Arduino would share the same power. Would the backfeeding be a problem in this scenario?

Best Regards,

Pendequan

Now, if I understood correctly, I first power down the servo power supply, then the Arduino UNO, would that be a safe solution in the long run?

That's one way. The fancy way is an isolation barrier of relay contacts controlled by the arduino, that isolates ALL I/O from the arduino by deenergizing the relays BEFORE shutting down the arduino, all under S/W control. Thus, there IS NO I/O per se UNTIL the arduino says so (by turning on the relays).
Since the relays are powered by the same 5V that powers the arduino, if you turn off the arduino power you automatically turn off the relays , disconnecting the I/O.

Perhaps I was a little bit less than clear.

I said "Never connect an external source of power". Two words there have specific meanings in this context. "External" means "other than the source powering the Arduino". So if the same (5 V) power supply is powering the Arduino and the circuit connected to its inputs (or indeed, outputs), that will not be a problem.

The second important word, is "power". Power is the product of voltage and current. If the current is safely limited, it is not a problem as the power is negligible.

And by the way,

raschemmel:
The back-feeding is occurring through protection diodes that are only rated for 100 mA.

Care to re-think that?

The problem with the circuit shown, is actually not the servo, but the potentiometer which has been wrongly connected to the servo power supply instead of the Arduino. As described, if the potentiometer is turned toward maximum, it is directly connecting the servo supply to the Arduino - this is a problem even when the Arduino is turned on. In fact, all three wires of the potentiometer must go to the Arduino with no direct connection whatsoever to the servo.

The servo itself should not be capable of back-feeding the Arduino pin.

Pendequan:
Now, if I understood correctly, I first power down the servo power supply, then the Arduino UNO, would that be a safe solution in the long run?

No, because it is neither practical nor necessary!

Pendequan:
Also, I was considering to implement an ATMega328 setup (Arduino on a breadboard) and draw its power from the same power supply; in that way, both the servo and the Arduino would share the same power. Would the back-feeding be a problem in this scenario?

No, because you would have fixed the terrible blunder I have pointed out. :grinning:

I've never seen that diagram before but you still need to power off the arduino LAST as a precaution.

raschemmel:
I've never seen that diagram before

Didn't read the first post?

Didn't check on my comment.

OK, Got it.
Classic Backfeeding thriugh wiper , powering arduino from breadboard 7805.
This would NOT occur if arduino was powered down LAST (after 7805).
In that diagram the pot should be connected to arduino and a second 7805 should bd added for arduino IF tge UDB is going to be disconnected like he did.

(The protection diodes in the analog input circuit)

Hello,

Care to re-think that?

The problem with the circuit shown, is actually not the servo, but the potentiometer which has been wrongly connected to the servo power supply instead of the Arduino. As described, if the potentiometer is turned toward maximum, it is directly connecting the servo supply to the Arduino - this is a problem even when the Arduino is turned on. In fact, all three wires of the potentiometer must go to the Arduino with no direct connection whatsoever to the servo.

The servo itself should not be capable of back-feeding the Arduino pin.

Brilliant, Paul_B!

You were right in your line of thought; I redid the connections (see attached Fritzing diagram) and tried it on the breadboard: No more backfeeding. No lights turn on when I first disconnect Arduino UNO power. Servo works smoothly, jitter-free.

I hope this helps other newbies in their projects. Thank you so much.

Attached is a side by side picture of the Servo Knob example and the Servo Knob with External Power Supply, in case someone could find it useful. Always use a heatsink with the L7805 voltage regulator. It gets hot after a few minutes of playing with the potentiometer.

UPDATE: 12V 1A external power supply is now being used, same smooth movement, less heat dissipated by the L7805.
A 9V wall wart is insufficient to power the servo (shows jitter).

raschemmel:
The backfeeding is occurring through protection diodes that are only rated for 100 mA.

The pot wiper is connected to A0.
That's where the diodes are. (Anode yo A0 pin, Cathode to 5V pin , Since USB is not connected, there is a difference of potential. Anode is more poditively biased than csthode causing diode to conduct Arduino 5V pin has (5-0.7V)= 4.2V, thus powering arduino.

Replace the =Topic # in the URL of your browser with "330958.0" and click Search. Read Reply#1 by DVDDOUG in that post.

You still haven't noticed?

You still haven't noticed?

I have no idea what you are talking about.

Read - very carefully - what I quoted. :grinning:

You quoted my statement about the protection diodes rated for 100 mA.

So ?

I noticed the OP did move the pot (which fixed the problem) which both of us recommended but I don't know what you are talking about.

What are these protection diodes rated for 100 mA?

They're internal diides and I read that somewhere in a post ( thst they were rated forv100 mA .
Does that sound unreasonable ?

You read wrong. Atmel recommends keeping under 1mA.

It's in this article. I have posted it before.

Atmel AVR182 Zero Cross Detector.pdf (95.1 KB)