Connecting Power Outlet to Arduino. is it possible and safe?

So im planning to do an IoT base project for myself but the major problem i see first is lack of source power. while a Li-On battery seems great choice, the problem is i dont thing it can very long. so the 2nd thing that comes to my mind is the laptop/pc as source but the problem is its not like i should open my computer 24hrs or aleast 12hrs without doing anything just to powe my arduino IoT device. the 3rd that come to my mind is the electrical outlet from our electricity. but electrical outlet(or socket) tends to have very high voltage(in my country i assume its 220V according from what i found). ive been using li-on battery or laptop since i started arduino but i never experience this type of idea of connecting the electrical outlet to arduino

so my question is, is it possible to connect the electrical outlet to my Arduino, like UNO, Mega2560 or ESP Nodecmu? (if possible if someone can link a video with me?)

Do you have access to AC to USB out adapter?

Find Similar for your location.

1 Like

hI I do think i can. so i just saw this link you saw. correct me if im wrong.
so if for example if i have this product. i can use my USB connect it to that device then connect it to arduino like using arduino usb cable that i use to connect from laptop to arduino? sorry im a bit beginner on this part since i heavily rely on li-on batteries ever since.

Hmmm. So how do you charge your Lithium-ion batteries?

i dont have Li-On Battery charger or similar to that

The wall adapter provides power to the Arduino the same as being plugged into a laptop. Once your programming is complete, power it up and let it run.

1 Like

follow up question: so i have adapter, the follow up question is, can you recommend me a Plug/USB Cable? i saw lot of USB cable in my shop so i cant easily choose…

What does your Arduino need? USB-B, USB-B Mini, USB-B Micro?
The adapter is just standard USB-A.

my Arduino is Uno R3 and my 2nd arduino is Mega 2560. it(Uno) has A/B but im planning to use the Jack Terminal instead of A/B USB Cable if convenient enough

Bad idea!

So you’re looking for a USB-A to 5.5mm outer/2.1m inner barrel plug cable?

The only problem with that is that the barrel jack goes thru a diode for reverse polarity protection and then the 5V regulator, so you can’t feed in 5V directly.
You could put a jumper across the 5V/VIN power header to bypass the regulator, and add a jumper on the bottom of the board from the back of the barrel jack to Vin to bypass the diode. Or from the barrel jack to 5V I suppose to bypass the diode and regulator with just one jumper.
You’d want to make sure to unplug the barrel jack when downloading code, many PCs don’t like having the USB 5V line powered from an external source; mine complains of a power surge and shuts down the USB port, requiring a PC restart to get it back.

1 Like

First of all, NEVER connect an Arduino directly to a wall socket. A standard electrical outlet can source 15 amps, so 220 volts with 15 amps available means 3300 watts.
Should your Arduino be connected to that much power, capacitors would explode, metal pieces would melt, and the whole thing could burst into flames.
So, don’t.

Instead, get a wall socket to USB converter (I’m not sure about other people, but I’ve always called them “bricks”).
These step down the power to a much safer level that both you and your Arduino will be happy with, and you can use the same one you use to charge your phone.
If you’re willing to spend a bit more money, you can get a USB power bank and connect it to the Arduino with a short USB cable.

1 Like

Already covered the wall adapter in Reply #2.

1 Like

DC power jack

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