Measuring Peripheral Power With Arduino UNO R3 and R4 WiFi, Pi Pico W, Adafruit Feather NRF52840, BBC Micro:bit V1 and V2, Cytron Maker Nano RP2040

by kevinjwalters in Circuits > Microcontrollers

807 Views, 6 Favorites, 0 Comments

Measuring Peripheral Power With Arduino UNO R3 and R4 WiFi, Pi Pico W, Adafruit Feather NRF52840, BBC Micro:bit V1 and V2, Cytron Maker Nano RP2040

arduinounor3-measuring-12rgbpixels-65.JPG

This article shows how to measure the current draw for a peripheral powered by a microcontroller including the use of GPIO. The inevitable voltage drop can also be measured. A range of popular microcontrollers and hobbyist peripherals are shown as examples. This is a practical follow-up to Instructables: Powering Peripherals From a Microcontroller - Arduino UNO R3, Pi Pico W, Adafruit Feather NRF52840, BBC Micro:bit and Cytron Maker Nano RP2040 which looked at the specified current limits and how to explore unspecified ones. Peripherals can always be powered direct from an external power supply or battery but this may be less convenient and add to the size, cost and complexity of a project.

A simple testing program was written in C/C++ for Arduino and then ported to CircuitPython and MicroPython for testing. It uses three GPIO for a high output, servo control and WS2812 RGB pixels (like Adafruit's NeoPixels).

A variety of typical power sources was used for the testing with two multimeters to measure the voltage and current. An oscilloscope mode was used to examine the varying servo current. The testing is presented as an edited video with a summary of the voltage and current for each peripheral.

There's also a look at the voltage drop on USB ports and cables for different constant loads and a closer look at the spiky servo current and how it's synchronised with the control pulses.

The interest in this area originated from making the constant current LED driver circuit for an illuminated name plate which consumes about 450mA with five flexible "filament" LEDs at full brightness.

A few of the tests intentionally draw current which is just beyond the limit or suggested value. This can damage the microcontroller, some of its pins or other components on the board permanently, especially if the board is subjected to this for a prolonged period.

Supplies

  1. Lots of microcontrollers boards. The following microcontroller boards were tested, the first two are 5V microcontrollers with 5V GPIO, the rest are 3.3V.
  2. Arduino UNO Revision 3 - a very popular board.
  3. Arduino UNO Revision 4 WiFi - looks like an UNO R3 with extras but has many differences for power.
  4. Raspberry Pi Pico W - a great value small board with a buck-boost DC-DC converter.
  5. BBC Micro:bit V1 - a well-established board in the education arena.
  6. BBC Micro:bit V2 - the second revision of the board, nRF51 series microcontroller replaced with nF52 series, many power differences.
  7. Adafruit Feather nRF52840 Express - one from the Adafruit Feather series, convenient for LiPo battery power features.
  8. Cytron Maker Nano RP2040 - a board following the Arduino Nano layout with a 3.3V microcontroller.
  9. Some interesting peripherals. The following devices were tested.
  10. 5mm unbranded green LED with a 330/680 ohm resistor for current use at ~4mA at 3.3V/5.0V.
  11. Adafruit LED Sequin - surface-mount LEDs with a series resistor intended for wearables and GPIO powering.
  12. dLUX-dLITE Succulent Golden Yellow LED with a 2x68/300 ohm resistor for 3.3V/5.0V aiming for 10mA.
  13. 5mm unbranded orange LED with a 68/150 ohm resistor for 3.3V/5.0V aiming for 20mA.
  14. Unbranded 5V Red Laser Dot Diode Module (KY-008) - specified as 30mA.
  15. Unbranded MQ-3 gas sensor module. The sensor's internal heater consumes the vast majority of the power.
  16. Kitronik FS90 Micro Servo - a small servo used in the Kitronik Linear Actuator, intended for 4.8V-6V power.
  17. Unbranded RGB pixel ring - 12 5x5mm WS2812 protocol RGB LEDs, similar to Adafruit's NeoPixels.
  18. Two multimeters including one ideally with a low burden voltage to measure current without too much impact on the circuit. An oscilloscope to look more closely at varying current. The following were meters were used.
  19. The voltage was measured using an AstroAI DM6000A R multimeter.
  20. The current using a Zoyi ZT-703S oscilloscope multimeter in 10A mode.
  21. The Zoyi in oscilloscope mode showing the voltage across a 0.25 ohm shunt resistance was used for a more detailed look at the current for the servo.
  22. Some wires with to connect peripherals with a gauge appropriate for the expected current draw. The crocodile (alligator) clip lead bundles sold for a few pounds/dollars/euros aren't always good for high currents due to their small gauge wires, unusual alloys for conductors and poor/unreliable crimping. The following items were used to facilitate connectivity.
  23. The devices were soldered to a piece of stripboard or inserted into sockets on the stripboard to provide reliable connectivity.
  24. Two multicore cables were made with AWG 18 wire and male and female "dupont" connectors on one end and male on the other end. The soldered join was left exposed allowing meter probes to be crudely clamped to it.
  25. Some relevant/appropriate power sources. The following were used in an attempt to pick some commonly used/available power sources.
  26. An old, study laptop with USB2 ports. The same port was used for all tests.
  27. A Maplin variable voltage "wall-wart" style 2.25A PSU with a 2.1mm centre-positive barrel connector (jack). This was set to 7.5V, the first voltage above the Arduino UNO R3 and R4 WiFi's minimum of 7V.
  28. A 1000 mAh Lithium Ion Polymer (LiPo) battery from Kitronik. This was unused since being fully charged about six months ago.
  29. A Raspberry Pi 15W USB-C Power Supply. This is specified as 5.1V and 3.0A.

Adafruit LED Sequins

adafruit-green-sequin-65.jpg

Adafruit LED Sequins are surface mount technology LEDs with a current limiting resistor in series intended for wearables. The series resistor varies per LED colour to accommodate different LED forward voltages (Vf). They are specified as working from 3V to 6V (DC) and "when powered from 3.3V they draw about 5mA" and "so you can put up to 4 or 5 in parallel on a single microcontroller [GPIO] pin".

The low current draw allows these to be used on GPIO outputs but 4 to 5 of them in parallel equates to 20-25mA which is too high per pin for most 32bit microcontrollers. The actual current would be lower due to the likely and considerable voltage drop on the GPIO output when faced with such a load.

If the Vf of an SMT green LED ranges from 2.6V to 3.2V for 5mA to 20mA then for a (low impedance) power supply with a 100 ohm series resistor:

  1. at 3.3V (3.3-2.6)/100 = 7mA flows;
  2. at 5.0V (5.0-3.2)/100 = 18mA flows.

The datasheet for the green SMT LEDs specifies an absolute maximum continuous current of 25mA. The Vf at 20mA is specified as 3.40V (typical) and ranging from 2.80V to 3.80V. This is a surprisingly large range and one that's far from helpful for selecting a resistor to limit the current!

5mm LEDS

kingbright-5mm-green-orange-diffused-65.jpg

These are standard 5mm LEDs, the green ones came in an unbranded electronics kit, the oranges ones were a bulk purchase on Ebay. A T7 component tester shows the Vf (at unspecified current) is 1.93V for orange and 1.97V for green.

5V Red Laser Dot Diode Module (KY-008)

ky008-laser-module-resistorview-65.jpg

There is very poor documentation for this type of unbranded or low-brand module. The circuit is simply a laser diode with a 91 ohm surface mount series resistor limiting the current between S and - terminals. The mysterious third terminal labelled + has a 10k resistor to S -, this has no obvious purpose. The pin order could vary for modules that appear similar.

A T7 tester shows the Vf is 2.28V. The presence of laser speckle is a good indication of lasing, these LEDs only start lasing at around 3.5V, below that they are more like a dim red LED.

These laser diodes are likely to be the same ones used in red laser pointers. The module is typically cited as having 5mW optical output power at 5V which equates to the upper limit of class 3R lasers (previously known as Class IIIa). Testing like Lucid Optical Services's test of laser pointers, the lack of branding and the absence of data sheets strongly suggest this is unlikely to be accurate.

Do not look into the beam or look directly into the beam with optical instruments!
The end of the brass barrel can be turned to defocus the beam making them safer.

MQ-3 Gas Sensor Module

mq-3-gas-sensor-module-65.JPG

This is one of the MQ series of gas sensors mounted on a board with an analogue output and an opamp acting as a comparator to produce a digital output. This type of sensor has a simple heating element. This means they consume a fair amount of current (100-150mA) and they require an accurate voltage for a constant heating power to achieve the correct temperature. A 10% difference in voltage equates to a 21% difference in power for a simple, resistive heating element.

Datasheets for this type of sensor (e.g. SparkFun and seeed studio Grove) will specify the heating circuit voltage as 5V +/-0.1V.

These sensors typically have a recommended burn-in time. This sensor was used previously for Adafruit Learn: Comparison and Experimentation with Flammable Gas Sensors.

Other manufacturers like Sensirion make smaller sensors with heaters that require less power.

Kitronik FS90 Micro Servo

kitronik-linearactuator-fs90servo-65.jpg

This hobbyist/RC servo is part of the Kitronik Linear Actuator kit. The rack and pinion from the kit was added to the servo for the test to give the servo some work to do. It was used with a small clamp on it to lift its own weight. The Q&A on servo page implies a recommended voltage between 4.8V and 6.0V to power the servo. The stated compatibility with the Kitronik Servo:Lite board for :MOVE mini indicates it works with 3xAA batteries, 4.5V and lower as batteries discharge.

Servos are just a geared motor with a control circuit using positional feedback. The current will depend on the motor speed for the movement and the torque from the load which may include effects from inertia. The stall current when it can no longer move/hold its load is often quoted for a servo at a specified supply voltage.

The testing using the oscilloscope revealed this servo has surprisingly spiky power use. This is probably representative of most servos like this one. A dedicated power supply and a capacitor would be useful in a real application to reduce the effects of fervent motor activity on the power supply.

Unbranded RGB Pixel Ring

unbranded-rgbpixel-ring12-65.JPG

5x5mm RGB pixels uses around 30-50mA of current. Lots of them together can require a substantial power supply due to the high current which can be well beyond what can be supplied by a microcontroller board. This ring of twelve uses the single-wire WS2812 protocol, the same one as Adafruit's NeoPixels. There was no documentation for this product but from testing the pixels work with 3.3V power (at a lower brightness than 5V) and 3.3V logic levels.

The test program sets each pixel to full brightness to avoid any effects from the use of pulse-width modulation (PWM) in the pixel's LED driver.

All twelve pixels at full brightness draw around 400mA at 5V making this a good test for high current usage.

Test Setup

mp-mc-votlagecurrent-testsetup-1-65.JPG
arduinounor3-measuring-12rgbpixels-65.JPG

The testing setup can be seen above as a diagram and photograph of the setup on a desk.

  1. Voltmeter: the AstroAI DM6000AR. It wasn't used for the testing presented here but this meter includes a relative mode feature. This could be used to show the voltage drop relative to the unloaded voltage.
  2. Ammeter: the Zoyi ZT703-S. The 10A connector is being used to select the lowest shunt resistor to minimise the voltage drop due to burden voltage.
  3. Peripheral: the RGB pixel ring, bottom right in the photograph. This is sometimes referred to as a device under test (DUT) in this scenario).
  4. Power Source: The Arduino UNO R3's 5V pin.
  5. Resistor: The stripboard has four 1 ohm precision resistors in parallel.
  6. DSO: the ZT703-S's (digital storage) oscilloscope (DSO) mode. This can be used to take a very close look at a current which varies - this is useful for the servo.

