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
867 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
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
- Lots of microcontrollers boards. The following microcontroller boards were tested, the first two are 5V microcontrollers with 5V GPIO, the rest are 3.3V.
- Arduino UNO Revision 3 - a very popular board.
- Arduino UNO Revision 4 WiFi - looks like an UNO R3 with extras but has many differences for power.
- Raspberry Pi Pico W - a great value small board with a buck-boost DC-DC converter.
- BBC Micro:bit V1 - a well-established board in the education arena.
- BBC Micro:bit V2 - the second revision of the board, nRF51 series microcontroller replaced with nF52 series, many power differences.
- Adafruit Feather nRF52840 Express - one from the Adafruit Feather series, convenient for LiPo battery power features.
- Cytron Maker Nano RP2040 - a board following the Arduino Nano layout with a 3.3V microcontroller.
- Some interesting peripherals. The following devices were tested.
- 5mm unbranded green LED with a 330/680 ohm resistor for current use at ~4mA at 3.3V/5.0V.
- Adafruit LED Sequin - surface-mount LEDs with a series resistor intended for wearables and GPIO powering.
- dLUX-dLITE Succulent Golden Yellow LED with a 2x68/300 ohm resistor for 3.3V/5.0V aiming for 10mA.
- 5mm unbranded orange LED with a 68/150 ohm resistor for 3.3V/5.0V aiming for 20mA.
- Unbranded 5V Red Laser Dot Diode Module (KY-008) - specified as 30mA.
- Unbranded MQ-3 gas sensor module. The sensor's internal heater consumes the vast majority of the power.
- Kitronik FS90 Micro Servo - a small servo used in the Kitronik Linear Actuator, intended for 4.8V-6V power.
- Unbranded RGB pixel ring - 12 5x5mm WS2812 protocol RGB LEDs, similar to Adafruit's NeoPixels.
- 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.
- The voltage was measured using an AstroAI DM6000A R multimeter.
- The current using a Zoyi ZT-703S oscilloscope multimeter in 10A mode.
- 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.
- 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.
- The devices were soldered to a piece of stripboard or inserted into sockets on the stripboard to provide reliable connectivity.
- 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.
- Some relevant/appropriate power sources. The following were used in an attempt to pick some commonly used/available power sources.
- An old, study laptop with USB2 ports. The same port was used for all tests.
- 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.
- A 1000 mAh Lithium Ion Polymer (LiPo) battery from Kitronik. This was unused since being fully charged about six months ago.
- A Raspberry Pi 15W USB-C Power Supply. This is specified as 5.1V and 3.0A.
Adafruit LED Sequins
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:
- at 3.3V (3.3-2.6)/100 = 7mA flows;
- 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
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)
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
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
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
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
The testing setup can be seen above as a diagram and photograph of the setup on a desk.
- 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.
- 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.
- Peripheral: the RGB pixel ring, bottom right in the photograph. This is sometimes referred to as a device under test (DUT) in this scenario).
- Power Source: The Arduino UNO R3's 5V pin.
- Resistor: The stripboard has four 1 ohm precision resistors in parallel.
- 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
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.
- 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.
- Labels and some colour coding for the sockets/pins would make things clearer.
- A socket left unconnected would be useful for holding the cable to get an unloaded measurement.
- Some high value resistors (1M, 100k, 10k) might be interesting for showing more detail on the GPIO voltage drop.
- A good quality multi-throw switch could be used to switch between peripherals.
- A good quality external ADC (like a TI ADS1115) could provide accurate voltage measurements logged with a separate microcontroller.
Testing Software
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
Version 1.2
This uses three GPIO pins in the following way.
- Permanently high - for use as a GPIO current source.
- RGB (WS2812) pixels - incrementally turned on at full white brightness with one every two** seconds.
- 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
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
- GPIO (3.3V)
- Unloaded: 3.338V
- 4mA green LED: 3.251V (97.4%) 3.6mA
- Sequin LED: 3.180V (95.3%) 7.2mA
- 10mA LED: 3.154V (94.5%) 7.6mA
- 20mA LED**: 2.995V (89.7%) 14.9mA
- 3V3(OUT) pin
- Unloaded: 3.338V
- Sequin LED: 3.338V 8.1mA
- 10mA LED: 3.338V 9.2mA
- 20mA LED: 3.339V 19.8mA
- VBUS pin
- Unloaded: 5.033V
- Sequin LED: 5.025V (99.8%) 23.1mA
- 10mA LED: 5.030V (99.9%) 9.5mA
- 20mA LED: 5.026V (99.9%) 20.3mA
- Laser module. 5.021V (99.8%) 30.4mA
- MQ-3 module: 4.967V (98.7%) 143.1mA
- 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
- 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
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
- GPIO (3.3V)
- unloaded: 3.194V
- 4mA green LED: 2.948V (92.3%) 2.6mA
- Sequin LED: 2.839V (88.9%) 4.4mA
- 10mA LED: 2.746 (86.0%) 5.0mA
- 20mA LED**: 2.506 (78.5%) 8.0mA
- 3V pad
- unloaded: 3.197V
- Sequin LED: 3.141V (98.2%) 6.6mA
- 10mA LED: 3.138V (98.2%) 8.0mA
- 20mA LED: 3.119V (97.6%) 16.0mA
- Laser*** module: 3.128V (97.8%) 11.8mA
- MQ-3*** module: 3.054V (95.5%) 84.0mA
- RGB pixel ring: 0: 3.147V 5.3mA, 1: 3.098V 30.7mA , 3: 3.060V (95.7%) 75.6mA
- 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
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
- GPIO (3.3V)
- unloaded: 3.268V
- 4mA green LED: 2.830V (86.6%) 2.3mA
- Sequin LED: 2.702V (82.7%) 3.3mA
- 10mA LED: 2.543V (77.8%) 3.8mA
- 20mA LED**: 2.275V (69.6%) 5.0mA
- 3V pad
- unloaded: 3.298V
- Sequin LED: 3.298V 7.9mA
- 10mA LED: 3.297V 9.0mA
- 20mA LED: 3.295V 18.9mA
- Laser*** module: 3.297V 13.0mA
- MQ-3*** module: 3.283V (99.5%) 91.1mA
- 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
- 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
Results Summary
- GPIO (3.3V)
- unloaded: 3.320V
- 4mA green LED: 3.168V (95.4%) 3.2mA
- Sequin LED: 3.064V (92.3%) 5.8mA
- 10mA LED: 3.015V (90.8%) 6.8mA
- 20mA LED**: 2.789V (84.0%) 11.5mA
- 3V pin
- unloaded: 3.320V
- Sequin LED: 3.319V 7.7mA
- 10mA LED 3.319 8.9mA
- 20mA LED: 3.319 18.9mA
- USB pin
- unloaded: 5.048V
- Sequin LED: 5.036V 22.6mA
- 10mA LED: 5.043V 9.6mA
- 20mA LED: 5.038V 19.7mA
- Laser module. 5.033V (99.7%) 30.4mA
- MQ-3 module: 4.980V (98.7%) 139.4mA
- 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
- 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
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
- GPIO (3.3V)
- unloaded: 3.320V
- 4mA green LED: 3.168V (95.4%) 3.3mA
- Sequin LED: 3.062V (92.2%) 6.0mA
- 10mA LED: 3.014V (90.8%) 7.1mA
- 20mA LED**: 2.788V (84.0%) 11.5mA
- 3V pin
- unloaded: 3.320V
- Sequin LED: 3.320V 8.1mA
- 10mA LED: 3.320V 9.1mA
- 20mA LED: 3.319V 19.1mA
- BAT pin
- Unloaded: 4.077V
- Sequin LED: 4.075V 14.2mA
- 10mA LED: 4.077V 6.8mA
- 20mA LED: 4.076V 13.6mA
- Laser module***. 4.073V 21.0mA
- MQ-3 module***: 4.045V (99.2%) 112.8mA
- 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
- 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
Results Summary
- GPIO (3.3V)
- unloaded: 3.308V
- 4mA green LED: 3.224V (97.5%) 3.5mA
- Sequin LED: 3.156V (95.4%) 6.5mA
- 10mA LED: 3.131V (94.6%) 8..2mA
- 20mA LED**: 2.977V (90.0%) 14.2mA
- 3V3 pin
- unloaded: 3.308V
- Sequin LED: 3.307V 7.8mA
- 10mA LED: 3.307V 9.3mA
- 20mA LED: 3.306V 18.8mA
- 5V pin
- unloaded: 4.716V
- Sequin LED: 4.688V 19.7mA
- 10mA LED: 4.700V 9.0mA
- 20mA LED: 4.690V 17.6mA
- Laser module***. 4.682V (99.3%) 27.0mA
- MQ-3*** module: 4.597V (97.5%) 128.9mA
- 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
- 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
Results Summary
- GPIO (5V)
- unloaded: 4.988V
- 4mA green LED: 4.876V (97.7%) 3.8mA
- Sequin LED: 4.491V (90.0%) 19.3mA
- 10mA LED: 4.749V (95.2%) 8.6mA
- 20mA LED: 4.528V (90.8%) 17.7mA
- 3V3 pin
- unloaded: 3.300Veee
- Sequin LED: 3.296V 7.6mA
- 10mA LED: 3.296V 10.1mA
- 20mA LED: 3.292V 20.0mA
- 5V pin
- unloaded: 4.996V
- Sequin LED: 4.973V 22.0mA
- 10mA LED: 4.986V 10.9mA
- 20mA LED: 4.974V 19.4mA
- Laser module. 4.962V (99.3%) 31.2mA
- MQ-3 module: 4.841V (96.9%) 136.7mA
- 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
- 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
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
- GPIO (5V)
- unloaded: 4.977V
- 4mA green LED: 4.871V (97.9%) 4.0mA
- Sequin LED: 4.503V (90.5%) 18.0mA
- 10mA LED: 4.749V (95.4%) 9.2mA
- 20mA LED: 4.539V (91.2%) 17.8mA
- 3V3 pin
- unloaded: 3.302V
- Sequin LED: 3.296V 7.6mA
- 10mA LED: 3.296V10.1mA
- 20mA LED: 3.262V 20.2mA
- 5V pin
- unloaded: 4.988V
- Sequin LED: 4.988V 22.2mA
- 10mA LED: 4.988V 10.9mA
- 20mA LED: 4.988V 20.0mA
- Laser module. 4.988V 30.0mA
- MQ-3 module: 4.986V 140.9mA
- RGB pixel ring: 0: 4.993V 11.0mA, 1: 4.989V 46.5mA, 3: 4.988V 112.3mA, 12: 4.982V 408.0mA
- 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
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
- switching from an UNO R3 to an UNO R4 WiFi or
- 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
- GPIO (5V):
- unloaded: 4.626V
- 4mA green LED: 4.474V (96.7%) 3.4mA
- Sequin LED**: 4.005V (86.6%) 15.2mA
- 10mA LED**: 4.306V (93.1%) 9.3mA
- 20mA LED**: 4.025V (87.0%) 14.9mA
- 3V3 pin
- unloaded: 3.309V
- Sequin LED: 3.309V 9.7mA
- 10mA LED: 3.309V 10.9mA
- 20mA LED: 3.309V 18.2mA
- 5V pin
- unloaded: 4.626V
- Sequin LED: 4.610V 20.5mA
- 10mA LED: 4.620V 10.1mA
- 20mA LED: 4.612V 18.9ma
- Laser module***: 4.603V 27.1mA
- MQ-3 module***: 4.518V (97.7%) 125.9mA
- 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
- 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
Results Summary
- GPIO (5V)
- unloaded: 4.994V
- 4mA green LED: 4.832V (96.8%) 3.8mA
- Sequin LED**: 4.302V (86.1%) 18.5mA
- 10mA LED**: 4.650V (93.1%) 10.0mA
- 20mA LED**: 4.343V (87.0%) 15.2mA
- 3V3 pin
- unloaded: 3.309V
- Sequin LED: 3.309V 9.7mA
- 10mA LED: 3.309V 11.0mA
- 20mA LED: 3.309V 18.8mA
- 5V pin
- unloaded: 4.994V
- Sequin LED: 4.994V 24.3mA
- 10mA LED: 4.994 11.9mA
- 20mA LED: 4.994V 19.6mA
- Laser module: 4.994V 32.2mA
- MQ-3 module: 4.980V (99.7%) 139.1mA
- 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
- 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
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
- GPIO (5V)
- unloaded: 4.912V
- 4mA green LED: 4.752V (96.7%) 3.7mA
- Sequin LED**: 4.235V (86.2%) 17.5mA
- 10mA LED**: 4.572V (93.1%) 10.1mA
- 20mA LED**: 4.274V (87.0%) 14.8mA
- 3V3 pin
- unloaded: 3.309V
- Sequin LED: 3.309V 9.9mA
- 10mA LED: 3.309V 11.0mA
- 20mA LED: 3.309V 18.8mA
- 5V pin
- unloaded: 4.912
- Sequin LED: 4.903V 23.7mA
- 10mA LED: 4.909V 11.2mA
- 20mA LED: 4.905V 18.8mA
- Laser module. 4.900V 31.0mA
- MQ-3 module***: 4.862V (99.0%) 137.6mA
- 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
- 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
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.
- The meter on the left shows the voltage from the power supply.
- The meter on the right shows the voltage across the load.
- 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
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.
- Power Bank
- Lead 1: USB 5.05V to 4.92V, 5V pin 4.7V to 4.3V
- Lead 2: USB 5.05V to 4.82V, 5V pin: 4.7V to 4.1V
- Lead 3: USB: 5.05V to 4.88V, 5V pin: 4.7V to 4.1V
- Laptop (USB2)
- Lead 1: USB: 5.01V to 4.82V, 5V pin: 4.7V to 4.2V
- Lead 2: USB: 5.00V to 4.69V, 5V pin: 4.6V to 4.0V
- 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
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):
- No capacitor with a few time bases: 1ms, 2ms, 5ms and back to 2ms.
- 100uF capacitor (100.6uF 0.9% 110milliohms).
- 470uF (443.8uF 1.8% 240m).
- 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
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:
- laptop USB2 port over long cable;
- PSU set to 7.5V over 2.1mm barrel connector.
And:
- no capacitor;
- 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
Some ideas to explore:
- Test your favourite microcontrollers and peripherals taking care with any current limitations.
- Low-voltage relays would be interesting due to their (inductive) coils.
- 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.
- The brand new RP2350-based Pi Pico 2 is worth comparing with the Pi Pico.
- Design and construct a safer circuit/board for testing a standard set of peripherals.
- 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.
- Look at the temperature rise of the boards and the components (like voltage regulators) for some high current peripherals.
- Take a closer look at servo libraries and PWM output
- to check if the api calls block until the end of the output pulse;
- to ensure they produce clean, in-spec. output pulses all the time;
- and the next pulse length immediately reflects the last set value.
- 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:
- ElectroBOOM: Definition of Voltage and Current (ElectroBOOM101-002)
- Science Buddies: How to Power an Arduino Project (Lesson #19) (YouTube) - shows how to power an UNO R3 and an UNO R4.
- Andreas Spiess (YouTube)
- #334 How to find the right Power Supply for your Project - a look at mains power for projects.
- #351 10 Battery Power Boards for Raspberries and ESPs. Start of “SuperPower” project
- EEVblog
- EEVblog #1009 - Voltage vs Power vs Energy
- EEVblog 1604 - BEWARE! Multimeter Burden Voltage (YouTube)
- joe smith: Looking at Burden Voltage in the uA Range (YouTube)
- Instructables: Cheap 1$ USB Meter Testing and Teardown
- Wikipedia: Comparison of single-board microcontrollers
- Microcontroller powering and peripherals
- BBC micro:bit: Connecting a power supply to the micro:bit
- Kitronik: Options for Powering the BBC micro:bit
- 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.
- 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).
- Tech Explorations: The Ultimate Guide to Powering Your Arduino Uno Board - a thorough, detailed review of the powering options for the Arduino UNO R3.
- Penguin Tutor: Power for the Raspberry Pi Pico - Guide to using VBUS, VSYS and 3V3 for external power circuits (YouTube)
- Heat and thermal testing
- SparkFun: Understanding Thermal Resistance
- Thermal testing Raspberry Pi 4 - a look at the heat generated by the Pi 4 (not Pi pico) from The MagPi magazine issue 88.
- Group test: Best Raspberry Pi 4 thermal cases tested and ranked from The MagPi magazine issue 90.
- Analog Devices: Temperature Measurement Theory and Practical Techniques (Application note AN-892) (pdf)
- EEVBlog: EEVblog #105 - Electronics Thermal Heatsink Design Tutorial (YouTube)
- Power profiling
- Nordic Semiconductor: Become an expert on power profiling your application (YouTube)
- Instructables: RGB LED Current Measurement With Nordic Power Profiler Kit II
- Adafruit Learn: Deep Sleep with CircuitPython
- Servos
- How To Mechatronics: How Servo Motors Work & How To Control Servos using Arduino - includes measuring the pulse width values for full range movement.
- Arduino Forum: Trouble with Servos on R4 Wifi - discussion about low servo update rates on UNO R4 resulting in loss of smooth movement.
- StackExchange: Electrical Engineering: Staggering PWM waveforms for servos to minimize current spikes
- 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".
- Gough Lui: USB Cable Resistance: Why your phone/tablet might be charging slow
- GPIO current drive modes
- GitHub: adafruit/circuitpython nrf pin drive strength #1270
- GitHub: microbit-foundation/micropython-microbit-v2 High drive current mode setting for GPIO on nRF52833 #216
- Lalo Solo: Decoupling Capacitors - And why they are important (YouTube)
- Battery power
- The voltage over time (for a constant current load) can be seen in the plots below.
- CR2032 coin cells and Lithium ion (LiPo): Instructables: Battery Capacity Measurement Using Kitronik Inventor's Kit and Adafruit CLUE.
- Zinc-carbon, Alkaline and NiMH rechargeable batteries: Instructables: NiMH Rechargeable Battery Comparison Using Kitronik Inventor's Kit and Adafruit CLUE.
- Adafruit
- Collin's Lab: History of the Battery (YouTube)
- Collin's Lab: Battery Basics (YouTube)
- Collin's Lab: Powerful Battery Usage with Ladyada (YouTube)