I'm using Adafruit 16-Channel 12-bit PWM/Servo Shield with Arduino Uno controller

In setup() I have a number of default positions with PWM commands for motors with plug of USB to PC and turning on

I'm trying to figure out, how to avoid setup() commands, or any other signals during process to servos, in case if shield is not powered from power adapter, which is 6V 8Amp in my case, to not send signal to servo while it is not powered by power supply

  • Have you thought of using an input pin to sense the voltage of the power adapter? You only have to isolate it from Vcc with a diode (as long as the voltage of the adapter is not higher than the Unos 5V. In that case you also would need a voltage divider.
    – chrisl
    May 19, 2019 at 19:47
  • @chrisl Hello, and what is the program part in this case, since I need this condition in sketch code. It would be very useful to find some more detailed guide on this task
    – lf80
    May 20, 2019 at 3:24
  • The only releveant code here is to use a value = digitalRead(pin_number). Youc an then do whatever you want with this, for exmple check in an if statement, if the result is HIGH or LOW by doing if(value){...} else {...}. I don't know, what I should write there in my answer.
    – chrisl
    May 23, 2019 at 13:34
  • @chrisl Yes, but I could not yet use this scheme to check result. As I've said below, it is not enough voltage with using of diode
    – lf80
    May 25, 2019 at 7:45

1 Answer 1


I would propose a circuit like the following:


simulate this circuit – Schematic created using CircuitLab

The voltage divider (consisting of the resistors) will divide the 6V to 5V for the Arduinos digital input. The values are not critical, they can be made higher, but maintain the relationship to still get the 5V. The diode will prevent current to flow from the shield into the voltage divider, when the shield is powered through other means. Now you can simply do a digitalRead() on the corresponding digital input pin of your Arduino, to check, if the power was applied.

Please notice, that the diode will reduce the voltage a little by it's forward voltage (depends on the diode). But that shouldn't be a big problem.

  • Thank you for answer. Can you clarify, if this way I could monitor power to the servos using one of "digital input pins" with resistor divider to divide that down to 5v or less for the Arduino Uno, what is a difference of using "analog pin" in this case, I found number of close guides: 1. Measuring DC Voltage 2. Arduino Battery 3. Energy meter
    – lf80
    May 21, 2019 at 17:09
  • From your question I assumed, that you use a normal power adapter, which means, that the 6V for the shield are already regulated beforehand. I think of a wall wart. In this case there are inly two possibilities: 6V or no voltage at all. Then the digital pin is sufficient. If you have a battery connected there and want to also sense the low voltage case, you can use an analog pin.
    – chrisl
    May 21, 2019 at 17:43
  • Hello, I could not yet use this scheme to check result. Something is incorrect for particular shield. I've soldered scheme exactly as you shown, 2 resistors 1.0 and 5.07, diode 1N4148. Without anything power jack shows 6.56V, shield turns on. Through scheme voltage runs from 6.29 to 6.52V, shield does not turns on, seems like it is not enough voltage
    – lf80
    May 25, 2019 at 7:40
  • The shield should also work with voltages down to 5V. Is the green LED on the shield on? Does it work, if you bridge the diode? Is it mounted the right way? (Putting it in reverse will block the voltage to reach the shield)
    – chrisl
    May 25, 2019 at 8:34
  • Yes cathode (pole with black line) directed with output wire to the shield, should prevent flow from the shield into divider. Anode pole directed to 1kΩ resistor from plus. Voltage from VCC and GND runs 6.18, 6.29, 6.52V... Green LED on the shield off, shield does not works. Without scheme direct meter test shows 6.56V, green led on, shield works. I did not tried bridge the diode
    – lf80
    May 25, 2019 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.