There are two thick (AWG 18) multicore cables with soldered connections that are connecting the power from the Arduino UNO R3's 5V pin to the stripboard. The insulation on the wire does not fit inside the connectors for this size wire. The cables have male and female connectors and two exposed soldered connections which are convenient for connecting meter probes. The crocodile (alligator) clip cables are not being used here as cables, the clips are just being used to mechanically hold the probes firmly against the wire.

There's a lot of exposed, proximate power connections here in this quick, improvised setup - care needs to be taken not to short the power source. For regular testing a neater, safer set of cables would be a good idea.

Stripboard Circuit for Peripheral Testing Version 1

peripheral-power-tester-stripboard-v1.png

The diagram above shows the layout of the stripboard which was used to facilitate the testing. The soldered connections and reasonable quality sockets/pins provide reliable connectivity.

The socket for the laser diode module was deliberately soldered at an angle to avoid it pointing at the camera during videoing. A stationary focussed laser pointing directly at a digital camera will damage its sensor.

There are some design flaws in this "version 1" layout. A few potential improvements are listed below for a subsequent revision.

  1. There are far too many ground connections scattered around. This seemed useful but in practical terms it creates a significant risk of accidentally shorting the power source. It would be better to have the (labelled) ground connectors just at the bottom of the board.
  2. Labels and some colour coding for the sockets/pins would make things clearer.
  3. A socket left unconnected would be useful for holding the cable to get an unloaded measurement.
  4. Some high value resistors (1M, 100k, 10k) might be interesting for showing more detail on the GPIO voltage drop.
  5. A good quality multi-throw switch could be used to switch between peripherals.
  6. A good quality external ADC (like a TI ADS1115) could provide accurate voltage measurements logged with a separate microcontroller.

