Supply power to Arduino and receptacle using mains

I am working on a project consisting of developing a Bluetooth controlled power outlet using an Arduino Uno microcontroller, and have attached my current wiring.

Preface:

  • I understand that switching neutral is unsafe - I will change the hot to switch instead.
  • The Arduino Uno is reset.
  • I am connecting 14 gauge with 28 gauge wires using electrical tape
  • Both relay channels are wired to normally open.

Upon plugging into a power outlet, both the Arduino and 2-channel 5V relay start randomly flickering.

After a moment, either one of the LED's on the relay is solid or both LED's are solid. There is also a case where one or both LED's are flickering when physically moving the components around.

I am wondering if the issue may be caused due to improper wiring connections.

Do there appear to be any issues within the wiring in the diagram?

Thanks in advance for the help!

Please explain how you think this circuit will work. The relay function is not clear. A hand drawn schematic, with clearly labeled connections and conventional symbols would be much more useful.

What does the transformer do? You certainly cannot power the Arduino with AC.

There is also a case where one or both LED's are flickering when physically moving the components around.

NEVER change connections in a powered circuit. Loose connections can instantly destroy electronics.

Your pictorial diagram shows a green connection
to the transformer: that is wrong! A load must be
connected between the Black and the
White wires. The Green is safety ground.
Herb

jremington:
Please explain how you think this circuit will work. The relay function is not clear. A hand drawn schematic, with clearly labeled connections and conventional symbols would be much more useful.

What does the transformer do? You certainly cannot power the Arduino with AC.

NEVER change connections in a powered circuit. Loose connections can instantly destroy electronics.

The transformer is an AC/DC phone charger repurposed for this project. It takes 110VAC input and produces 4.7VDC output which powers the Arduino Uno.

To clarify, no connections are changed while powering the circuit. For example, picking up the Arduino and putting it back down sometimes causes flickering of LED's on various components (Arduino, relay, transformer).

herbschwarz:
Your pictorial diagram shows a green connection
to the transformer: that is wrong! A load must be
connected between the Black and the
White wires. The Green is safety ground.
Herb

There was a mistake in the diagram originally attached. The actual circuit has Mains hot and neutral connected to the transformer, and output connecting to 5V and GND on the Arduino.

Please see the attached the updated wiring schematic.

Switching the neutral is remarkably dangerous. The way you have it wired, the Arduino, Bluetooth board and relay board do nothing. Here is your effective circuit:

Anything that is plugged into the outlet is immediately powered. If it's a piece of machinery, you could injure someone if the equipment turns on as soon as you plug it in.

Here's why. the NEC (National Electric Code) requires the earth ground (green) and the neutral (white) to be connected together in the main service entrance (breaker box).

Here is the proper way to wire the relay to switch the line (black wires).

SteveMann:
Switching the neutral is remarkably dangerous. The way you have it wired, the Arduino, Bluetooth board and relay board do nothing.

Here is the proper way to wire the relay to switch the line (black wires).

I have changed the wiring for hot to switch instead of neutral, matching your diagram.

Additionally I have replaced the Arduino Uno with a brand new one which seems to have resolved the inconsistent flickering of various components.

However, after updating the wiring, replacing the Arduino Uno and uploading code to the Arduino, the relay clicks on and off when Arduino writes high to the relay input.

When testing the Arduino and relay alone, the relay functions as expected, clicking on until receiving a low input.

I understand that switching neutral is unsafe - I will change the hot to switch instead.

True but don't assume that switching the live is safe. Mains is not safe and you can't assume that the wire you think is neutral really is neutral and the wire you think is live really is live. Maybe they got mis-wired somewhere. Assume from a safety point of view that any wire connected directly or indirectly to the mains is live.

@cmpscimjr
TOPIC MERGED.

Continued cross posting could result in a time out from the forum

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum.

And while you are at it, you will need to re-adjust the links to the images in each of your posts as the post number in that link has been moved to the previous thread when they were merged.

Not too difficult. :grinning: