Lipo 1s charger with only arduino

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.

batata004:
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.

They have a special name for a LiPo charger that doesn't worry about those sort of things. It's called a bomb. LiPo's are dangerous. They pack a ton of energy into a very small space. You have to treat them right.

Don't start a fire. Buy a decent LiPo charging circuit.

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:
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.

So you're saying that we should help you blow yourself up? Yes, I read what you wrote. No, what you want to do will not work. Do the math to figure out how long it would take to charge that battery, even if you could do it safely it still wouldn't work at that current level.

I'm sorry your idea won't work. I promise that if it would I would help you do it. I'm not picking on you or criticizing just to criticize. It's not a bad forum, it really is a very stupid idea. You should abandon it now before you get yourself or someone else hurt. If you don't know enough about LiPo batteries to understand this, then you have absolutely no business trying to build a charging circuit for one. If you don't do it right they WILL explode. Sometimes they explode even when you do it right.

Would you rather I had come and said, "Yeah, it's all good. Hook it up and let it go" and then just laughed at you when your Arduino fried pins and your battery exploded?

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.

Massive red flags in the sums too.

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.

batata004:
Stupid people should not last long; plain and simple natural selection.

Oh, well in that case go ahead and build your charger. Just be sure to send videos of the aftermath so we can submit you for a Darwin award.

Your question wasn't about Arduino's reliability. It's perfectly reliable. Your question was whether it was safe to charge a LiPo while not worrying about current. That is definitely NOT safe. It's also probably not a very good idea to pulse current at it like that. There's a lot more to charging a LiPo that just banging it with some unknown current and checking the voltage every so often.

And stop saying that people are talking non-sense. Everyone here is giving you good advice. This is dangerous and likely wouldn't work anyway. You're the only one talking non-sense thinking that just because Arduino can fly a drone it can do anything. Sure, you can make a LiPo charger out of an Arduino. It's been done many times over, though you'd likely come out cheaper by buying a dedicated purpose-built IC for it. But it requires a lot more than just a resistor and blindly blinking a pin every so often.