Testing Software

arduinoide-circuitpython-micropython-logos-1.jpg

Arduino C/C++

peripheral-power-test.ino - needs Adafruit NeoPixel and Servo libraries.

CircuitPython

peripheral-power-test.py - needs adafruit_motor and neopixel libraries.

MicroPython

peripheral-power-test.py

Version 1.2

This uses three GPIO pins in the following way.

  1. Permanently high - for use as a GPIO current source.
  2. RGB (WS2812) pixels - incrementally turned on at full white brightness with one every two** seconds.
  3. Servo control - sweeping back and forth repeatedly at three different rates by incrementally stepping the servo, the rate starts at one movement in two** seconds.

At the start it flashes the LED or display five times, on for one second then off for one second. The flashing is intended as a visual indicator of the start of the test cycle. At the end of the test the servo is disabled by setting the control line low and the all of the RGB pixels are turned off. The program then pauses for ten seconds and starts the test again afresh and repeats ad infinitum.

The servo pulse-width modulation ranges from 5.44ms to 2.4ms at 50Hz (20ms period) for all three software ports.

The Arduino port has an inconsistency compared to the other two - it starts the servo step amount at 1 degree rather than 3 degrees.

** the two second period isn't accurate due to its implementation with simple delays.

Pi Pico W Powered by Laptop USB2 Port

Raspberry Pi Pico W powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

The unloaded values below were taken from the unedited video footage. These voltages are across the power supply, the voltage across the peripheral will be a tiny bit lower due to the ammeter's burden voltage. This is discussed later in the article.

The current draw from the servo can be seen in the video above to be very bursty from the oscilloscope view making it difficult to summarise. This is true of all of the microcontroller boards for the servo.

Results Summary

  1. GPIO (3.3V)
  2. Unloaded: 3.338V
  3. 4mA green LED: 3.251V (97.4%) 3.6mA
  4. Sequin LED: 3.180V (95.3%) 7.2mA
  5. 10mA LED: 3.154V (94.5%) 7.6mA
  6. 20mA LED**: 2.995V (89.7%) 14.9mA
  7. 3V3(OUT) pin
  8. Unloaded: 3.338V
  9. Sequin LED: 3.338V 8.1mA
  10. 10mA LED: 3.338V 9.2mA
  11. 20mA LED: 3.339V 19.8mA
  12. VBUS pin
  13. Unloaded: 5.033V
  14. Sequin LED: 5.025V (99.8%) 23.1mA
  15. 10mA LED: 5.030V (99.9%) 9.5mA
  16. 20mA LED: 5.026V (99.9%) 20.3mA
  17. Laser module. 5.021V (99.8%) 30.4mA
  18. MQ-3 module: 4.967V (98.7%) 143.1mA
  19. RGB pixel ring: 0: 5.029V 11.mA, 1: 5.015V 46.1mA , 3: 4.984V 111.8mA, 12:4.847V (96.3%) 407.6mA
  20. servo: 4.96-5.00V

** current is too high for GPIO.

CircuitPython 9.1.1, adafruit_motor 3.4.13 , neopixel 6.3.11, peripheral-power-tester 1.2.

BBC Micro:bit V1 Powered by Laptop USB2 Port

BBC micro:bit V1 powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

The testing program on the micro:bit V1 does not increase the servo speed and limits the RGB pixels to 3 to try to keep the current near the 90mA recommended maximum. There are several peripherals here not intended for use at 3.3V but they were still tested to look at the behaviour. The laser was dim with no laser speckle indicating it was not lasing.

Results Summary

  1. GPIO (3.3V)
  2. unloaded: 3.194V
  3. 4mA green LED: 2.948V (92.3%) 2.6mA
  4. Sequin LED: 2.839V (88.9%) 4.4mA
  5. 10mA LED: 2.746 (86.0%) 5.0mA
  6. 20mA LED**: 2.506 (78.5%) 8.0mA
  7. 3V pad
  8. unloaded: 3.197V
  9. Sequin LED: 3.141V (98.2%) 6.6mA
  10. 10mA LED: 3.138V (98.2%) 8.0mA
  11. 20mA LED: 3.119V (97.6%) 16.0mA
  12. Laser*** module: 3.128V (97.8%) 11.8mA
  13. MQ-3*** module: 3.054V (95.5%) 84.0mA
  14. RGB pixel ring: 0: 3.147V 5.3mA, 1: 3.098V 30.7mA , 3: 3.060V (95.7%) 75.6mA
  15. servo****: 2.88-3.08V

