12V Power Distribution and Monitoring Board

Tell us about your projects. Update us regularly.
Post Reply
parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

12V Power Distribution and Monitoring Board

Post by parkview » Fri Mar 06, 2020 10:04 am

I currently have three small micro computers that I am using for FreeBSD Servers at home. These where purchased for under A$300 each and come with 4-8GB of RAM and are powered from a 12V DC power source. They draw around 0.75A at idle and can go up to 1.2A at full CPU/SSD usage etc.

I quickly wipped up a Vero board based distribution board to do some intial testing and this has worked will. It's also led me to research lower voltage (and power), drop protection devices: http://forum.swmakers.org/viewtopic.php?f=12&t=2169.
12V Power distribution board.jpg
12V Power distribution board.jpg (53.88 KiB) Viewed 2980 times

I thought it would be handy to be able to automaticly turn them off and on again during a power failure, as well as monitor their power usage. In this Alpha prototype PCB, I hope to be able to monitor the power input and each of the 3 server outputs. I am trying a few new different technologies here, so I am expecting to need another PCB produced once I have debugged this one and tested it out.

Initially I was going to have a go at using a Op-Amp to buffer and amplify the voltage drop across the 0.1V resistor, but instead I will be trialling some INA199 and/or some INA193 specialised current sensors. It be monitored and controlled via a ESP32 and KiCAD say is will look something like this:
UPS Monitor_PCB_V1.0.jpg
UPS Monitor_PCB_V1.0.jpg (238.18 KiB) Viewed 2980 times

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Fri Apr 17, 2020 11:19 am

The PCB arrived the other day. It took a total of 23 days to arrive and includes the production. Not all the parts have arrived yet. I am missing the five INA199 current sensors and the ESP32 controller. The board will run without the current sensors, so to be able to get started on the software side of things, I scavenged an ESP32 from a dev board. First I used my hot gun to quickly help remove all the pins:
removing ESP32.jpg
removing ESP32.jpg (267.37 KiB) Viewed 2640 times
This then allowed me to place the board on the hot plate, wait 40 odd seconds to heat up and then remove the ESP32 board.

I had previously cut out a solder stencil from 0.1mm plastic Mylar sheet, so after layout out the 90 odd components, I stencilled on the solder paste, added the components and placed the 10cm x 10cm onto my 10cm x 10cm hot plate. It didn't heat the edges that well (as expected), so I just had to push down a for 10 seconds at each corner to help the heat flow into the board and it was all done:
UPS_PCB_Board_sml.jpg
UPS_PCB_Board_sml.jpg (335.61 KiB) Viewed 2640 times

There where only one visible soldering issue and that was with two bridged pins on the USB UART IC. That was quickly fixed using solder wick to suck up the excess solder. There was one other hidden solder bridge up inside the USB socket on the PCB. Once found, it was fixed with a clean fine point solder iron head and swiping the gap between the two pins.

Now, on with further testing.

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Fri Apr 24, 2020 9:02 pm

A breakthrough!

I have been having problems trying to program the ESP32. The CP2102 USB to Serial circuit isn't working. I kind of expected that, as it's the first time I have tried using the circuit. It's also the first time I have tried loading a program into the ESP32 WROOM32 by serial too. I thought I had it all nutted out on the hardware side, so I was doubting my new USB to Serial dongle. It's using a cloned PL2303 IC, so I wasn't too sure it was working OK and PlatformIO just erred out with: Upload Error 2.

I ended up cutting all the traces between the CP2102 and the ESP32, just to make sure it wasn't interfering with the bootload process. After playing around with PlatformIO.INI settings:

Code: Select all

[env:esp32dev]
platform = espressif32
board = ESP-WROVER-KIT
framework = arduino
upload_protocol = esptool
upload_port = COM33
and it still not uploading a simple blink LED program to the ESP32, I started hunting around for other things that could be blocking the process and Bingo! I found this extra pin that I had missed during the design phase: https://github.com/espressif/esptool/wi ... other-pins. Turns out I was trying to use GPIO12 (pin14) to measure the 12V power in line (via a resistor divider), and the resultant voltage was around 2.6V, which was causing the ESP32 to set a 1.8V for the Flash voltage. In my case, it needs to be 3.3V.

