Need 120v and Uno power source together

Hi:
I'm in need of taking the 120 wall source to a small box from which I can power a 120 volt load from the box through a 5v relay and also power my Arduino. I have a working scheme now but it is not at all compact. The Arduino Uno and the relay are outside of the power box. I'm plugging a charger into the power box and then using it to power the Arduino. I would really like to put inside a box such as a 6 x 6 x 3. I bought a very small converter that takes 120 to 5 v DC but all the literature says not to put the 5 v into the 5v pin on the Uno. I'm looking for suggestions on best way to do this. The two loads on the Uno are the 5 volt relay and a PIR HC-SR501.
Basically, I would like to know how best to package all of the components in a box with 120 into the box and a socket for 120 volt load coming out of the box.

Are you sure that you can make it safe ?
Perhaps you need a bigger box to make it safe.

This is the international English section of the forum. I assume that the 6 x 6 x 3 is the size, but what are they ? Centimeters, feet, nose length, micromiles or whatever :stuck_out_tongue_winking_eye:

Can you show a photo or give a link of that small converter ? It is probably not safe.
I used those things years ago, but one day I decided to get rid off all the power supplies that were not certified and not according to the safety rules.

Is that 5V charger from a well known brand ? Most of those "chargers" are normal 5V power supplies and can be used to power an Arduino board.

The Arduino board can be powered via the 5V pin or not, depending on who you ask.
There are two risks:

  • If a very strong 5V touches the 5V pin, then a large current peak can destroy the onboard voltage regulator with a reverse current. If you connect a 5V power supply to 5V (and GND to GND) and then turn on the power supply, that is no problem.
  • When a USB cable is connected, current from the 5V pin can flow into the computer.

When you put everything in the box, check that if a 120V wire comes lose, it can not touch the low voltage parts. Make two separate parts in the box, with or without divider.

The relay that you have is probably also not certified for 120V. Is it a module with a relay ? Then the module is probably not safe for 120V.

Conclusion: This is about safety. A working project would be nice, but that should not be your primary goal.

Since the OP is working with 120V then they're likely units of 2.54cm as the Americans still don't use sensible ISO/metric measurements. So 15.24cm x 15.24cm x 7.62cm.

Dougie, they are in inches. Basically it is the size of a junction box for 120v. It can be any size that is around that. Most Americans would agree with you about the sensible ISO/metric. Too bad our leaders don’t have enough courage to mandate the change.

Thanks for interest.

Bob

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

Use a cover for the box that is designed for a duplex outlet. Use a cable clamp to hold and protect the power cord going into the box.
An Arduino cannot power a relay, so you either need a MOSFET to control the power going to the relay, or a circuit board designed for controlling a relay.
Unless you enjoy repairing the components from time to time, do not use one of the cheap blue-box relays for 120 volts.
Are you planning to include a fuse/circuit breaker with your project, or are you depending on the house 20 amp circuit breaker to protect your project?
Paul

Hi Koepel:

The units are inches.

Here is the pic from AliExpress Ad.

DB5E0E69A07E4740B28294B098DB9F0E.pngS

I assume these size measurements are metric.

I’ve read the discussions on the use of 5v. It is definitely mixed.

Actually, the relay that I have can handle 220

I would put this in a back yard shed to turn light on as I entered.

Thanks for extensive comments. I learn much from those with experience.

Bob

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

Paul, I’ve used the Arduino Uno to power several projects with 120 v loads for a long time. One I have running in the garage now. Here is one like I’m using. It is controlled by the Digital Pins on the Arduino and the load is powered by 120. The relay contacts are simply controlled by the Uno.

Robert (Bob) C. Gillespie

904-540-7679

AC8DBE6F4ED546699B5AB94FF1C69990[27334984].png

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

This is your relay module: https://www.amazon.com/Excelity%C2%AE-Channel-Module-Arduino-Raspberry/dp/B01D4VFS6M/.

Those are not serious modules.

If you look at the backside of this one, then you see that the low voltage trace is too close to the high voltage trace.
At least they tried with this one, there is a gap in the pcb to isolate the mains from the low voltage. However, the clearance between the large ground area and the mains could be better.
This one seems to have a little more distance.

I marked the distance at the edge of the gap to show what I mean. That is a design flaw, they should have kept the low voltage ground area away from the gap:

That is just the module. The relay itself has written 10A on it, that could mean that it can switch 1A, if you are lucky.

This relay module of Waveshare is more like it. Look at the photo of the backside. They also claim to use good quality relays. However, that module is for the Raspberry Pi.

Please get rid of that cheap power supply. The sooner, the better.