** current is too high for GPIO.

*** voltage too low for peripheral

**** voltage too low and current probably insufficient for peripheral

Editor 3.0.27, MicroPython (micro:bit V1) 1.1.1, peripheral-power-tester 1.2.

The micro:bit Help and Support: Using a servo with the micro:bit offers the following sage advice on using servos with a micro:bit.

Whilst these micro-servos can work with the micro:bit, the specified operating voltage for most servo motors is around +5V and that the micro:bit can only supply a small amount of power to connected circuits (3V and 90mA V1 and 190mA V2max). Trying to draw more power than the micro:bit can safely supply, could lead to damaging the device.
For micro:bit V1, the most reliable way to use this type of servo is to power the micro:bit via a battery pack and to use fresh batteries, as the battery voltage drops the servo will become less reliable.

BBC Micro:bit V2 Powered by Laptop USB2 Port

BBC micro:bit V2 powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

The voltage drop for GPIO is noticeably worse than the micro:bit V1. This could be due to the default current drive mode in MicroPython for nRF52 microcontrollers, the V2 uses an nRF52833.

Results Summary

  1. GPIO (3.3V)
  2. unloaded: 3.268V
  3. 4mA green LED: 2.830V (86.6%) 2.3mA
  4. Sequin LED: 2.702V (82.7%) 3.3mA
  5. 10mA LED: 2.543V (77.8%) 3.8mA
  6. 20mA LED**: 2.275V (69.6%) 5.0mA
  7. 3V pad
  8. unloaded: 3.298V
  9. Sequin LED: 3.298V 7.9mA
  10. 10mA LED: 3.297V 9.0mA
  11. 20mA LED: 3.295V 18.9mA
  12. Laser*** module: 3.297V 13.0mA
  13. MQ-3*** module: 3.283V (99.5%) 91.1mA
  14. RGB pixel ring: 0: 3.297V 5.4mA , 1: 3.293V 37.0mA, 3: 3.285V 69.7mA, 12: 3.240V (98.2%) 300.8mA
  15. servo****: 3.27-3.28V

** extreme voltage drop suggests load is inappropriate for GPIO.

*** voltage too low for peripheral

**** voltage likely to be too low for peripheral

Editor 3.0.27, MicroPython (micro:bit V2) 2.1.2, peripheral-power-tester 1.2.

The micro:bit Help and Support: Using a servo with the micro:bit offers the following sage advice on using servos with a micro:bit.

Whilst these micro-servos can work with the micro:bit, the specified operating voltage for most servo motors is around +5V and that the micro:bit can only supply a small amount of power to connected circuits (3V and 90mA V1 and 190mA V2max). Trying to draw more power than the micro:bit can safely supply, could lead to damaging the device.
For micro:bit V1, the most reliable way to use this type of servo is to power the micro:bit via a battery pack and to use fresh batteries, as the battery voltage drops the servo will become less reliable.

Adafruit Feather NRF52840 Express Powered by Laptop USB2 Port

Adafruit Feather nRF52840 Express powering test with LEDs, MQ-3 gas sensor and servo using USB2 port

Results Summary

  1. GPIO (3.3V)
  2. unloaded: 3.320V
  3. 4mA green LED: 3.168V (95.4%) 3.2mA
  4. Sequin LED: 3.064V (92.3%) 5.8mA
  5. 10mA LED: 3.015V (90.8%) 6.8mA
  6. 20mA LED**: 2.789V (84.0%) 11.5mA
  7. 3V pin
  8. unloaded: 3.320V
  9. Sequin LED: 3.319V 7.7mA
  10. 10mA LED 3.319 8.9mA
  11. 20mA LED: 3.319 18.9mA
  12. USB pin
  13. unloaded: 5.048V
  14. Sequin LED: 5.036V 22.6mA
  15. 10mA LED: 5.043V 9.6mA
  16. 20mA LED: 5.038V 19.7mA
  17. Laser module. 5.033V (99.7%) 30.4mA
  18. MQ-3 module: 4.980V (98.7%) 139.4mA
  19. RGB pixel ring: 0: 5.042V 11.1mA, 1: 5.026V 45.5mA, 3: 4.995V 111.5mA, 12: 4.853V (96.1%) 407.7mA
  20. servo: 4.97-5.01V

** current is too high for GPIO.

CircuitPython 9.1.1, adafruit_motor 3.4.13 , neopixel 6.3.11, peripheral-power-tester 1.2.

Adafruit Feather NRF52840 Express Powered by LiPo Battery

Adafruit Feather nRF52840 Express powering test with LEDs, MQ-3 gas sensor and servo using LiPo

The laser module is described as 5V but has no more detail on permissible voltage range. At 4V there is laser speckle indicating lasing. Batteries clearly present challenges for peripherals designed to work with a narrow voltage range, especially one above the (maximum) battery voltage.

