Adjustable USB Power and Measurement Board

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

Adjustable USB Power and Measurement Board

Post by parkview » Wed May 25, 2022 3:10 pm

As you can see from this Forum, I have been working on a number of ESP32 based projects. It would be really handy to be able to have a USB based power limiting function and at the same time, be able to measure power being used at high speed, say at least 20K Samples Per Second (SPS). This would help quantify low power usage on some of my projects.

In this project I have drawn ideas from this nice board: https://www.nordicsemi.com/Products/Dev ... ofiler-Kit
This first version of my board is an Alpha version to test out some of the circuitry that I might use going forward and to test out some of the software. Some of this is very similar to my USB Cable Tester Board, so it didn't take too long to put together some circuitry:
AUPMB.0_sml.jpg
AUPMB.0_sml.jpg (79.78 KiB) Viewed 274 times
It's all laid out into a number of switched blocks. By switched, I mean under ESP32 control, I will be able to switch various paths and blocks on and off. I have included a set of three current calibration test loads: 1A, 500mA, 100mA

It includes an adjustable 1.8V to 5V Regulator based on an adjustable MCP1827 LDO and a 100mA to 1.1A current limiting switch based on the MIC2097. Both of these are adjustable via i2C based variable digital resistors. This will be a first for me, so it will be interesting to see how these work out.

The above adjustments can be bypassed via MOSFETs and I use either RU30L30 or WST2011 (dual MOSFETs back to back) high side MOSFET switching around the board. Each block has a WS2812 RGB LED to signify it's status. It looks quiet colourful when they are all lit up:
AUPMB.1_sml.jpg
AUPMB.1_sml.jpg (83.84 KiB) Viewed 274 times
Funny story: So, some time back, I discovered that LCSC stock 2mm x 2mm WS2812 based RGB LEDs. These are a wonderful size to use when you have a pretty full PCB and not much spare space left for a bit of photon bling. I quickly used them in my next three projects with out closely examining the pinouts, I mean it kind of looks ok? Fast forward to the first PCB arriving and my dismay when the RGB LEDs would not light up! Yep, for some reason the manufacture has rotated the footprint by 90 degrees. You can still use them, but the footprints are a bit out and so you need to hold the LEDs in place while hot airing them down, otherwise the surface tension pulls them askew. Oh, and if you do power up a board with them out of place, it fries them out.

As you can see in the photo above, the adjustable voltage regulator is not the size I expected and I had space to mount it dead-bug style by scratching away some of the solder mask and hot airing it into place.

I have already learnt about some SPI based ADC IC's like the ADC124, so the next version will incorporate one of these, so that will give me a much faster current and voltage measurement in the next version of PCB. This journey has just begun!

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

Re: Adjustable USB Power and Measurement Board

Post by parkview » Thu May 26, 2022 9:12 pm

The first version of the Adjustable USB Power and Measurement board had this kind of block diagram:
V0.5_Block-Diagram.jpg
V0.5_Block-Diagram.jpg (15.81 KiB) Viewed 269 times
When I designed this, I didn't realise how slow i2C reading was on a ESP32. To save GPIO, I used i2c based INA219, which has a maximum of one thousand Samples per Second. I would like a greater resolution, so to heck with the expense, I will upgrade to a ADC128S102CIMTX, 8 channel SPI based ADC IC can read up to 1MSPS! Silicon shortages have driven the price up quite a bit, it's currently A$12.49/ea on LCSC.

Version 0.6 of this board will have something like this arrangement:
V0.6_Block-Diagram.jpg
V0.6_Block-Diagram.jpg (30.37 KiB) Viewed 269 times
I think I can do it with a ESP32, but later, I could move to a ESP32-S3 for the extra GPIO, when they are more prevalent and cheaper. It would be exciting to be able to read sub-miliAmp currents, however I suspect it might be quite a bit noisy down there in the grass, so to speak.

I have yet to do a thorough voltage drop analysis of the current board, but I think I measured 0.6V drop across the board with a load of 480mA. Thats quite a lot, but the path does have quite a few switching MOSFETs and each one takes a tiny chunk. Also, I am not driving the P-channel MOSFETs fully on, so thats not helping. I wonder if it's worth while adding a negative 5+V regulator to help lower the MOSFET resistance? I wonder how much better the voltage loss might be?

