The PiOT Relay Board for the Raspberry Pi

The ModMyPi PiOT Relay BoardThe ModMyPi PiOT Relay Board

I’ve been playing with the new ModMyPi PiOT Relay Board over the last few days, and as you’ll guess from the name, it includes relays.

Relays allow you to switch (turn on/off) higher voltages than the device you’re using. I use the Raspberry Pi for example, which offers 5V at the very most. But what if I wanted to use my Pi to turn on/off a 20V motor or another device higher than its limit? That’s where relays come in.

But what kind of voltages can you safely tinker with? For amateurs like us, certain sources say up to 50V is fine, and ideally won’t cause us to be the guy laying down at a funeral.

I’m not really up for testing that out on my own body, but it did raise a good point – despite some products being rated at 240V or higher, you really REALLY don’t want to go there.

Let me explain in this post…

HEAVY DISCLAIMER: I am not an engineer. I’m not an electrician. I’m an uninteresting office boy with a craving for low-cost electronics. I’m learning just like the rest of you. If you fry/BBQ/kill yourself messing around with relays or any other electronics – I am not responsible. If in doubt, blame the Labour party.

The PiOT Relay Board

First, let me show you around my new toy this week – the PiOT relay board from ModMyPi.

This unconventionally shaped add-on board for the Pi is designed to take the hassle away from using these little clicking boxes of fun. The large shape and header position holds a Pi Zero very well, but for other Pis it’s a tad clunky. Where possible, I personally prefer the HAT format:

PiOT relay board front

The front of the PiOT relay board

Ignoring the layout, the PiOT relay board is quite a smart little chap.

The 4 relays are connected to the Pi through the clever use of a PIC micro-controller. The PIC is the brain behind all the annoying stuff you just don’t want to waste your precious time with as a weekend coding warrior – voltage dividers, transistors, diodes, wires, jumpers and more.

Relay board PIC

Look – a quick slick pic of a PIC!

You’ll also notice a 7-segment display at the front, and some buttons next to each relay. This is what you use to set the GPIO pin for each relay, and because of the clever PIC business, you don’t have to fumble about with jumper wires to do this.

It’s certainly a lot simpler than it looks. I was originally a bit tentative as I hadn’t used relays previously, and all the display/PIC/button business looked a bit beyond me – but it’s super simple once you’ve spent 3 minutes reading the guide.

Relay board control buttons

Menu control buttons next to each relay. These are not to be used once wires are connected!

Setup

This is another handy board that requires almost no setup. Most of that is covered by the pre-configured PIC controller, meaning all you have to do is plug your wires, tie the GPIOs to the relays using the buttons, and then simply set GPIOs high or low to switch the relays.

If you want fancy on-screen button controls, ModMyPi have made a Tkinter GUI for the board as well.

How A Relay Works

Seeing 3 terminals for each relay confused me, so let me explain it.

Firstly, all the relay is doing is ‘making or breaking’ your circuit. If you had a simple LED circuit, you’d chop the 5v line and chuck the 2 chopped ends into the relay. That’s all you’re doing here, so don’t let it confuse you.

Secondly, you’re only wiring into 2 of these terminals at any one time, and you always put one wire in the ‘COM’ (common) terminal.

You then have to decide where to put the other wire – in the NC (Normally Closed) or NO (Normally Open) terminal:

  • NO – Normally Open – this means when the relay is off, the circuit is broken and your device is off too. This feels like the safer option to me.
  • NC – Normally Closed – this means the connection is usually on/connected even when the relay is off, and is only broken when you turn the relay on.

Here you can see me using the NC terminals, which I quickly changed afterwards to NO – I didn’t want things to be turning on from boot without me saying so!

Dangerous First Run

Let’s cut to the chase – check out this tweet I posted after setting up my PiOT:

What followed was a lot of concern from the more qualified members of the community. Electricians, engineers and the odd troll weighed-in to inform me that I was putting my life at risk.

My response? “But the relays are rated to 240V 10A?” – pity me, the almost-dead fool.

Here’s the deal. Whilst the relays are rated that high, and whilst it did work, it seems most professionals would advise us regular folk to keep any ‘maker’ voltages below 50V (and some will say lower than that) – relays or no relays.

