I already googled a lot and there are PLENTY of ways to charge a 1s lipo battery and most of them are veeery cheap. I got it. But I would like to use arduino to do so because I already have it embeded in a project and cannot add any other thing.
My question is this: I know arduino pins should consume no more than 50ma (more than this and it may be damaged). So I was wondering: can I use an analog pin as OUTPUT and set as HIGH for 10 seconds so it outputs 50ma to my lipo battery (connected to this analog pin). After 10 seconds I set the analog pin as INPUT and read the voltage. If the voltage is below 4.2 keep charging. After it finishes stop charging.
I know I will have to use a resistor to limit the current in the analog pin. U = R x I. So 5v = R x 0.5. This results in R = 10 ohm. So if I plug a 10 ohm resistor in this analog pin will I be safe?
One final question: if I need to have 200ma of current flowing to the battery, can I use 4 digital pins (each one with its own resistor 10ohm) in parallel to charge the battery?
As I said I cant add a MOSFET or any other thing, I can only use arduino tha is already embeded in the project (arduino nano).
I knoww there are many particularities of lipo chargers like keeping a constant current and such. I dont need a complete 1s charger solution, I just need something simple.
Ok, you didnt read what I said. If I were to come here and listen you say non=senses I should have done it myself. This forum is every month even worse, people here just want to critize, they dont read what people think and only say the obvious.
batata004:
I know I will have to use a resistor to limit the current in the analog pin. U = R x I. So 5v = R x 0.5. This results in R = 10 ohm. So if I plug a 10 ohm resistor in this analog pin will I be safe?
No you wont be safe, as you clearly do not seem to understand how LiPo chargers work.
@delta_G I am gonna be charging a small rc plane battery which is 150mah. I did the math, it will take 3 hours to charge it using a single digital arduino pin OR less than an hour if I can use 4 digital pins in parallel (as I said in the question). I know lipo explode, I never exploded one myself but I already puffed 2 batteries of 1200mah even charging them right and taking lots of care. I know these things are dangerous and I would never make a question like these, that other idiot people may see and try to follow, if I think this idea had no point.
THIS CAN WORK for small batteries. Arduino is reliable enough so it can compare the voltage of the battery and keep charging it. Arduino is not a "brick", it's smart and for such a simple task it should do a nice job. I EVEN USED arduino in a quadcopter that I built myself, so I can assure you arduino is reliable enought to charge a battery.
I wouldnt like you to come here and say "Sure, it will work". I would like you to come here and not just tell me what I already know about lipo safety. I know, believe me. I am just asking if this would be possible in a safe way since ARDUINO IS RELIABLE, arduino can provide the 50ma current that I need and arduino has a very good voltage comparator inside so it may very well check the voltage of the battery and check if it's already charged or not. What could go wrong with this really simple setup? One single resistor connected to an analog pin, one single external component that may fail... what are the odds?
OF COUSE I TRUST you guys much more than me cause I still consider myself an arduino beginner. But I cant see how this project would fail, you just point nonsense stuff without saying what is the bottleneck and how we can find out it together. LOTS OF PEOPLE use arduino to make drones, if I cannot even charge a freaking battery with arduino why bother making drones where you have to precisely control timing of ESCs, use PID algorithm to control the drone, use watchdog as failsafe, use solid wireless link communication... ARDUIO IS CAPABLE OF THESE THINGS!!! Why not charging a single cell pbattery with a single analog pin?
It's just one of those areas where, if you have to ask, the answer is no. Look at the last sentence of your original post. That is a huge red flag right there.
Its a charger, the implication being that the battery could be flat, perhaps someone would even be idiot enough to attach a completly flat battery.
So the pin that is supposed to be high could be grounded through a 10ohm resistor, this will severly overload the pin, and you have to pray that it does not fail with it fried to 5v, never assume a pin will fail in a 'safe' way.
So now we have the battery connected to 5V direct, accepting all the current the supply can manage, not good.