I am using a standard 128x64 i2C based OLED Screen. I tend to use these on most projects, as they are cheap and easy to use, but it would be nice to have a larger screen with more pixels. This morning after a quick search, I discovered that for around A$12, I can get a 128x128 OLED screen. This will be really handy for the rotary encoder menu and data display.

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

Re: Adjustable USB Power and Measurement Board

Post by parkview » Sat May 28, 2022 10:41 pm

Today I did a full path voltage loss measurement across all active components. With a USB 5.03V input and a load of around 490mA I measured a loss of 466.4mA across the voltage regulator path. I measured a loss of 355.6mA with the voltage regulator switched out.

Basically it comes down to I loose 58mV for every WS2011 (Dual P-MOSFET) and 6.4mV for the RU30L30 (single P-MOSFET). They worked out to have a resistance of around 120m Ohm and 13m Ohms respectively. This is quite below the datasheet maximum values. Here are some common types I use:

WST2011: RDS = 80-85m Ohm each @ 4.5V (dual MOSFET)
RU30L30: RDS = 20-34m Ohm @ 4.5V
AO3401: RDS = 53-60m Ohm @ 4.5V
EMF20B02V: RDS = 15-20m Ohm each @4.5V (dual MOSFET)


I spent some time this afternoon hunting around LCSC for some better dual P-MOSFETs and found the EMF20B02Y. This one looks great so I will buy a bunch of them and it comes in a very tiny 3mmx3mm package and is rated for 8.4A, so sounds very handy for other projects too. It means I will really reduce my voltage loss across the PCB. Talking of that, after comparing the measured voltage drop across the board, to adding up all the voltage drops across the components, I was missing around 40mV. I measured a few PCB power traces and found 20mV for half the length. The others where short traces, but I am sure they account for the missing 20mV or so.

Segway - Graph of the day:
MCP1827 Output.1sml.jpg
MCP1827 Output.1sml.jpg (17.78 KiB) Viewed 262 times

Above, is a graph of the ESP32 outputting binary 1 to 127 to the 100K ohm i2C digital resistor with no load. This is connected to the MCP1827 adjustable regulator, so the graph is comparing the 1 to 127 inputting to the resistor and the resultant voltage out of the regulator. I was unsure how this would turn out so I added a 0 ohm resistor in series with the digital one just in case it might be needed. To lessen the initial dip, I placed a 6.2K ohm resistor and with a 490mA load, this is the graph I get now:
MCP1827 Output.3sml.jpg
MCP1827 Output.3sml.jpg (22.39 KiB) Viewed 262 times

It looks a bit better. I think I can get rid of the initial dip all together with a 6.8K ohm resistor, but will do that on the next version as it's a pain to hot air off due to the regulator bodge leads on the PCB. I have started designing up the next version of the PCB, but I do want to have a go at trying to record a ESP32 dev board powering up and connecting to WiFi, so lots still to do.

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

Re: Adjustable USB Power Profiler Board

Post by parkview » Wed Jun 22, 2022 8:20 pm

Amongst everything else going on, I managed to get the (Now calling it) USB Power Profiler Board sent off to JLCPCB this morning. It ended up being a bit more complex than the V0.6 block diagram, so it should be interesting to see how it turns out. It would be great if it can measure down to the 10's of micro Amps, but that might be pushing things a bit.
USB Profiler V0.6_sml.jpg
USB Profiler V0.6_sml.jpg (90.67 KiB) Viewed 57 times

I don't have much in the way of calibrated test equipment, so I am not sure yet on how to actually test it properly. There are 19 odd zones on the board and each circuit has it's own 2mm WS2812 LED, so if nothing else, it will be very colourful when it's all lit up.

The Nordic Profiler II board seems to do automatic voltage adjustments and the MCU only has to read the switches to figure out the current flowing through it. In that regard, this board is dumb, in that the MCU will switch the different current sensors in and out, which is not ideal, but it is a good start for this version. The ADC128 sensor can do at least 40K SPS, so there will be a lot more data coming from this board. I ran out of GPIO, so there's no SD card on board. I am hoping to be able to stream the data to a computer via UDP packets.

Post Reply