Results Summary

  1. GPIO (3.3V)
  2. unloaded: 3.320V
  3. 4mA green LED: 3.168V (95.4%) 3.3mA
  4. Sequin LED: 3.062V (92.2%) 6.0mA
  5. 10mA LED: 3.014V (90.8%) 7.1mA
  6. 20mA LED**: 2.788V (84.0%) 11.5mA
  7. 3V pin
  8. unloaded: 3.320V
  9. Sequin LED: 3.320V 8.1mA
  10. 10mA LED: 3.320V 9.1mA
  11. 20mA LED: 3.319V 19.1mA
  12. BAT pin
  13. Unloaded: 4.077V
  14. Sequin LED: 4.075V 14.2mA
  15. 10mA LED: 4.077V 6.8mA
  16. 20mA LED: 4.076V 13.6mA
  17. Laser module***. 4.073V 21.0mA
  18. MQ-3 module***: 4.045V (99.2%) 112.8mA
  19. RGB pixel ring: 0: 4.074V 7.6mA, 1: 4.064V 42.1mA , 3: 4.049V 108.1mA, 12: 3.964V (97.2%) 404.7mA
  20. servo****: 4.03-4.05V

** current is too high for GPIO.

*** voltage too low for peripheral

**** voltage might be too low for peripheral

CircuitPython 9.1.1, adafruit_motor 3.4.13 , neopixel 6.3.11, peripheral-power-tester 1.2.

Cytron Maker Nano RP2040 Powered by Laptop USB2 Port

Cytron Maker Nano RP2040 powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

Results Summary

  1. GPIO (3.3V)
  2. unloaded: 3.308V
  3. 4mA green LED: 3.224V (97.5%) 3.5mA
  4. Sequin LED: 3.156V (95.4%) 6.5mA
  5. 10mA LED: 3.131V (94.6%) 8..2mA
  6. 20mA LED**: 2.977V (90.0%) 14.2mA
  7. 3V3 pin
  8. unloaded: 3.308V
  9. Sequin LED: 3.307V 7.8mA
  10. 10mA LED: 3.307V 9.3mA
  11. 20mA LED: 3.306V 18.8mA
  12. 5V pin
  13. unloaded: 4.716V
  14. Sequin LED: 4.688V 19.7mA
  15. 10mA LED: 4.700V 9.0mA
  16. 20mA LED: 4.690V 17.6mA
  17. Laser module***. 4.682V (99.3%) 27.0mA
  18. MQ-3*** module: 4.597V (97.5%) 128.9mA
  19. RGB pixel ring: 0: 4.703V 9.9mA , 1: 4.679V 44.3mA, 3: 4.611V 110.5mA, 12: 4.412V (93.6%) 406.3mA
  20. servo: 4.59-4.70V

** current is too high for GPIO.

*** voltage too low for peripheral

CircuitPython 9.1.1, adafruit_motor 3.4.13, peripheral-power-tester 1.2.

Arduino UNO R3 Powered by Laptop USB2 Port

Arduino UNO R3 powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

Results Summary

  1. GPIO (5V)
  2. unloaded: 4.988V
  3. 4mA green LED: 4.876V (97.7%) 3.8mA
  4. Sequin LED: 4.491V (90.0%) 19.3mA
  5. 10mA LED: 4.749V (95.2%) 8.6mA
  6. 20mA LED: 4.528V (90.8%) 17.7mA
  7. 3V3 pin
  8. unloaded: 3.300Veee
  9. Sequin LED: 3.296V 7.6mA
  10. 10mA LED: 3.296V 10.1mA
  11. 20mA LED: 3.292V 20.0mA
  12. 5V pin
  13. unloaded: 4.996V
  14. Sequin LED: 4.973V 22.0mA
  15. 10mA LED: 4.986V 10.9mA
  16. 20mA LED: 4.974V 19.4mA
  17. Laser module. 4.962V (99.3%) 31.2mA
  18. MQ-3 module: 4.841V (96.9%) 136.7mA
  19. RGB pixel ring: 0: 4.983V 11.0mA., 1: 4.945V 46.5mA, 3: 4.896V 112.2mA, 12: 4.508V (90.2%) 406.2mA
  20. servo: 4.85-4.92V


Arduino IDE 2.3.2, Adafruit NeoPixel 1.12.3, Servo 1.2.2, peripheral-power-tester 1.2.

Arduino UNO R3 Powered by PSU Using 2.1mm Barrel Connector

Arduino UNO R3 powering test with LEDs, MQ-3 gas sensor and servo using 7.5V on 2.1mm jack

The Arduino UNO R3 is powered by a variable voltage "wall-wart" style PSU set to 7.5V. There's a very noticeable improvement for the 5V pin at high currents compared to powering with USB.

Results Summary

  1. GPIO (5V)
  2. unloaded: 4.977V
  3. 4mA green LED: 4.871V (97.9%) 4.0mA
  4. Sequin LED: 4.503V (90.5%) 18.0mA
  5. 10mA LED: 4.749V (95.4%) 9.2mA
  6. 20mA LED: 4.539V (91.2%) 17.8mA
  7. 3V3 pin
  8. unloaded: 3.302V
  9. Sequin LED: 3.296V 7.6mA
  10. 10mA LED: 3.296V10.1mA
  11. 20mA LED: 3.262V 20.2mA
  12. 5V pin
  13. unloaded: 4.988V
  14. Sequin LED: 4.988V 22.2mA
  15. 10mA LED: 4.988V 10.9mA
  16. 20mA LED: 4.988V 20.0mA
  17. Laser module. 4.988V 30.0mA
  18. MQ-3 module: 4.986V 140.9mA
  19. RGB pixel ring: 0: 4.993V 11.0mA, 1: 4.989V 46.5mA, 3: 4.988V 112.3mA, 12: 4.982V 408.0mA
  20. servo: 4.98-4.99V


Arduino IDE 2.3.2, Adafruit NeoPixel 1.12.3, Servo 1.2.2, peripheral-power-tester 1.2.

Arduino UNO R4 WiFi Powered by Laptop USB2 Port

Arduino UNO R4 WiFi powering test with LEDs, MQ-3 gas sensor and servo using laptop USB2 port

The Arduino UNO R4 WiFi is shown here to be very different to the UNO R3 on USB power. The microcontroller, its GPIO and 5V pin are all running at a lower voltage which must be due to the voltage drop from a protection diode. This could cause some compatibility issues or confusion when

  1. switching from an UNO R3 to an UNO R4 WiFi or
  2. developing and initial testing on a USB-powered UNO R4 WiFi and then switching to barrel connector power.

