Make an Arduino-controlled power outlet -and use the 120V to bias Arduino too...

Hi,
I hope I am posting in the correct section.

I want to make an Arduino-controlled power outlet using a relay, similar to the one shown here Turn Any Appliance into a Smart Device with an Arduino Controlled Power Outlet

In this tutorial, the Arduino needs its own bias, provided by the USB cable. In order to make a more compact solution, I'd like to use the 120 V bias to feed the Arduino too. Of course, I would need to reduce the voltage from 120 V to 12 V.

Do you have any advice on the best (and safest) way to proceed?

Lets begin by correcting the term "bias". Bias refers to a DC voltage that supplies little or no current. You are confusing that with the 5 volt DC required to power the Arduino and the relay.

I looked at the tutorial and the first thing I saw was the cable clamp for the AC cable is put in backwards. The clamp portion is a "strain relief" to keep the wires in the cord from breaking when the cable is flexed over and over from use.

The other thing is the relay is being POWERED by the Arduino 5 volt regulator. That is fine for the time needed to take the picture, but not for continuous use. The relay draws too much current. It needs it's own 5 volt supply.

So, to get what you want, you need to have a 5 volt DC supply for both the Arduino and the relay, and NOT use the breakout board as in the tutorial.

Think about using a second outlet box to house the extra stuff.

Paul

Hi Paul, thanks a lot for your answer.
Having a second box to host the Arduino and the relay would not be a problem. But I'm trying to avoid having two different electrical outlets plugged into the 120 V (one for the arduino+relay and the other for the appliance).
So, I would like to have a situation in which the 120V from a single outlet is used to (1) supply the appliance (through the switch in the relay) and (2) to power the Arduino and the relay, after being properly "reduced". What I'm trying to understand is what is the best and safest way to do this last step.

I found something similar to what I have in mind in this tutorial Building an IoT power switch with the ESP8266 (and control it with your Amazon Echo!) | by w4ilun | Medium
Here they use an ESP8266 instead of an Arduino, and therefore they need to reduce the 120 V to 3.3V.

What do you think? Is it a reliable solution?

If you ONLY need a single outlet, break off the tabs joining the two outlets and have the relay control only one outlet. Power the remaining outlet with the AC from the cord. Plug in a 5 volt wall wart(power supply) into the HOT outlet and let that power the Arduino and relay.

Paul

If you ONLY need a single outlet, break off the tabs joining the two outlets and have the relay control only one outlet. Power the remaining outlet with the AC from the cord. Plug in a 5 volt wall wart(power supply) into the HOT outlet and let that power the Arduino and relay.

Good idea but you should only remove the tab on the hot side (black wire). Don’t break the netural (white wire), you’ll only need to reconnect with a wire which will consume possibly needed space in the box. The netural wire should not be switched in a 120v circuit, only the hot wire is opened/switched.

This is only valid for US style NEMA5-15 type outlets.