5V USB charged with logging

Hello,

Can anyone help with choosing of Arduino/ESP32 modules for a simply&fast build an automated 5V USB charger with data logging similar to USB-testers like cheap china models:
https://aliexpress.ru/item/32908988203.html
https://aliexpress.ru/item/32908988203.html

Charger project specs is:

  • USB-A port;
  • stable 5V output;
  • up to 3A or even better 5A;
  • nice to have a QC4.0, PD3.0, etc protocols support, but its not very important;
  • logging to SD of A, V, charging time, with overall calculation of Ah and Wh;
  • auto on&off control by Arduino/ESP32.

(I already have all secondary needed modules as: SD+Clock+Display+Keyboard.)

I know that Arduino/ESP32 can NOT handle such power through themselves, so it must be a power module which controlled by Arduino, but have it’s own more high-A power line&supply.

Do you know any prepared modules which can help to make this project faster?

Why do You want to build Your own stuff instead of using commercially available stuff available at reasonably low costs?

hey,

you might want to read this:

and for switching the power you can use a simple MOSFET lik the IRL520NPBF of anything similar...
...but how do you want to detect if there is a Device is hooked up?

Measuring "this and that" is always interesting. I don't see the point in charging batteries, which is really a demanding task. What's wrong wit existing stuff?

So the task is to detect whether a load is connected to the batteri or not? Correct?

johannes_kunder:
hey,
you might want to read this:
https://www.hackster.io/Adam-Redfern/use-an-arduino-to-measure-voltage-current-resistance-81e5f5
and for switching the power you can use a simple MOSFET lik the IRL520NPBF of anything similar...
...but how do you want to detect if there is a Device is hooked up?

Thanks for the link and suggestion!

Railroader:
Why do You want to build Your own stuff instead of using commercially available stuff available at reasonably low costs?

Do you know any "such stuff" which can start charging on Arduino/ESP32 command and log all data (A,V,time,Ah,Wh) to the file?

I want to firstly connect USB cable to the device, then run some test by Arduino/ESP32, then recharge testing device, then make new tests, etc cycle-by-cycle. So this charge have 2 purposes: a) log charging data into the file; b) automate cycles charge-discharge with testing automation.

In order to awoid the battory charging theory I suggest that You controll the input to the charger and let the charger do the fine work with the battory.

What kind of test do you want to do with your testing device?

And do you need a real time or is the clock of the arduino enough?

My approach would be to just add the current to an unsigned long everytime the code loops.
At the same time ad 1 to another unsigned long to count the times the code repeated and the time difference to a third unsigned long

So you could calculate the average current by deviding the first long with the second and than calculate the Ah by multiplying the result with the third long...

... Don't know if it works, so you would have to try it out...

You could calculate the average voltage exactly like the current and than just multiply the Ah with V to get Wh

Ad be careful with milliseconds and hours...
... I didn't took care of this in my explanation!

Railroader:
In order to awoid the battory charging theory I suggest that You controll the input to the charger and let the charger do the fine work with the battory.

It will not give a full charging data log.

johannes_kunder:
What kind of test do you want to do with your testing device?

And do you need a real time or is the clock of the arduino enough?

My approach would be to just add the current to an unsigned long everytime the code loops.
At the same time ad 1 to another unsigned long to count the times the code repeated and the time difference to a third unsigned long

So you could calculate the average current by deviding the first long with the second and than calculate the Ah by multiplying the result with the third long...

... Don't know if it works, so you would have to try it out...

All logical algorithms are easy for me.

I ask to recommend the exactly HARDWARE modules and elements which can help with this task!

Can anyone suggest HARDWARE modules which can help to implement this task?

brov:
It will not give a full charging data log.

Why not? You can start the charging process by switching on or off the power to the charger. Measuring the output of the charger, voltage and current can be logged.

All logical algorithms are easy for me.

I don’t tell about controller algorithms for measuring, data logging etc. I think about how to charge batteries the best way.

I ask to recommend the exactly HARDWARE modules and elements which can help with this task!

Plug and play is of course nice but You need to specify Your project a bit better.

OK. For the beginning I can skip a custom Arduino-controlled power supply creating and use any appropriate USB power supply. Thus I must add only an "Arduino power delivery tap" with data logging similar to simple china USB-testers.
Can you help to make it hardware, please?

BTW maybe it's possible to just take data for logging and switch on/off power delivery from such cheap china USB-testers?
https://aliexpress.ru/item/32812735435.html

First link with ACS712 gives a very inaccurate measurement and outdated.

Seems everyone here doesn't have enough experience at this area because answer to my question is extremely simple.

I found the next solution based on already widely sale Arduino modules:

The last questions which I have:
A) What is the max A of measurement power which INA226 can handle? Will it work with 5V5A and 12V2A or such power can burn it down? Can't find this info at datasheet: https://www.ti.com/lit/ds/symlink/ina226.pdf
B) If charging device support USB PowerDelivery 4-lines - can I use 1MOSFET with 1Analyzer by merge 4-lines into 1, or I must use 4MOSFETs with 4Analyzers - 1 per each USB PD line?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.