There's also a large difference in GPIO current limits, the Arduino UNO R4 WiFi recommendation is 8mA per pin compared to the R3's 20mA per pin.

Results Summary

  1. GPIO (5V):
  2. unloaded: 4.626V
  3. 4mA green LED: 4.474V (96.7%) 3.4mA
  4. Sequin LED**: 4.005V (86.6%) 15.2mA
  5. 10mA LED**: 4.306V (93.1%) 9.3mA
  6. 20mA LED**: 4.025V (87.0%) 14.9mA
  7. 3V3 pin
  8. unloaded: 3.309V
  9. Sequin LED: 3.309V 9.7mA
  10. 10mA LED: 3.309V 10.9mA
  11. 20mA LED: 3.309V 18.2mA
  12. 5V pin
  13. unloaded: 4.626V
  14. Sequin LED: 4.610V 20.5mA
  15. 10mA LED: 4.620V 10.1mA
  16. 20mA LED: 4.612V 18.9ma
  17. Laser module***: 4.603V 27.1mA
  18. MQ-3 module***: 4.518V (97.7%) 125.9mA
  19. RGB pixel ring: 0: 4.917V 9.7mA, 1: 4.587V 46.1mA, 3: 4.530V 111.0mA, 12: 4.296V (92.9%) 405.7mA
  20. servo: 4.53-4.59V

** current is too high for GPIO.

*** voltage too low for peripheral

Arduino IDE 2.3.2, Adafruit NeoPixel 1.12.3, Servo 1.2.2, peripheral-power-tester 1.2.

Arduino UNO R4 WiFi Powered by PSU Using 2.1mm Barrel Connector

Arduino UNO R4 WiFi powering test with LEDs, MQ-3 gas sensor and servo using 7.5V on 2.1mm jack

Results Summary

  1. GPIO (5V)
  2. unloaded: 4.994V
  3. 4mA green LED: 4.832V (96.8%) 3.8mA
  4. Sequin LED**: 4.302V (86.1%) 18.5mA
  5. 10mA LED**: 4.650V (93.1%) 10.0mA
  6. 20mA LED**: 4.343V (87.0%) 15.2mA
  7. 3V3 pin
  8. unloaded: 3.309V
  9. Sequin LED: 3.309V 9.7mA
  10. 10mA LED: 3.309V 11.0mA
  11. 20mA LED: 3.309V 18.8mA
  12. 5V pin
  13. unloaded: 4.994V
  14. Sequin LED: 4.994V 24.3mA
  15. 10mA LED: 4.994 11.9mA
  16. 20mA LED: 4.994V 19.6mA
  17. Laser module: 4.994V 32.2mA
  18. MQ-3 module: 4.980V (99.7%) 139.1mA
  19. RGB pixel ring: 0: 4.994V 10.9mA, 1: 4.994V 46.9mA, 3: 4.980V 113.2mA, 12: 4.973V (99.6%) 407.0mA
  20. servo: 4.98-4.99V

** current is too high for GPIO.

Arduino IDE 2.3.2, Adafruit NeoPixel 1.12.3, Servo 1.2.2, peripheral-power-tester 1.2.

Arduino UNO R4 WiFi Powered by Raspberry Pi USB-C PSU

Arduino UNO R4 WiFi powering test with LEDs, MQ-3 gas sensor and servo using Rasp. Pi 15W USB-C PSU

The high voltage of the 5.1V Raspberry Pi power supply helps to counteract the diode drop on the UNO R4 WiFi board.

Results Summary

  1. GPIO (5V)
  2. unloaded: 4.912V
  3. 4mA green LED: 4.752V (96.7%) 3.7mA
  4. Sequin LED**: 4.235V (86.2%) 17.5mA
  5. 10mA LED**: 4.572V (93.1%) 10.1mA
  6. 20mA LED**: 4.274V (87.0%) 14.8mA
  7. 3V3 pin
  8. unloaded: 3.309V
  9. Sequin LED: 3.309V 9.9mA
  10. 10mA LED: 3.309V 11.0mA
  11. 20mA LED: 3.309V 18.8mA
  12. 5V pin
  13. unloaded: 4.912
  14. Sequin LED: 4.903V 23.7mA
  15. 10mA LED: 4.909V 11.2mA
  16. 20mA LED: 4.905V 18.8mA
  17. Laser module. 4.900V 31.0mA
  18. MQ-3 module***: 4.862V (99.0%) 137.6mA
  19. RGB pixel ring: 0: 4.908V 10.7mA, 1: 4.894V 47.2mA, 3: 4.870V 112.2mA, 12: 4.784V (97.4%) 407.6mA
  20. servo: 4.87-4.90V

** current is too high for GPIO.

*** voltage is slightly too low for peripheral

Arduino IDE 2.3.2, Adafruit NeoPixel 1.12.3, Servo 1.2.2, peripheral-power-tester 1.2.

Burden Voltages and Shunt Resistors

fcs-meters-shuntresistor-burdenvoltage.png

The current mode on a multimeter is typically implemented as a voltage measurement across an internal resistor. An example of a circuit being measured is shown above with a 5 volt power supply, a 35.5 ohm purely-resistive load - this will be similar to the heater on an MQ sensor.

  1. The meter on the left shows the voltage from the power supply.
  2. The meter on the right shows the voltage across the load.
  3. The meter at the bottom is measuring the voltage across a 0.1 ohm internal resistor - the current is calculated with I = V / R, here it's 14.045mV / 0.1 ohms = 140.45mA.

The third voltage is known as the burden voltage. The value of this internal resistor varies by meter model and can vary for different current ranges, i.e. microamp measurements will have a higher resistance. A low burden voltage causes minimal disruption to the circuit producing measurements closer to the circuit without the inline ammeter.

