Protonerd / FX-SaberOS

System code for Arduino based Lightsaber replicas for DIYino family boards
Creative Commons Zero v1.0 Universal
91 stars 42 forks source link

In-Hilt Recharge Config Question. #77

Closed NobAkimoto closed 4 years ago

NobAkimoto commented 5 years ago

So I'm working with a homebrew configuration, and I want to simplify charging because it's meant for someone who isn't technically inclined and if I can get it rechargeable without requiring hilt disassembly that would be the ideal.

I have a TP4056 based Li-Ion charging board + microUSB port I plan to use as the charging port, but if I'm understanding the various discussions on the subject, you want to cut the current to the Arduino when you're in the middle of charging.

So I was hoping to be use wire the charger, battery, and load in parallel, stick the mosfet's source as the battery, drain as the load with the gate being wired to the charging board's battery-out. The idea was that when the USB charging cable was plugged in it'd supply voltage to the gate, turning the mosfet off and cutting the connection between battery and the arduino/pixels.

Is there anything wrong with this theory? I had a test setup done, but I couldn't get the mosfet to turn off.

Protonerd commented 5 years ago

I used something similar in the Stardust V2 boards, that was the Tb transistor, a p-channel mosfet, cutting power to the board if the USB was plugged in. In theory it should work. I do not mount that transistor any more as the Stardust boards only draw ~300UA in deep sleep, so you can charge while the load is still connected.

Of course you might need a pull-down to GND from the mosfet gate. And it has to be a p-channel mosfet, with the right Vth (~-1.5 to -2V max, i.e. logic level).

You can also consider something similar, but a p-mos controlled by a digital signal of the Atmega328p, cutting power to the DFPlayer and the MPU when in sleep mode. That is the method used on all Stardust boards to reach the quiescent current target.