Controlling Relays via USB?

I want to make a power strip that has outlets controlled by relays (some solid state and some mechanical) and I need the relays to be addressed/controlled by the Arduino.

I have seen USB relay boards but they are very expensive.

How can I do this with the Arduino?

The Arduino can switch most SSR's directly and can switch a small relay directly or a larger electro-mechanical relay with a small transistor.

How much power are you switching? Panasonic makes some 5V/20mA relays with 125V/10A contacts. These could be driven directly from the Arduino output pins. They are about $10 each.

johnwasser: The Arduino can switch most SSR's directly and can switch a small relay directly or a larger electro-mechanical relay with a small transistor.

How much power are you switching? Panasonic makes some 5V/20mA relays with 125V/10A contacts. These could be driven directly from the Arduino output pins. They are about $10 each.

I want to switch 120v/2A via the TRIAC SSR's and 120v/8A via the electro-mechanical relays.

The thing is, I would like to be able to add up to ~200 outlets to the system and daisy chain relay boxes. I figured using a USB bus would allow easy addition/subtraction of relay boxes as well as allowing naming/status checking of the relays.

Thank you for the advise.

The below light control setup is for a parallel port, but you could also use an arduino to operate the control box.

http://computerchristmas.com/christmas/link-how_to/HowToId-4/How_To_Build_A_Parallel_Port_Controller_Box

I've never tried to make a USB controller but I have the idea that each hub can only control 8 ports. Does the USB architecture scale up far enough to enable 200 ports to be controlled from a single USB host controller?

PeterH: I've never tried to make a USB controller but I have the idea that each hub can only control 8 ports. Does the USB architecture scale up far enough to enable 200 ports to be controlled from a single USB host controller?

Up to 127 devices, including USB hubs, can be controlled by a single USB host controller. I don't need 200 AC outlets exactly, that was just a rough number.

At 10 usb ports per hub, and each AC control box having 8 AC power outlets, if each AC control box housed a USB hub and 8 AC outlets as USB devices, that would allow 12 AC control boxes on a single USB host controller which would be plenty.

AC control box = 1 x 10 port usb hub + 8 x usb AC power outlets + 2 downstream USB ports = 10 usb devices 127 usb devices per host controller / 10 usb devices per outlet control box = 12.7 AC control boxes on a single usb controller.

USB can go down to 5 tiers deep so the first AC control box off of the host controller is tier 1 and because each AC control box has 2 downstream usb ports open, they can connect up to 2 more AC control boxes being tier 2 in a daisy chain architecture until the max of 5 tiers is reached.

Each AC control box plugs directly into the building's main so the 10 port USB hubs can be powered USB hubs so the max limitation of unpowered hubs is not a problem.

The theory is great but the question is how do I get the the USB host controller on the Arduino and how do I get the AC relays to behave as USB devices?

The theory is great but the question is how do I get the the USB host controller on the Arduino and how do I get the AC relays to behave as USB devices?

Generally speaking, you probably won't. It sounds like you think you can somehow bit-bang a USB connection for simple on/off control like a parallel port, or you are trying to build something that is way complicated for what you need to do.

http://en.wikipedia.org/wiki/USB

zoomkat: Generally speaking, you probably won't. It sounds like you think you can somehow bit-bang a USB connection for simple on/off control like a parallel port, or you are trying to build something that is way complicated for what you need to do.

http://en.wikipedia.org/wiki/USB

While I appreciate your trying to help, I am not overengineering for my purpose unless you know of another way to address over 100 relays on a single bus that is supported by the Arduino boards.

There are lots of USB relay boards that are being controlled by Arduino. Just youtube Arduino USB relays. The problem is that those USB relay boards are too expensive for my purpose.

I am looking for a less expensive way to add USB relays modularly.

I am familiar with the USB wiki, thanks.

There are lots of USB relay boards that are being controlled by Arduino. Just youtube Arduino USB relays.

Well, I put "Arduino USB relays" in the youtube search box and did not find any USB relays being controlled by an arduino. Didn't really expect to find any. :)

Hello, I've been looking at all kinds of relays in the low-cost arena. (That'd be Shenzhen, China..)

I haven't found anything lower-cost than these 8-relay boards: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156

Unless you need a lot of coordinated speed, you could either:

  • Use two Arduino Megas and get 96 channels of parallel I/O
  • Use a shift-register approach on a single Arduino

A HC595 shift register is often used. You can build your own modules, or buy something like these: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=59

If you want to physically distribute these a ways, you'll need a small 5V supply at each location to run the relay board.

Lots of relay info here: http://arduino-info.wikispaces.com/ArduinoPower

Let us know what you end up doing...

DISCLAIMER: Mentioned stuff from my own shop...

I found one that is even cheaper, only $12.50 shipped

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=110836428701

the spec says it take 15-20ma to drive the relay.

my question is, will the arduino UNO be able to drive all 8 channels high at the same time (so total 160ma) just by connecting the digital out pin without additional circuit? assuming my power supply has enough amps of course. is that fine with the atmega328 or is it too much to handle. the atmega328 spec says the digital out can drive 40ma, but I don't know if that means one pin at a time or it can drive all pins at 40ma simultaneously.

or is there a better way to turn on/off 8 outlets. I basically need an 8 outlet timer, that can turn on then off down to 1 second.

thanks jerry

No, it probably takes a lot less than 15-20ma…

Not sure about that relay board version, but the ones I have (that have almost identical layout) use this circuit (with my measured values):

DISCLAIMER: Mentioning stuff from my own shop… The relay boards I have are like these: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156

So these take (sink) 2 mA not 15 or 20…