Power Monitor - small compact bench helper

Started by free electron, December 28, 2014, 01:04:08 PM

Previous topic - Next topic

free electron

Sharing with you my latest project:

Power Monitor



It is a small module which you can plug between the power supply and your tested circuit, it measures


  • voltage (5-26VDC range)
  • current drawn from the PSU (0-1A range, 50µA resolution)
  • power consumption in mW

and displays it on an LCD. The core of the circuit is the Texas Instruments INA219B I2C high side bidirectional current sensor chip and a PIC24F16KA101 microcontroller.

I have implemented two cheap LCD types in the current firmware:


  • 128x64 0.96" I2C OLED (SSD1306 driver chip, widely available on *bay)
  • 84x48 SPI Nokia5110 LCD (PCD8544 driver)



The module has a CURRENT ALARM function built in. You can set a threshold value with the pot (pot at max = alarm switched OFF). If the powered circuit draws more current than the threshold value, the module will kindly inform you about that fact by blinking the current readout and beeping the hell out of it with the onboard piezo buzzer. This may save the circuit in case you are not using a bench power supply with current limit feature. The increased current consumption is often the first sign that there is something wrong with the tested circuit. By the time you get your test leads to check the voltages, a magic smoke may already be there.



Another feature is the Serial Port link. Power Monitor sends the data via UART in two different formats. Using one of them and a cheap UART-USB converter the module can be used as datalogging device. The readouts are sent in 1sec intervals (i wanted to add a variable time, but i run out of the FLASH). Serial port commands can be used to start, stop sending the data, reset the measurement counter, change the data format and finally to increase the precision of the module by calibrating it against other high quality mA meter.

Other features:

  • low dropout reverse polarity protection (DC in jack)
  • detects swapped DC in and DC out jacks
  • the module could be used as a small PIC24 dev board, all the comm interfaces are available on pin headers
  • one input port pin for future use

Project article and design files:

Power Monitor article

All design files, including schematic, PCB layout, gerber files, MPLABX project, compiled HEX and source code are HERE

I have built one unit into my 9VDC bench power supply:




Also have a few of these used in different places on in my bench, built into a breadoard to monitor the global power consumption or just lying around in case i need to check power line very quickly (much faster than getting out all the probes, crocodile clips, meters etc). Boxed into a small enclosure it could make a nice small troubleshooting gadget for a pedalboard.
By changing the current sensing resistor and the calibration constant within the INA219 the measured current range can be adjusted to your needs. I have chosen the range of 0-1A with 50µA resolution as sufficient for most uses in pedal building. The max bus voltage (26VDC) is limited by the INA219 specs.

I'm going to order a small batch of PCBs (rev.2) soon and have them available if anyone wants one. You can also use the gebers to order your own.

Enjoy!
Piotr


Perrow

Sounds very interesting, how much would they be? How hard is the other components to get?
My stompbox wiki -> http://rumbust.net

Keep this site live and ad free, donate a dollar or twenty (and add this link to your sig)

tubegeek

"The first four times, we figured it was an isolated incident." - Angry Pete

"(Chassis is not a magic garbage dump.)" - PRR

free electron

Quote from: Perrow on December 28, 2014, 01:56:01 PM
Sounds very interesting, how much would they be? How hard is the other components to get?
around 10EUR, including shipping (EMS registered priority mail) and paypal fees.

Here is the BOM:



LCD sources: ebay or one of these "maker/arduino/shield" online stores. I paid around 6EUR for the small OLED one. 
PMOS used in the reverse polarity protection: any type with sufficient Uds, low enough Rdson and a GDS footprint will do the job. There are two footprints on the PCB: smaller TO251 and a standard TO220.
Current sensing: there are special precision current sensing resistors, but they are more expensive and not so widely available. There is a place for 10x 1R 0.5% resistors connected in parallel on the pcb, giving in total required 0.1R.
Piezo buzzer: standard 12mm diameter one, passive (without generator), 2.4kHz.
The rest is available on Mouser/Digikey etc. Most passive parts are in 0805 size with two 1206 exceptions: current sensing and the nokia LCD backlight current limiting resistors.



rullywowr

This is totally awesome!  Thanks for sharing.  Must build this.
DIY Pedal PCB projects IN STOCK
www.rullywow.com

bloxstompboxes

I'd be interested in this. Might have to find some free time at work with the SMD though.

Floor-mat at the front entrance to my former place of employment. Oh... the irony.

PRR

> Current sensing: there are special precision current sensing resistors, but they are...

If you are very clever, you can make a 0.1 Ohm resistor with a long thin PCB trace.

Of course this assumes you always use the same PCB copper and have excellent control of trace-width.

There are many "PCB trace resistance" calculators on-line.

I do not know what is good proportion for modern PCB fabs, so I picked dimensions by guessing. I *think* a 25 mil trace will carry way-more current than any pedal should need(??), but do not know how many Oz the standard copper is.

http://circuitcalculator.com/wordpress/2006/01/24/trace-resistance-calculator
Width 25 mil
Thickness 0.5 oz/ft^2      
Length 2.6 Inches
Resistance 0.101 Ohms

http://www.eeweb.com/toolbox/trace-resistance
Width 25 mil
Length 6.6 cm  (2.5984 inch)
Thickness 0.5 oz/ft^2      
Resistance 0.100 Ohms

Good agreement. There is also temperature effect, but we are expecting under 0.1 Watts in a trace which will zig-zag over most of a square inch, in shirt-sleeve environment, we probably do not need to care 23deg or 27deg (maybe 2% error).

If you are very fussy, you will run the trace 5% long, provide several "taps" back to 5% short, and when the PCB comes back from the fab you short-out the taps until you hit 0.10 Ohms. If the fab etch runs hot-and-cold, so trace-width varies a little, you can calibrate each batch.

Agree that ten 1r0 half-percent is an excellent solution also. More tiny parts to place but better built-in accuracy.
  • SUPPORTER

free electron

Thanks for the input, PRR!
Clever idea with the PCB trace resistor. However, while reducing the BOM cost (10 resistors) it would make the device not as flexible as it is now.
.1R Rsense happened to be ideal for my application, but the INA219 will work with anything (in reasonable range of course).
You calculate a calibration constant based on the Rsense value, required current measurement range and a few other parameters to make the best use of the internal 12bit AD converter (TI has a free soft to do that). MCU uploads that constant at startup. It can be modified via Serial Port.
Need a larger/smaller current range? Change the Rsense and recalculate the constants.
I think i'll build another unit, modified to much smaller current range, like 0-10mA for measuring low power stuff. Not sure if i need it, but all the building, experimenting, fine tuning process is often much more exciting and tempting than using the thing later on ;)
One thing i would add in the future version is a separate power input for the meter part. Right now all the electronics is powered from the same power bus as the load. The current consumption depends on the used LCD type (backlight leds). With the small OLED the meter draws about 17mA. INA219 is a bidirectional sensor. The negative current value is used to detect the swapped power jacks.