We’re absolutely loving your product over here. The automated range switching with serial output over USB is fantastic. We have them set up to test our low power modes in an automated environment. I really can’t overstate how much the CurrentRanger has been a welcome addition to our testing tools. – Bill G., Renesas
I love your CurrentRanger, it has quickly become one of my most important tools to measure and optimize my low power hardware. -Daniel E.
These little CR’s are truly amazing! I have access to a Fluke 5522A Multi-Calibrator and they are well within the accuracy specification you state. -Jim H
Quick email to let you know that I’m supper happy with the current ranger :).
I wanted to thank you. -Boris D.
just wanted to thank you, I LOVE my new toy (currentRanger) !!!
I was so desperate to measure very low deep sleep current, now with the Oled screen it just so incredibely easy. thanks for the good job -Frédéric B.
The CR works great. I also compared it to a high-end Keysight CX3324A (which I borrowed from a colleague) and the wave-forms look very similar – well done!
Please check the attached figure. –Review by forum user chagai
I consider my CurrentRanger an absolute bargain. With all the options plus the sickening 27% VAT imposed by EU, I ended up paying just over $200. This compact marvel will readily solve my childhood dream project challenge, the ultimate crystal radio instrumentation , a “final frontier” in Low Power. I am very happy and grateful for Felix’s fabulously improved product, and I have no problem paying for it. Actually, I would have been willing to pay even more. It is all in the eye of the beholder. Call it a toy if you must, but “He who dies with the most/best toys wins”. And I will have a blast playing with it. -DAVID999383 (youtube)
Maximum input voltage differential (see Safety): 33mV
+/-0.05% (µA, nA ranges)
+/-0.1% (mA range)
Highest resolution (nA range):
100pA (3.5digit meter)
10pA (4.5 digit meter)
1pA (5.5 digit meter)
Cascaded instrumentation amplifiers with 100x output gain
Bandwidth: >300KHz (-3dB)
Note¹: it may take a few minutes from power ON for the offset to reach its lowest value (ie. warm-up).
Architecture and principle of operation
At the heart of the CurrentRanger are two MAX4239 ultra low offset auto-zero 6Mhz unity gain bandwidth amplifiers. They are configured in a non-inverting 10x gain each using high precision resistors, totaling 100x output gain.
There are 3 high precision shunts (10mΩ, 10Ω, 10kΩ) at the input of these amplifiers yield the 3 current sensing ranges possible.
While the amplifiers, topology and shunt configuration of the CurrentRanger are similar to the µCurrent by EEVBlog, CurrentRanger is a product with significantly different features and goals.
The CurrentRanger employs switching dynamics to selectively enable/disable the shunts to allow for manual or auto-ranging.
The analog sensing is done by the SAMD21G18 ARM Cortex M0+ 48Mhz processor which samples the output through its 12bit ADC. The SAMD21 also controls all aspects of switching, digital interfacing, and power control of the unit.
A lot of development and experimentation were invested to bring this product to reality. And it could still be improved, made lower noise, enhanced with more features, etc. This is where you – the user – have an opportunity to contribute with suggestions, analog and EE expertise and coding optimizations. Thank you to all who’ve provided great feedback and contributed in some way!
It is possible to mount several different type of input/output headers, connectors, terminals and banana sockets:
5.08mm spaced thumb/screw terminals – most convenient and quick to use at input, can also be mounted at output
“GOLD” banana jack/screw terminals – mount on input/output
low profile banana jack terminals – mount on input/output
pin headers may also be soldered at various points for easy snap-on DMM probing
dedicated pin-hole output for low inductance oscilloscope probing
many other potential options
The kit comes with “Gold” terminals and/or basic low profile banana sockets. See product page for specific availability.
The “Gold” terminals mount in the smaller aperture of the terminals. A set of 3D-printed half-moon washers are provided to prevent these terminals from sliding in the mounting hole.
Avoid using pliers or any other bulky tool to hold/turn the nut onto the terminal screw, this can damage components on the board. Use a socket/ratchet instead. Avoid excessive force when mounting the terminals, the included hardware that comes with the terminals should help secure the terminals tight into position without a lot of torque.
For R1-R2 only: do not over-tighten the screws on the “Gold” banana-jack terminals, you can damage the threads!
The lower profile banana jacks will mount in the larger apertures of the output terminals (R2 shown).
The above photo also illustrates the suggested mounting configuration for the terminals, but you may mount in any other way you find useful – the “Gold” terminals mounting only applies to R1-R2 and are no longer included as an option going forward.
Be extra careful around the terminals, avoid damaging any SMD components which can permanently damage the CurrentRanger!
In R3 these components are moved back further from the terminal to avoid this.
R1-R2 only: Some of the “Gold” terminals may not flat mount on the PCB, and so it’s recommended to use the included washers to help keep them straight and make good contact.
Here is another mounting example by a user who chose not to use the 3D printed inserts, the extensions of the rectangular washers could be bent like the photo shows or cut off entirely:
OLED header soldering
The OLED header should be soldered neatly if you plan to attach the OLED. Do not solder the OLED directly to the PCB – this has several disadvantages – if it ever breaks, it will be hard to remove and you risk damaging the CurrentRanger PCB in the process. Also, running the CurrentRanger without the OLED will produce a smoother raw output signal. Here’s an example of a nice clean solder job:
3D Printed Enclosure
The CurrentRanger ships with a 3D printed enclosure (R1-R2 in PETG, R3 in PLA). See below for Fusion360 models.
To power ON the unit, simply tap the ON button once. To turn OFF the unit, press and hold the power button for ~2 seconds.
The CurrentRanger requires a standard LithiumPolymer/LithiumIon battery that charges to 4.2V. This ensures optimal operation through the full range of the battery discharge cycle (4.2V fully charged down to ~3.4V discharged).
Maximum battery dimensions to fit the case: 48x60mm (up to 10mm thick)
Charges via MCP73831 charger (454mA charge current) from USB power
the CurrentRanger will power ON when connected to USB and without a LiPo battery, but this is not a recommended use case
To minimize noise pickup, keep battery leads as short as possible
Help – the unit does not turn ON!
Double check the polarity of your battery JST connector, proper polarity is marked on the silkscreen, here’s an example of a small 500mAh battery connection (note RED positive wire going to “+” side of the connector):
Due to the low profile of the JST battery connector housing and its proximity to SMD components, exercise case when you plug/unplug the battery, to avoid damage to the components or even snapping them off the PCB.
The uUSB port is used for logging, programming and charging the internal LiPo battery. You should understand the safety and proper usage while you have USB plugged in. Also note that switching power supply noise and other harmonics can couple through the USB grounding from mains or even from a battery powered laptop which in can then make its way to the raw output, especially visible in the nA and uA ranges. Even just an open ended USB cable can act as an antenna that will induce GROUND noise into the sensitive CurrentRanger circuitry. For best accuracy and use with USB disconnected.
Typical power consumption*
OFF quiescent current: 0.6µA
18mA with LPF activated
20mA with Bias activated (Bidirectional)
21.5mA with LPF & Bias activated
OLED adds ~5mA with 25% pixels ON
HC-06 BT module adds up to extra 20mA with 40mA spikes during TX/pairing
* Note: this may vary slightly due to various LEDs and other resistors being changed from batch to batch.
This topic is already covered on the Battery & Charging page. But make sure you connect a LithiumPolymer battery with the correct polarity (as marked on the PCB) or you can damage the battery charger (MCP73831). R3 includes reverse polarity protection, so if you have the battery wired in reverse, nothing happens, the unit just won’t turn on.
It’s also important to understand the USB connection is not isolated. If you leave the USB connected to a computer that is earth ground connected, and you also power your DUT from an earth ground referenced supply, that will permanently damage your CurrentRanger. If you want to use USB serial/connection for high speed logging/debugging or other purposes, you must use an external USB isolator such as this one on Aliexpress:
Avoid ground loops
This is a high-side current meter (ammeter). This means that power from your source must be applied at the input [+] terminal, and your DUT (device under test) to be powered from the input [LOAD] terminal.
The GROUND of the CurrentRanger circuit is NOT THE SAME as the Output negative [-] terminal. Be sure you heed the warnings below and understand proper usage of the instrument or you may risk damaging it.
To avoid damage to CurrentRanger and/or an oscilloscope connected to the output, it’s important to understand that the CurrentRanger was not designed to be used with the same ground reference from input to output (ie with the same ground connected at both I/O ends). This can cause ground loops and in certain cases can damage this instrument or your oscilloscope/test equipment.
You may have only one (1) connection to earth ground attached to the CR at any given time.
This means that it’s OK:
to have a floating battery powered circuit at the input and an mains/earth connected oscilloscope at the output
mains/earth connected powered device at the input and floating DMM or mains-isolated oscilloscope at the output
USB to be plugged in from a laptop that is not connected to mains/earth ground while measuring with a mains/earth connected (ie. non-isolated) oscilloscope/DMM
USB to be plugged in to a mains/earth PC/laptop for logging purposes, and your DUT to be floating (ie. battery powered), and nothing at the output or a floating DMM/oscilloscope at the output
But it’s not OK:
to measure a DUT that is mains/earth powered/connected, with an oscilloscope/DMM that is also mains/earth connected. Depending on the range and opamp biasing mode in use, this can cause ground looping and can damage the CurrentRanger
to measure a DUT that is mains/earth powered/connected, while USB is also connected. This is passing current through the CR, from the input terminal, to the USB earth/ground, and will completely damage the CR
to use the CurrentRanger with a non-isolated (directly mains-powered) oscilloscope while the CurrentRanger is plugged to mains connected uUSB
Input protection / overloading
To minimize burden voltage, there is no input protection by default. You should never connect a low impedance voltage source to the inputs. This alone can damage the internal precision shunts and/or op-amps, the most expensive BOM parts. A maximum differential of 33mV is allowed before overloading starts to occur (vBat > 3.4V).
It’s not hard to carelessly overload the inputs of the instrument. Make sure you double check your input connections before you apply power in your DUT circuit.
Some pads and pin holes are included on the bottom of the PCB where you may solder back-to-back diodes if you can accept the leakage/error these devices may add to your measurements. Essentially any protection device will either add noise or leakage leading to higher burden voltages or less than accurate readings.
Another unique feature of the CurrentRanger is its ability to power itself off, and draw a quiescent current of only 0.6µA while powered off. This yields a shelf life limited only by the self-discharge of the LiPo battery.
The firmware has a hardcoded 10 minute inactivity timer. When this timer expires the CurrentRanger automatically powers off to. Any time any of the 3 range touch-pads are tapped, this interval resets. Auto-ranging has no effect on this timer, you must physically touch the pads to reset this interval.
The buzzer (if installed) will start beeping a warning sound 5-6 seconds before power-off occurs. You can still touch any of the 3 range pads to prevent power-off and reset the auto-off interval during this final warning.
The hardcoded power-off timer can be changed in firmware. Also, there is a PCB solder-jumper that can be cut open to permanently disable this feature.
There is a hardware ~7kHz RC based Low Pass Filter at the output that can be enabled (or toggled) by tapping the nA & µA touch-pads simultaneously. This will cut down noise dramatically and will produce a clean smooth trace on the oscilloscope.
The output smoothness of the LPF comes at the cost of reduced bandwidth. Even so this is very usable even with fast MCU/transceiver sleep/wake/transmission transients without significant detail reduction.
You may change the RC values (0603 resistors) and make the LPF even more aggressive (lower cutoff point). This will reduce AC bandwidth even more but could be helpful in reducing noise even more for scope probing DC measurements. Many online calculator such as this one can be used to change the values of the filter.
Here is a sample of LPF in action, showing the original capture and the LPF activated capture:
By default (power-ON) the opamps stages biasing point is at a 0 offset from the GROUND of the circuit. This will be the most useful mode of operation as it yields full unidirectional output range for DC measurements.
You can enable bidirectional mode by tapping the uA & mA touch-pads simultaneously. This effectively switches to half-supply biasing of the op-amps, and enables the output positive [+] terminal to swing both positively and negatively WRT to the [-] negative terminal. This allows measuring AC currents and shifts the output range to [+/-1.65]A. This mode is similar to the behavior of EEVBlog’s uCurrent which has a fixed bidirectional mode.
Probably 99% of use cases in the lab require DC measurements. Unless you have a specific reason to use Bias Mode, perhaps for its bidirectional AC current measurements ability, or explore how biasing affects the opamp’s noise isolation, you should use the CurrentRanger in unidirectional mode (Bias Mode OFF).
The Auto-ranging function can be enabled (or toggled) at any time by tapping the nA & mA touch-pads simultaneously. The CurrentRanger will beep, the OLED (if connected) will display an AUTO mode indicator, and it will start auto-ranging. If no load is attached it will quickly switch to the nA range.
A few things to note when enabling auto-ranging:
When auto-ranging is active, the ADC will sample the output as fast as possible to catch any range switching conditions
Bias mode and auto-ranging are mutually exclusive, Bias mode will automatically be disabled when auto-ranging is enabled
To help ensure stable switching with fast dynamic loads, the LPF is automatically enabled during auto-ranging, and disabling the LPF will also disable auto-ranging
Manual ranging is disabled while auto-ranging is enabled
The touch-pads can still be used to:
enable the LPF (nA + µA)
enable Bias mode (µA + mA), this will then disable auto-ranging
disable auto-ranging and revert to manual ranging (nA + mA)
Although the LPF is enabled, expect some extra high frequency noise at the output when auto-ranging is active. This will be more visible on an oscilloscope, not on an RMS multimeter. This is because the ADC sampling couples some noise into the output. The LPF helps minimize this noise and get smoother scope readings.
It may take up to a few milliseconds for the CurrentRanger to react and switch ranges when an overload condition is detected by the ADC. When a DUT wakes from a low power state (higher impedance) into a higher power consumption mode (lower impedance), there will be a significant voltage drop presented to the DUT until the proper range is switched to.
For some DUTs (especially if they have very low power rail capacitance) this voltage drop may be too much if it lasts more than a certain amount of time (could be on the order of microseconds) and the DUT may “power-starve” or enter into a Brown-Out condition.
However, for all tested DUTs during the development of CurrentRanger, this delay/voltage drop was not significant enough to cause such a power failure for the DUT. This is especially not a problem for purely resistive loads.
Output voltage offset and measurement sample
The no-load DMM reading in AUTORANGING mode presents a low output offset of 20uV:
Here’s an example of measuring current through a 50Ω load from a 2xAA battery. These are the observations:
DMM and scope are both connected at the output
OLED is also attached
LPF is ON resulting in a nice trace on the scope (DMM readings are unaffected by LPF in any way)
As soon as the DUT load is connected, the unit ranges from nA to mA, updates the OLED with a reading as seen below
Although the constant auto-ranging ADC sampling introduces some noise in the output trace, it can be significantly reduced with the LPF resulting in a smooth trace:
Switching dynamics artifacts
The MAX4239 opamps are very special amplifiers. However they are not perfect and you will notice the output will swing and oscillate when recovering from an overload (ie. when auto-ranging detects an overload, it switches to the next range up). To quote the datasheet (see Overload Settling, page 3):
Overload recovery time is the time required for the device to recover from saturation when the output has been driven to either rail.
This is a documented limitation of amplifiers in general, and will become evident on a scope trace when a DUT creates an overload by waking from a low power state (ex. from drawing a few uA, to drawing a few mA). Other than a potential voltage drop during switching ranges (as mentioned above), the DUT is not affected by this output settling in any way, only the actual output will ring/oscillate while the amplifiers recover from saturation, an example is shown below:
For very low MCU sleep modes, the CurrentRanger will auto-range to the nA or uA range. When your MCU or load wakes up from sleep very quickly, it’s possible it might brownout until the CurrentRanger has a chance to range up to a higher range. There are two possible approaches.
Add an external diode across the input terminals (from positive > to > negative) – this starts conducting at the diode forward voltage (~0.7V) when there is too large of a drop across the current range shunt. This way, if your MCU can handle a 0.7V drop, then it should not brownout until the proper range is switched. Be aware that the diode can have some leakage, but generally you should still get a fairly accurate reading at the output.
Modify the ADC algorithm of the CurrentRanger to take less samples and do less averaging before it decides it’s time to switch to a higher range.
It is important to understand some basic principles in order to get the most accuracy out of your CurrentRanger. Here are some basic Ohm’s Law facts:
Any piece of wire is essentially a resistor, even if on the order of mΩ, the longer the wire the larger its resistance
Any terminal is also a resistor, even if very small
Any mechanical connection between two wires, or between a wire and a terminal, creates some resistance. The better/stronger the connection, the less resistance is induced into the overall end-to-end connection. The best lowest impedance (resistance in the AC world) connection you can nominally make is a welded/soldered connection
A weak/loose connection is a weak-link in your circuit which acts as an added resistance in your DUT circuit. Even a few tens of mΩ can create a significant voltage drop, which results in a measurement error. You may assume that there is zero resistance from your DUT’s power source to the CurrentRanger positive [+] terminal, but this can often be a fallacy especially in the µA and nA ranges.
If for whatever reason there is a significant voltage drop before or after the CurrentRanger terminals (other than purely your DUT load resistance), then some degree of error will be introduced in the measurement
It’s impossible to completely remove any residual resistances inherently present in physical wiring/connection/terminals, but with good practice and understanding these can be minimized
You should take into consideration that wiring and connections may contribute a very small resistance that could add a fraction of % of error to the measurement, but in general if all things are equal this error will be constant regardless of the meter you use, even with high end instruments
Any residual resistances described above (and any errors they create) will be more significant with very small DUT loads (µA range, nA range especially) and become insignificant as your DUT is a large load (upper mA range)
To make it most convenient to connect your DUT circuit on the input, the CurrentRanger has several terminal options described here. Probably the best and easiest to use of these is the thumb terminal which grabs the input wiring with a strong tension mechanism, thus minimizing any connection resistance. The “Gold” banana-jack terminals are probably the least consistent option when used to secure a wire as they can loosen up or give the impression of a good connection when in fact a wire can snap away easily. Banana jack leads and alligator clips are better candidates to use with the “Gold” and low profile banana-jack terminals.
It’s also a best practice to use thicker stranded wiring, from the power supply to the [+] terminal, and from the negative [‒] terminal to the DUT, and keep wires short whenever possible.
Capturing a fast transients with dynamic impedance
When you have a load with a dynamic impedance, it may be difficult to get repeatable measurements. An example is a MCU with a radio transceiver.
It’s important to ensure the transceiver’s load (antenna in the case of a radio transceiver) is a perfect 50Ω load, otherwise the scope captures will differ between measurements, since an actual antenna can slightly change impedance even as you move around it.
To make consistent and repeatable measurements, this can be achieved by soldering two 100Ω resistors in parallel (=50Ω resistor) instead of a real antenna, this way the transmitter sees a “perfect” load that absorbs all the energy. Here is a Moteino with a “perfect” 50Ω antenna load:
Here we take a look at some sample scope captures of the different modes of operation.
The CurrentRanger has a low impedance output and for general purpose DMM (digital multimeter) readings, just touching the output terminals with the DMM’s probes is enough to get an accurate reading. All ranges should read a close to 0v output with no-load at the input terminals. Here’s a no-load reading on the nA range with a Fluke 87V:
With scope measurements, it’s important to minimize inductance of the probe ground which can easily pick up mains and other switching noise in your environment. Here’s how to use your scope when doing measurements (this is a good practice in general):
Remove the probe’s ground lead and use the short ground spring instead. This reduces coupled into the probe
Set your scope and your probe to 10x attenuation
In addition to all other outputs, there is a dedicated probing set of pinholes for scopes:
Scope capture / side by side measurements
A few measurements are taken side by side for comparison. In this case, the current meters are set to the closest equivalent settings wherever possible, and the scope settings are the same. The following setup is used, with probes using their ground spring connection on the negative [‒] terminal to minimize ground noise pickup:
Here are some sample no-load measurements, with probes used as illustrated above:
The nA range is the most sensitive to noise pickup, especially mains noise. Here is a sample scope capture in the nA ranges, with no-load at the inputs, without LPF, and with LPF activated:
The CurrentRanger has an I2C header where a small SSD1306 based 128×64 OLED can be plugged in. This header has this order of pins (left to right): [GND, 3.3V, SCL, SDA]. During power-ON if a screen is detected at I2C address 0x3C (typical of most small 128×64 OLEDs) the unit will periodically refresh the screen with data:
battery reading (actual voltage, “LoBat” if <3.4V)
output voltage reading – this is done by the SAMD21 12bit ADC, with usable accuracy via oversampling
output range (nA, µA, mA) – this is also always visible on the LED range indicators
any other useful information can be added in open sourced code
The OLED readings are sampled through the SAMD21 MCU’s 12bit ADC and are reasonably good for on-the-go or getting a ball-park idea what the load is doing. Do not expect the same high accuracy readings with the OLED, as by measuring from the output terminals with a true RMS DMM.
Expect some extra high frequency noise at the output when the OLED is attached, seen at the OLED refresh intervals (100ms default). This will be more visible on a scope, not on a RMS DMM. This is because the ADC (SAR architecture) sampling cycles can couple some noise into the output lines of the opamps. This should be minimal if the LPF is turned ON.
Here’s a sample capture of a 58Ω resistive load from a 2xAA battery pack, the OLED is attached, the LPF and AUTORANGING are both ON:
Caution: OLEDs are fragile!
Use caution when handling these OLED displays. They are fragile especially in the corners where the glass is unsupported and if the glass breaks, the OLED will most likely stop working.
The small OLEDs are sourced from China (unfortunately) – they are the most affordable generic solution. However they are not top quality. Each is tested to ensure it has a bright image. Sometimes a weak image is also caused by a weak connection on the flex ribbon. Sometimes a weak connection can become loose later rendering a weak image or disabling the OLED completely. Several OLEDs are found like this during testing. Please always use the OLED case with the OLEDs, this is to ensure you cannot plug in the OLED incorrectly and damage it that way, and it also protects the glass.
Here is what a weak connection or broken ribbon can look like, if your OLED is somehow not working please check this ribbon first with a magnifier, if you find such a broken or weak connection you can add some liquid flux and touch the connections with a soldering iron:
Proper OLED install
You should first ensure the OLED pins are not bent, if they are, gently bend them to perpendicular position against a straight surface, without touching the glass. Breaking the OLED glass will render it useless!
Insert the OLED gently and wiggle it into position until it’s seated with the glass screen flat. Then insert the provided bracket to secure it into position. To remove it you have to first pull the bracket and the OLED should come out, but it may require pushing on the OLED glass to loosen it from the case.
3D printed OLED case
The OLED enclosure can be found in the official Github repository and also here. Depending on what OLED you have you may need to slightly scale the model to make it fit.
With gradual firmware releases, many new features were added, such as a serial menu that allows changing the CurrentRanger’s behavior. See the firmware upgrades page for details how to get your CurrentRanger’s firmware updated.
You may alter certain parameters from the serial menu accessible over USB. This allows to easily change parameters such as the calibration values, toggle logging via USB or Bluetooth serial header, toggle Auto-Off function. Some of these changes are saved into memory (ex. calibration values), some are not (ex. toggle USB logging). Below is a sample screenshot of the menu and toggling of some options. It is also possible to control the CurrentRanger through this serial port – ex. change the range or toggle LPF, see all options below.
While USB is probably the fastest logging option, CurrentRanger also has a serial header where you can connect a wireless HC-06 BT serial device, this header will output serial data in the following format when a is detected (detection is done during power-ON, see below):
123E-x – followed by newline, where x is the range (3=mA, 6=uA, 9=nA). Example: 2345E-3 is scientific notation for 2345mA.
Upon startup, the CR executes an “AT” command query to this bluetooth serial header, if it receives an “OK” response back within one second timeframe, then it will automatically start logging the sampled values to this serial header. If does this check 2 ways, with and without line ending (crlf characters). This has been confirmed to work with generic HC-06 bluetooth modules that implement the AT command interface.
The HC-06 Bluetooth module is recommended since it’s pretty commonly available and relatively easy to use. It usually comes set to 19200/115200 baud. The default CurrentRanger firmware serial header baud is set to 230400, so you need to match this baud in the HC-06 module using the AT command set (by issuing the AT+BAUD9 command), see this link for more details.
It is reported that the new HC-06 modules (flashed June 2017 and later (get firmware version via AT+VERSION) have a different behavior: 9600baud default speed and both NL & CR are required. To change port speed issue command AT+UART:230400,0,0.
Here’s a sample capture of a RaspberryPi booting up, captured on the Arduino IDE’s serial plotter (mA range):
Bluetooth logging might be too slow, and USB serial logging will be much faster, but you should be sure not to create ground loops, a USB isolator is recommended, please see the Safety and Proper Usage page for details.
The Bluetooth/USB logging while using the OLED is not recommended. While possible, it will make logging slower due to OLED screen updates.
The firmware for the CurrentRanger is freely available as an Arduino IDE sketch and you can tweak it, customize its default behavior and even make it better.
Easy drag-and-drop firmware updates
The latest firmware is posted on Github. The older R1-R2 firmware is also posted on Github for legacy purposes. Since the release of R3mk4 (and some late R3mk3) the CurrentRanger shipped with a new UF2 bootloader which allows easy backup and swapping of firmware. Hence there is a UF2 firmware file available as well.
To ensure you download a intact non-corrupted version of the UF2 firmware file from Github, download the entire repository as a ZIP file – Github may remove carriage returns in a direct download.
To access the UF2 bootloader on the unit, you need to connect the CurrentRanger to USB, and either open a serial console and issue a ‘r’+ENTER (see serial menu page), or tap the RST button on the component side twice quickly (or quickly short the RST pad to GND twice if your unit does not have a RST button), the CurrentRanger will switch to bootloader mode and enumerate as a flash drive that exposes the Current.uf2 firmware – this should be backed up from the unit whenever you plan to replace it or upload new firmware. Also ensure you save the calibration values (from the OLED or USB serial), these values should be loaded after flashing the new firmware (via USB serial menu – press ‘?’+Enter in serial monitor to access all options).
Please note – the active firmware running on the unit will always show up as Current.uf2, but you can overwrite it by drag-dropping a replacement uf2 file (such as newer versions of it that you downloaded from the repository) with any file name and the bootloader will handle the firmware update, which takes a few seconds and then the unit will auto-restart and run the new firmware.
CurrentRanger revisions shipped before March 2020 do not have the UF2 bootloader. For this reason they might not include the RST button, in this case you need Arduino IDE to reflash firmware, and Arduino will perform the reset into bootloader. To force the unit in bootloader mode you can short RST to GND twice quickly to simulate a double tap (see RST pin location in image below), or you can issue a ‘r’+ENTER in the serial menu. The bottom of this page also explains how to access the SWD interface to reflash the bootloader.
If the CurrentRanger does not enumerate correctly and shows as Unknown Device in Device Manager (Windows10), uninstall/remove the Unknown Device, power cycle the CurrentRanger and replug the USB, and it should enumerate correctly.
Compiling from source
To compile from source code and upload the firmware you will have to install the following packages in Arduino IDE. First ensure you have the official Arduino SAMD Boards (32-bits ARM Cortex-M0+) boards package, via the Tools>Boards>Boards Manager :
Then you will need the LowPowerLab SAMD boards package, which includes the CurrentRanger SAMD21 board definition. Add the following URL to your Preferences:
Then open Tools>Boards>Boards Manager and install or update to the latest LowPowerLab SAMD package:
Then once plugged in (it has to be powered ON as well), the CurrentRanger will show as a serial USB device that you can pick as a target in the Arduino IDE, just make sure you pick the correct serial port associated with CurrentRanger from the Tools>Port menu or you may use Felix’s custom Arduino IDE with serial/port shortcut bars add-on:
The CurrentRanger’s USB port can power it for programming purposes even without a battery attached. You should only use a standard Lithium-Polymer rechargeable battery while connected to USB since there is a LiPo charger on board that expects this type of battery.
You will need to install several 3rd party libraries to be able to compile the firmware. Please see the sketch header for the links to each library, they should all be available to install through the IDE’s Tools>Manager Libraries dialog.
Convert HEX firmware file into a UF2 file
If you compiled a HEX version of the firmware and want to convert to/obtain the UF2 equivalent you can achieve this in 2 ways: 1) Upload the firmware to the CurrentRanger and then access the bootloader as explained above to retrieve the firmware as a UF2 file 2) Use the HexToUf2 converter posted in the Github repository.
Older Windows Drivers
If you’re on MAC or Linux you should not need any drivers. Also Windows 10 will probably detect the board as a virtual serial port and assign it a COM port by default without the need of installing a driver. Older Windows versions are likely going to fail to install a driver when CurrentRanger is first plugged in. Click below to get the USB driver and unzip it to your Desktop or another folder. The ZIP file contains a screenshot walkthrough of how to install the driver (shown for MoteinoM0, same for CurrentRanger).
ADC gain and LDO calibration
Your CurrentRanger is calibrated to the measured LDO output during testing, it is a value around 3.3V. Also the ADC gain is adjusted to improve the ADC readings (output on the OLED and to serial logging). These values can slightly change based on load and how long the unit has been turned ON and perhaps other conditions (temperature, etc) – especially true for the LDO voltage. The latest firmware allows to change these values easily via USB serial. The LDO value can be measured on any of the exposed headers (between any GND and “3V” pins). To adjust the LDO and gain, along with other options, access the available commands menu by sending ‘?’+Enter (newline) to USB serial. It is required that you use USB isolation if you do this while measuring a load.
Reset button, manually running the bootloader
There is a RESET button on the bottom side. Although it should not be necessary, you may double-tap the RESET button to enter the bootloader to accept a new firmware upload if you try something that causes the SAMD21 to becomes unresponsive. You know you are in the bootloader if the LPF LED displays a breathing pattern.
OLED I2C Clock Speed
It’s desirable to speed up the clock of the I2C bus when using an I2C SSD1306 based OLED display. Without this optimization there will be more noise on the output when the OLED is connected (visible on a scope only). The “factory” firmware loaded into the CurrentRanger contains this optimization as well as the latest sketch update:
u8g2.setBusClock(1600000); //1.6Mhz i2C clock
To reflash the MCU you will need to access the SWD interface. These pins are located on the PCB as highlighted below. The BOOTPROT fuse is set, this needs to be disabled and re-enabled after flashing the MCU. Any reflashing is done at your own risk and there is no support offered for this procedure. The UF2 bootloader as well as the older samba bootloader are both available in the LowPowerLab SAMD boards package, see the Compiling From Source section above on how to install that.