We made a new term today – ‘Maker Voltages”. Maybe it’ll catch on and save some lives.

Pi Drill project

It was a cool project until I realised its potential to stop me seeing retirement!

Relays vs Mains

Looking at relay boards specifically, the advice I’ve seen suggests that, to work with relays at high ‘mains’ voltages, you should take a number of measures including:

  • Having the relays on a completely separate board to the low voltage controller
  • Keeping the separate relay board away from the low voltage controller
  • Relays being fixed to a proper ‘relay base’ (I’m guessing this is a type of PCB?)
  • Wires from the low voltage controller to the relay board being mains rated
  • …being qualified and knowing what you’re doing!

So Avoid Relays?

No. Relays are cool. Really cool.

I think the problem here is taking the ratings for face value. Yes the relays are rated to 240V, but in this specific board, used with these specific components in this specific layout – don’t even think about it.

The fact that they’re rated high means they’ll perform well with whatever ‘maker’ voltages you want to throw at them, but keep away from the mains my friends – it just ain’t worth it! Even taking the board out of the equation still means that you’re fiddling with bare wires that, with one mistake, could send you across the room.

Relay

The relays are rated for mains power, but that doesn’t mean you should start fiddling with 240V wires.

What About Transistors?

Whilst writing this I thought “Don’t transistors do the same thing?”. I hadn’t used a transistor before so I did some reading.

I understand that transistors can be used to do the same job (switching higher voltages), but from my limited research here’s why you may want to use a relay over a transistor:

  • Relays (generally) can switch higher currents
  • Relays isolate the controlling circuit and the load (transistors can do, but often don’t)
  • Relays can switch AC or DC, and can be activated by both too
  • They have that lovely little ‘click’ that gives you an indication of what’s going on
  • Relays are generally more robust

Summary

Despite nearly ending up like the big fish in Jaws 2, I’m actually a big fan of the PiOT relay board.

The shape and size isn’t my personal taste, and the guide could do more to deter us average folk from any temptation to chew on mains power cables, but looking past that – it’s really neat.

Setup is a 3 minute job, there aren’t any libraries or software to worry about and all the annoying fiddly parts have been taken care of.

Now that I have my sights on lower voltage devices to switch, I think this is going to end up on my Raspberry Pi media centre – turning my noisy external hard drive on or off via my phone. I’ll post that project shortly.

I’d love to hear your thoughts on the subject. Perhaps you’re qualified in this field? Maybe you’ve got a great idea for a use for this board? Add a comment and join the discussion.

Until next time…

4 Comments on "The PiOT Relay Board for the Raspberry Pi"

  1. Great post! .. Glad to see your still with us! .. lol .. Battery power Christmas LED lighting will never be the same again! … Regards Pete

  2. Suggestion for anyone trying to control higher voltages and loads like house current.
    Use this relay board to control 12 or 24 volt DC circuits (w/fuses) and then run those wires to a 2nd set of relays in an enclosure.
    Follow local code or get an electrician to install the 2nd enclosure/relays/wires and protection.

    This will keep you and your project away from dangerous voltages and currents.
    This setup is used in most people’s houses already for doorbells and thermostats.

    Note: Most of the relays we use to control 120Vac or 240Vac house circuits are rated 600+Vac.

  3. I havent looked at the PiOT relay board yet but I think that the board may be safer than has been suggested to you. ModMyPi haven’t shared any photos of the bottom of the board but if there is suitable segregation between the tracks then board may be safe for mains voltages. The terminal block looks similar to a 16A 300V rated one so may be safe (appearance is no guarantee).

    General electrical advice is that non electricians shouldn’t work on mains voltages and that is for very good safety reasons.

    Bare wires at mains voltages anywhere that you could come into contact with them is indeed a bad idea, they should be well out of reach of fingers.
    strain relief should be applied so that a tug on the cable wont pull the wire out of the connector block.

    Relay bases are specifically made for different types of relay, they have screw terminations and are designed to be fixed into various types of enclosure.
    http://uk.rs-online.com/web/p/relay-sockets/4009130/

  4. Thanks for this post. I love reading them.
    This board looks very interesting, although I don’t think I have a use for one….yet!

Leave a comment

Your email address will not be published.


*