ATX Bench Power Supply With INA226 Sensors and Arduino Controller

by flappydunk in Circuits > Arduino

78 Views, 2 Favorites, 0 Comments

ATX Bench Power Supply With INA226 Sensors and Arduino Controller

20250305_083255.jpg

This is another ATX power supply for the bench. However I have tried to add some value to this project. For the ATX power supply, I used a silent PSU because my last one was getting noisy. I have added a 5 x INA226 current & power sensors one to each supply.

The power outputs are as follows;

5V 10 amp rating

12v 10 amp rating

3v 10 amp rating

Variable 5A rating

USB x2 ports 3A ( 1 + 2.1) rating


The bench supply has output isolation switches and circuit breakers for most sources.

The overall control of the monitoring is provided via a 2x16 LCD display, rotary encoder and the Arduino.

The LCD provides a managed output of each of the sources and control of the sources via the encoder.

The Arduino also provides the option for all raw data to be sent to a rear USB port connected to the arduino. This is formated as CSV for a specific source. It also can output all formatted for readable display continuously or intermittently.

Supplies

20250305_083255.jpg
USB.png
Screenshot 2025-03-06 163137.png
USB2.png
var.png
Screenshot 2025-03-06 170530.png
Screenshot 2025-03-06 170656.png

The case is 3D printed. This was created from a OpenScad designed by

FB Aka Heartman/Hearty 2016 -

- http://heartygfx.blogspot.com -

- OpenScad Parametric Box -

- CC BY-NC 3.0 License -

Thanks to "Heartman" creating this basic box I was able to modify it using Freecad.

I modified the OpenScad file code provided by Heartman to create extra tabs for a larger box 220 x 220 x 140

The top fan grill, face and rear panels are created using Freecad and merged it with the imported Openscad STL file.


Front Panel components are:

2 x 16 LCD

Rotary encoder with push switch

3 x 10 Amp circuit breakers

1 X 3 Amp circuit breaker

1 x 5 Amp circuit breakers

4 x 20Amp SPST panel switches

SK120 120W DC Buck Boost Converter

3.1A 12V Dual USB Car Charger port



Internals

ATX psu

Arduino - I used a micro pro (any will likey be OK)

5 x INA226

2512 R006 resistors

Fuse holder 100mA for Arduino and INA226's

Arduino extender USB cable to rear panel panel mount.

Bench Power Supply Case

20250305_083255.jpg

The original parametric box was developed by Heartman and is available of thingiverse

https://www.thingiverse.com/thing:1264391

My modifcations are supplied here to provide a extra case tabs, grill, stand, front and rear panels.

Here are all my STL files

These are printed on a Ultimaker style printer 300 x 300 area at 0.2mm layer height black PLA+ and gave good results.

The front panel labelling in white is done by changing the filament at layer 12 using Cura.

The 2 x 16 LCD requires a adapter to help it fit the front panel. This was glued in place.

Arduino and the INA226

20250223_151151.jpg
20250304_160117.jpg
20250304_160123.jpg
Screenshot 2025-03-07 150535.png

The ATX psu was rewired to distribute the power as 5 outputs. I estimated the power rating for each on as shown above. These were wired to a strip connector to tidy up all the wiring. I removed a side of the ATX psu to help get all the wiring to fit.

The Arduino and INA226 were mounted on two small circuit boards. One board has a fuse 100mA on it and fed from the 5V supply used by the USB ports. This provides power for the Arduino and INA226 boards. These boards are mounted back to back on a 3D printed mount. I used a Arduino Pro micro however I suggest you can use anything you have lying around.

All the INA226 require modification to replace the R100 resistor with a R006. This increases the current range to 13 amps.

The circuit diagram is fairly straight forward. I have attached the Kicad drawing. The Arduino communicates using the I2C bus. This has two 2.2K resistors on it (SDA and SCL) to sharpen up the signals. The LCD 2 x 16 also communicates withe the arduino via the I2C.

Each INA226 requires straps for the I2C address allocation.

The Arduino Code

INA226

I used a INA226 library written by Wolfgang (Wolle) Ewald

* https://wolles-elektronikkiste.de/en/ina226-current-and-power-sensor (English)


However I have modified it to make programing so many sensors easier. The mod allows me to create an array of sensors and test the I2C. So the code uses the modified libraries INA_226_WE_mod.h and INA_226_WE_mod.cpp

Put these and all the attached files below in one folder Arduino_Power_V2


Setting up the code:

In the Arduino_Power_V2.ino tab you will need to modify the following arrays

for {"5v ","12v","USB","Var","3v "} sensors


//rail sensor INA226 Settings and I2C

int const sensors = 5; //The number of sensors used

byte addresses[] = {0x40,0x44,0x48,0x41,0x45}; //The INA226 I2C address for each sensor

float Correction[] = {0.84,0.84,0.84,0.84,0.84}; //The calibration adjustment for each sensor

float Amps[] = {11,11,11,11,11}; //The maximum current allowed for each sensor

float Res[] = {0.006,0.006,0.006,0.006,0.006}; //The INA226 resistor

Setup and Calibration

On Power up it will remember the last settings using the EEPROM: So you should see the default settings displayed.

If you have not saved previously press the rotary key as follows: After the first try it should save the defaults in EEPROM.

Press the rotary key for the main menu. Press again to change the sub menu. Press again saves the choice and exits the menu.

Mode: This is the type of output you want

LCD mA : output to LCD

LCD Amp : output to LCD

CSV : Continuous output to the arduino port

e.g.

CSV output example : 12v_SHUNT_mV 0.002,BUS_V 12.409,Current_mA 0.000,POWER_mV 0.000

V24_Key : A single out of all the raw data to the USB port

e.g.

Name SHUNT BUS CURRENT POWER

mV V mA mW

5v -0.006 5.126 -1.007 8.392 Values OK - no overflow

12v 0.002 12.409 0.336 0.000 Values OK - no overflow

USB 0.059 5.128 9.735 50.354 Values OK - no overflow

Var 0.237 12.411 39.612 486.755 Values OK - no overflow

3v -0.006 3.392 -1.007 0.000 Values OK - no overflow

V24_CON : same output above but a continuous one.

CSV:

This select the power output you want to monitor {"5v ","12v","USB","Var","3v "}

Period:

This is the USB output delay in 100mS to a maximum of 500mS for the CSV and V24_Con

Monitor:

These values are filtered. The reason for this is that the INA226 outputs nonsense when open circuit. The code doesn't allow negative current and power is adjusted to zero when current is zero. Once a load is connected the INA226 behave themselves.

This is the LCD display power supply to monitor V, A and W monitor the 3v,5v,12v simultaniously

The {"5v ","12v","USB","Var","3v "} option monitor the current and power depending on the mode.


Calibration

To calibrate see Wolfgang (Wolle) Ewald notes. However just measure the current with a meter and compare the values with the display. The float Correction[] array insert a correction value to bring them into line.


Note:

One further point the INA226 raw data is output on the USB port when selected for CSV, V24_Key and V24_Con. So no filtering occurs. If the loads are Open circuit on the 5v,3v or 12v you will see ambiguous data. Once a load is connected they will be OK.