"all the literature" is complete rubbish! :roll_eyes:

The point is this:

You have an ATmega328 microprocessor chip.

It is intended to run on 5 V. That is the design voltage, at least to use a 16 MHz clock which is what the UNO has. To use USB, it also has a USB interface chip which is - generally - designed to run on the USB voltage which is 5 V. That is 5 V OK? :smiley-eek:

I repeat my "stock" explanation to this question every time. The "Vin" - or "Barrel jack" on a UNO - is nothing more than a legacy "novelty" from the times ten or twenty years ago when 5 V switchmode power supplies were not common as they now are. It allowed you to use unregulated 9 V "plug packs" (US: "Wall warts") which were the common supply for computer "phone" modems and ADSL boxes which contained heat-sinked 7805 regulators. But the regulator on a tiny Nano or even the UNO board has minimal heat-sinking and is only suitable for simple demonstrations of the basic board and a few LEDs.

So you can simply forget the on-board regulator and "Vin" and when you have a nice regulated supply of 5 V - generally from a switchmode "buck" regulator - you want to convey it to where it is actually required - the "5V" pin and your other modules. :smiley-lol:

The only reservation is that you need to disconnect the "5V" pin when you connect the USB port on the UNO to a PC for programming or testing due to a potential problem feeding external 5 V into the PC USB port.

And speaking of practical Arduino versions, the UNO format is not useful for practical projects such as you cite as the form factor - with socket pins - is particularly inconvenient unless you have a matching "shield" which contains all the parts you want. A Nano is generically a good start or a Pro Mini with a USB adapter which can be disconnected after you have finished programming and no longer need to connect to a PC. The Pro Mini also avoids the current draw from the USB adapter.

A Nano does not have the problem with feeding external 5 V into the PC USB port.

Finally, and it is not clear in your description, if there will be no exposure of your 5 V system outside the box, then the use of less-than-well-designed modules (power supply and relays) is not a personal danger and probably reasonably acceptable. :woozy_face:

Listen to @Paul_B for he knows what he is talking about.


However, I will be sending him my Ativan to calm . . . :wink: .

2 Likes

On several occasions I have placed SS (Solid State) relays in a simple electrical box with a duplex receptacle. I placed a barrier between the relay and the duplex. The electronics were outside and a small wire connected to the relay. The arduino drives them easily as they only require a few mils so no driver circuitry. SS relays are not that expensive but you will have to shop a bit to find them.

Well, they are pretty easy to find on eBay and Aliexpress.

The difficulty is that we have reports that many of them are fakes - rubbish!

Hmmm, I haven't prescribed that stuff for years!

The problem with benzodiazepines is that they actually cause anxiety with chronic use. :roll_eyes:

Hi Paul:

Using an inline fuse on hot lead of the 120. I’ve found the blue-box relays to be reliable. I’ve had one that will turn on a garage light for a couple of years. It is basically the circuit I want now but packaged better.

Thanks for input.

Bob

Robert (Bob) C. Gillespie

904-540-7679

AC8DBE6F4ED546699B5AB94FF1C69990[27334984].png

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

Thanks gilshultz. Agree on all counts.

Bob

AC8DBE6F4ED546699B5AB94FF1C69990[27334984].png

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

Hi Paul:

I’ve just discovered the Nano and will try to use it from now on. It seems to be easier to work with for more permanent wiring. Will try the 5 volts when I have the sketch doing what I want it to do.

Bob

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)

Not sure what you are saying there, or how you are presently powering it! The point is that it will not do what you want it to do if it is not powered correctly. You most certainly do not want to attempt to feed 5 V into "Vin" as you will end up with only 3.5 V to run the UNO and whatever else. Powering via USB from a PC is generally OK to run just a couple of relays which require 90 mA each to actuate.

That is precisely the reason to use the Nano. :grin:

So that theoretical concern will never really be a problem even if you did "hot connect" a 5 V power supply as the capacitor on "Vin" of the UNO is too small to cause such a surge and that on the Nano, smaller again.

And if generally under-rated, not believing their "10A" rating, they probably are. It was the SSRs - Solid State Relays - that people have opened up and found to contain the wrong Triacs.

The whole idea is to be independent of the PC once the Uno is programmed. I’m powering it now through the PC. I want to dump the PC. I want to use an Uno, PIR HC-sr501, a 5v volt relay triggered by Uno digital pin, a 120 volt load running through the contacts of the relay.

"There is no such thing as spare time, no such thing as free time, no such

thing as down time. All we’ve got is this life time. Go. [Be]" — (H.L. Garfield)