I cut the trace, and re-wired it to GPIO13 (pin13) and wala, my program could now upload to thre ESP32 and I have lovely blinking LEDs:
Testing USP Monitoring PCB_sml.jpg
Testing USP Monitoring PCB_sml.jpg (72.94 KiB) Viewed 2630 times

During all of this, I inadvertently connected the 12V voltage backwards ( + _ around the wring way), it was a good test for my reverse polarity P-channel MOSFET protection. It passed admirably, and nothing was harmed.

This is the first time I have used a high-side MOSFET switch IC: FDC6330L This too is working well, and the above photo shows a 12 ohm dummy load plugged into one of the right hand side outputs. At 12V, it's drawing 1A when it's switched on. Very nice, although, I did find that one of the outputs is connected to GPIO35, which is an input only GPIO. Another cut trace, and I rewired it to GPIO16.

So, before I can order a new PCB, I have to debug the CP2102 issues. In the next version I will add a LED next to each input and output to allow a quick visual check of whats going on with the power.

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Sat Apr 25, 2020 9:12 pm

Worked on the CP2102 USB to Serial circuit today. After poring over the documentation, and looking on the Internet at other peoples schematics, I noticed that the USB socket I was using was an upside down version and therefore the pinout was the reverse of what it should be. This is why my poor laptop USB Port would shutdown as soon at I plugged in my 12V Distribution board via a USB cable.

To really confirm this, I first tried making up a small 2mm pinheader crossover for my USB Breakout board: http://forum.swmakers.org/viewtopic.php ... 5620#p3562 Unfortunately I forgot to take into account that on a micro USB plug, pin 5 is the ID pin, so I couldn't simply use a crossover connection.
crossover_sml.jpg
crossover_sml.jpg (14.55 KiB) Viewed 2628 times

Plan B, was to just wire a female pinheader block directly to the USB socket footprint - after I had hot aired off the problematic USB socket;

This worked a treat, and my laptop immediately recognised the CP2102 IC and created a serial port for it. A few minutes later, I had downloaded a new working program to my board. Now I just have to redo the design updates and spin off a new PCB for manufacturing.
USB-plug_sml.jpg
USB-plug_sml.jpg (92.26 KiB) Viewed 2628 times

How did I end up using a wrong USB socket? It started using the wrong USB footprint. I thought I had used this footprint before and that I had lots of them in stock. Turns out I had used the wrong footprint. When the PCB arrived, I went hunting for the part and realised my mistake, however, I found a part from my Shenzhen stock that fit the footprint. Unfortunately, at the time I didn't realise that the pins where reversed! I did get quite a bit of practice in hot air work, with removing and replacing the 28pin QFN based CP2102 IC. I quite enjoyed the troubleshooting process and fine pitched soldering work.

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Wed Apr 29, 2020 4:15 pm

I found a fix for the mess of USB breakout wires. I hacked up another USB plug by cutting off some shield pins and folding out some other shield pins and found I could just solder the socket into place on the PCB footprint.

While I have experimented with adding Over The Air (OTA), programming capability to my code, I don't like how exposed a surface it opens up on the ESP32, so I went back to programming via a USB cable. Beside, once the program is fulling running, it shouldn't need programming very often.

I have added on the OLED screen, but found I didn't think about the footprint of the screen. Here it dangles out over the WiFi antenna with no support, possibly restricting the WiFi range. On the new PCB, I have rotated it around by 180 degrees and added a mounting hole for added support for the screen.

I now have the Vtest voltage being read and displayed on the PCB. A lucky catch was that I had moved the Vtest pin GPIO 14, but read on-line that it's on ESP32 ADC2 channel which shouldn't be used if you want to use WiFi at the same time. I have since moved it to ADC1 GPIO35 (photo below was taken before implementing the change) and am getting some good readings on it:
OLED_sml.jpg
OLED_sml.jpg (44.99 KiB) Viewed 2595 times

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Sun May 10, 2020 3:12 pm

I sent off for a free sample of the INA199 current sensor IC. It arrived a few days back and it didn't take long to solder it into place and test it out. Here it's measuring 1.04A running through a 0.033ohm resistor via a ESP32 ADC port:
current_testing_sml.jpg
current_testing_sml.jpg (54.65 KiB) Viewed 2412 times

I am very happy with how it's turned out, so it was onto a final redesign to add in a few extra features, like:
1) an extra output jack that's monitored via a 1NA219 (i2c reporting back to ESP32), as I had run out of usable ADC ports on the ESP32
2) a four wire I/O jack for external use if I want to add some extra functionality late on
3) some extra power conditioning capacitors

Some sections of the PCB are starting to get a bit cramped, but I am happy with how it's going to look:
Power Monitor PCB V1.0_sml.jpg
Power Monitor PCB V1.0_sml.jpg (76.62 KiB) Viewed 2412 times

The design has been uploaded for production in Shenzhen, so I might have it back in four weeks or so. Then the real fun can begin with the final component assembly.

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Sat Jul 11, 2020 8:54 pm

The PCB arrived the other day so I laid out the 100+ components, laser cut out a 0.1mm thick plastic stencil, solder pasted it up, laid on the components and hot plated the board. It came out looking great with only a few solder bridges on some of the finer pitched traces. These only took a few minutes to wick up with solder wick and a hot iron.

The Big Red Board:
Server_Power_ManagerV1.0_sml.jpg
Server_Power_ManagerV1.0_sml.jpg (76.82 KiB) Viewed 922 times

Now it's onto mashing up software via PlatformIO. ;)

User avatar
seaton
Master Maker
Posts: 222
Joined: Tue Jun 24, 2014 11:41 am
Location: Bunbury, WA
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by seaton » Mon Jul 13, 2020 3:02 pm

great progress

parkview
Master Maker
Posts: 450
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by parkview » Mon Jul 20, 2020 10:24 pm

I think I applied too much solder paste on the central heatsink pad of the USB-UART CP2102 IC, as initially I couldn't talk to the ESP32. All the pins looked ok and there where no shorted pins that I could find. I hot-aired off the IC and removed the pool of solder on the heatsink pad and soldered it back into place and it then worked, and it was onto writing some software and testing functionality of each part of the board. It all works!
micro-server_V1.0_sml.jpg
micro-server_V1.0_sml.jpg (52.08 KiB) Viewed 800 times

Above, all four RH side outputs are turned on (green LEDs lit up), and on the display you can see a rough current reading on Port 3 as this is the only Port with a test load on it. On the LH side of the display you can see a rough input current thats being drawn through Port 2. All other Ports are at zero mili-Amps. At the top RH side you see a rough board bus voltage.

I say rough because the ESP32 analogue conversion isn't linear! I will have to do up a lookup table to make the readings more accurate.

The only design flaw of the version 1.0 board is that the P-channel input protection MOSFET allows voltage to go backwards through to the input LED. You can see that the top LH green LED is lit, but it doesn't have a power source plugged into Power In 1. Just a minor glitch, as the OLED display shows that there is no incoming power on Port 1.

I made a few measurements of the voltage drop across the board with a 1A load. I loose a maximum of 162mV from input 1 to output 4. This includes the voltage drop across two MOSFETs and two current measurement resistors. There is an acceptable 5mV (port 1 out) to 15mV (Port 4 out) drop across the 12V central 5mm wide copper busbar and 2.5mm run to each Port output.

Next up is to learn MQTT and get it installed onto my micro-servers. This way I can communicate back and forth between all my home servers and this Power Management board. This is most probably the last post for this project. There isn't much to photograph or talk about. It's been a great learning exercise for ESP32, highside power switching and monitoring.

User avatar
seaton
Master Maker
Posts: 222
Joined: Tue Jun 24, 2014 11:41 am
Location: Bunbury, WA
Contact:

Re: 12V Power Distribution and Monitoring Board

Post by seaton » Thu Aug 06, 2020 11:44 am

looking good

Post Reply