For simple resistive circuits like this one the current draw without the meter can be easily calculated: 5V / (5V / 0.14045A - 0.1 ohms) = .14085A = 140.85mA. The measured value is reasonably accurate without correction, the measured value is only 0.28% lower.

The stripboard includes four precision 1 ohm resistors in parallel to make a 0.25 ohm shunt resistor. This is used to show the current on the Zoyi ZT703-S oscilloscope mode. At 40mV per division, a division will equate to approximately 40/0.25=160mA. The display has eight divisions vertically giving a maximum range of 1.28A.

Voltage Drop for USB Power and Cables

Testing voltage drop from USB port and leads to the 5V pin on a Cytron Maker Nano RP2040

This is a different set of tests checking the voltage from the 5V pin on the Cytron Maker Nano RP2040 as the current increases from turning on flexible "filament" LEDs. The voltage can drop due to resistance in the cable, a poor power supply or intentional current limiting.

This uses the circuit from Instructables: Constant Current Circuit for Flexible Filament LEDs Using Cytron Maker Nano RP2040 With PWM Brightness Control to supply 84mA to five filament LEDs with the sixth spare one going through the AstroAI multimeter. The current will be about 30mA for the microcontroller plus 6*84mA for peak LED current, totalling to 534mA. This could be too much for some USB ports.

The 5V pin voltage can be seen as the average value on the Zoyi ZT-703S oscilloscope. It's far more accurate to measure this in multimeter mode but the oscilloscope was also being used to look at any power supply noise/glitches.

A summary of the voltage decrease on the 5V pin from the video is shown below together with the voltage drop at the USB power source.

  1. Power Bank
  2. Lead 1: USB 5.05V to 4.92V, 5V pin 4.7V to 4.3V
  3. Lead 2: USB 5.05V to 4.82V, 5V pin: 4.7V to 4.1V
  4. Lead 3: USB: 5.05V to 4.88V, 5V pin: 4.7V to 4.1V
  5. Laptop (USB2)
  6. Lead 1: USB: 5.01V to 4.82V, 5V pin: 4.7V to 4.2V
  7. Lead 2: USB: 5.00V to 4.69V, 5V pin: 4.6V to 4.0V
  8. Lead 3: USB: 5.01V to 4.78V, 5V pin: 4.7V to 4.0V

Lead 1 is a rarely-used 20cm (8") multi-charger cable. Leads 2 and 3 are 1m (40") leads which came with good quality products. Lead 3 is twelve years old and has been used a lot, its electrical contacts may not be as good as they once were.

There's a schottky diode between the USB power and the 5V pin on this microcontroller board which explains the ~0.3V drop. There will also be a small voltage drop across the Keweisi USB power meter. This meter has a 0.05 ohm shunt resistor, at 500mA this has a burden voltage of 25mV which has minimal effect on the current and voltage for USB.

The laptop's fan was pointing towards the circuit and the hot air from this has unfortunately caused a slight current drop from 83.8mA to 82.9mA by heating certain transistors on the stripboard. This type of constant current circuit does vary a little with ambient temperature.

Servo Current in Detail - Synchronisation and Decoupling Capacitors

Examining current vs control pulses for a servo and effect of capacitors using an Arduino UNO R3

The video above shows a closer look at the servo current on the oscilloscope with the oscilloscope lifting two small reels of solder and an observer. The current is still shown in yellow with each division equating to approximately 160mA, half display height being 640mA, full height being 1.28A. The cyan trace above it is the pulse-width modulated control pulse. These type of servos are driven with a 50Hz PWM signal which will pulse every 20ms. The oscilloscope is triggering on the fall of the control pulse to highlight any synchronisation between the control pulse and the servo's motor activity.

There are four tests (humble T7 component tester values for capacitance, charge leakage (expressed as "Vloss") and ESR shown in brackets):

  1. No capacitor with a few time bases: 1ms, 2ms, 5ms and back to 2ms.
  2. 100uF capacitor (100.6uF 0.9% 110milliohms).
  3. 470uF (443.8uF 1.8% 240m).
  4. 1000uF (1056uF 1.2% 140m).

The capacitors can be seen to smooth the top of the current pulse for the motor movement and to reduce the initial current draw for the servo. The net current over time is still the same with the current being, in effect, displaced to after the pulse to recharge the capacitor. A capacitor value could be chosen by using the selected power supply and looking closely at the voltage drop at the start of the servo movement and deciding on what magnitude and duration of drop is permissible.

This test suggests there's value in staggering PWM for multiple servos to spread the current from the motor movement. In traditional radio-controlled model aircraft this happened due to the sequential nature of the transmitted position updates for each servo.

Servo Current in Detail - Voltage Drop With Different Power Supplies

Examining voltage drop for a micro servo powered by an Arduino UNO R3 using USB and 2.1mm jack

This video is the same setup as the previous page with the servo lifting two small reels of solder and an observer. The current is still shown in yellow with each division equating to approximately 160mA, half display height (four divisions) being 640mA. The origin is no longer the bottom line, it has moved up one division to clear the statistics. The cyan trace above it is the voltage shown in AC mode at 100mV per division.

There are four tests using combinations of:

  1. laptop USB2 port over long cable;
  2. PSU set to 7.5V over 2.1mm barrel connector.

And:

  1. no capacitor;
  2. 470uF electrolytic capacitor.

The capacitor can again be seen to smooth the top of the current pulse for the motor movement and to reduce the initial current draw slightly for the servo. The voltage drop is a mirror image of the servo current and far more substantial when using the USB2 port which is probably starting to limit the >500mA consumption. The PSU is noticeably more noisy and the spikes around abrupt changes in load suggest its switch-mode power supply perhaps isn't the best.

The RC Airplane RX Voltage DROP! YouTube video is an interesting exploration of the voltage drop due to multiple loaded servos (from an RC model aircraft) using a dedicated NiMH battery pack as a power supply.

Going Further

microcontroller-power-title2.jpg

Some ideas to explore:

  1. Test your favourite microcontrollers and peripherals taking care with any current limitations.
  2. Low-voltage relays would be interesting due to their (inductive) coils.
  3. Piezo speakers and coil-based tiny speakers might vary based on the audio frequency. If driven directly by a simple transistor circuit these could be accidentally left on resulting in a high DC current for a coil-based device.
  4. The brand new RP2350-based Pi Pico 2 is worth comparing with the Pi Pico.
  5. Design and construct a safer circuit/board for testing a standard set of peripherals.
  6. Use a power profiler for a detailed look at the power. The Nordic Power Profiler Kit II could be used for this with an adapter for USB. Its 5V maximum supply voltage would prevent it being used for the barrel connector tests on the Arduino UNOs.
  7. Look at the temperature rise of the boards and the components (like voltage regulators) for some high current peripherals.
  8. Take a closer look at servo libraries and PWM output
  9. to check if the api calls block until the end of the output pulse;
  10. to ensure they produce clean, in-spec. output pulses all the time;
  11. and the next pulse length immediately reflects the last set value.
  12. Change the testing software from delay based timing to one based on start time of the next event. This will make the changes more precise and should make all the programs have the same duration regardless of language, api behaviour and microcontroller (CPU) performance.

Further reading:

  1. ElectroBOOM: Definition of Voltage and Current (ElectroBOOM101-002)
  2. Science Buddies: How to Power an Arduino Project (Lesson #19) (YouTube) - shows how to power an UNO R3 and an UNO R4.
  3. Andreas Spiess (YouTube)
  4. #334 How to find the right Power Supply for your Project - a look at mains power for projects.
  5. #351 10 Battery Power Boards for Raspberries and ESPs. Start of “SuperPower” project
  6. EEVblog
  7. EEVblog #1009 - Voltage vs Power vs Energy
  8. EEVblog 1604 - BEWARE! Multimeter Burden Voltage (YouTube)
  9. joe smith: Looking at Burden Voltage in the uA Range (YouTube)
  10. Instructables: Cheap 1$ USB Meter Testing and Teardown
  11. Wikipedia: Comparison of single-board microcontrollers
  12. Microcontroller powering and peripherals
  13. BBC micro:bit: Connecting a power supply to the micro:bit
  14. Kitronik: Options for Powering the BBC micro:bit
  15. Arduino: Power Consumption on Arduino Boards by Karl Soderby - a look at power usage on the Arduino UNO R4 WiFi, Arduino GIGA R1 WiFi and Arduino Nano ESP32 using the Nordic Power Profiler Kit II.
  16. Arduino: Powering Alternatives for Arduino Boards - this has a very useful looking table for current per product from output pins claiming the UNO R3 can supply 1000mA from 5V and 150mA from 3.3V but the first value appears optimistic and unqualified and the second value is contradicted by documentation cited here (issue #2052).
  17. Tech Explorations: The Ultimate Guide to Powering Your Arduino Uno Board - a thorough, detailed review of the powering options for the Arduino UNO R3.
  18. Penguin Tutor: Power for the Raspberry Pi Pico - Guide to using VBUS, VSYS and 3V3 for external power circuits (YouTube)
  19. Heat and thermal testing
  20. SparkFun: Understanding Thermal Resistance
  21. Thermal testing Raspberry Pi 4 - a look at the heat generated by the Pi 4 (not Pi pico) from The MagPi magazine issue 88.
  22. Group test: Best Raspberry Pi 4 thermal cases tested and ranked from The MagPi magazine issue 90.
  23. Analog Devices: Temperature Measurement Theory and Practical Techniques (Application note AN-892) (pdf)
  24. EEVBlog: EEVblog #105 - Electronics Thermal Heatsink Design Tutorial (YouTube)
  25. Power profiling
  26. Nordic Semiconductor: Become an expert on power profiling your application (YouTube)
  27. Instructables: RGB LED Current Measurement With Nordic Power Profiler Kit II
  28. Adafruit Learn: Deep Sleep with CircuitPython
  29. Servos
  30. How To Mechatronics: How Servo Motors Work & How To Control Servos using Arduino - includes measuring the pulse width values for full range movement.
  31. Arduino Forum: Trouble with Servos on R4 Wifi - discussion about low servo update rates on UNO R4 resulting in loss of smooth movement.
  32. StackExchange: Electrical Engineering: Staggering PWM waveforms for servos to minimize current spikes
  33. Instructables: Servo Ramping and Soft-Start - a very thorough look at how to change a servos position in a real application and the difficulty of implementing a "soft start".
  34. Gough Lui: USB Cable Resistance: Why your phone/tablet might be charging slow
  35. GPIO current drive modes
  36. GitHub: adafruit/circuitpython nrf pin drive strength #1270
  37. GitHub: microbit-foundation/micropython-microbit-v2 High drive current mode setting for GPIO on nRF52833 #216
  38. Lalo Solo: Decoupling Capacitors - And why they are important (YouTube)
  39. Battery power
  40. The voltage over time (for a constant current load) can be seen in the plots below.
  41. CR2032 coin cells and Lithium ion (LiPo): Instructables: Battery Capacity Measurement Using Kitronik Inventor's Kit and Adafruit CLUE.
  42. Zinc-carbon, Alkaline and NiMH rechargeable batteries: Instructables: NiMH Rechargeable Battery Comparison Using Kitronik Inventor's Kit and Adafruit CLUE.
  43. Adafruit
  44. Collin's Lab: History of the Battery (YouTube)
  45. Collin's Lab: Battery Basics (YouTube)
  46. Collin's Lab: Powerful Battery Usage with Ladyada (YouTube)