Standing Desk: Wiring 6 relays to 2 GPIO pins

A comment on a video about my desk recently asked,

I’d like to know how you wired up everything (the pi to the relayboard) using 2 GPIO pins. Could you please take a picture and upload it to your blog?

Good question, Jake.  Here’s a picture.

wiring-numbered

 

But that’s not too clear, let’s break it down.

  1. This gray band connects the RPi to the breadboard to make it easy to make multiple connections.  But you can connect directly from the pins to the breadboard; just make sure you bring power and ground as well.  And you’ll beed male/female connecting wires to make the connection.
  2. Connect the 5v power (red wire above) and ground (black wire above) to the power/gnd pins on the relay.
  3. The breadboard lets us connect multiple wires to a single pin.  When that pin is ‘on’ all three connected wires are signaled.  In the picture above, the 3 green wires on one pin; the 3 blue wires are connected to a second pin.
  4. The green and blue wires are connected to the relays in alternating pairs.  Each one turns on one relay when signaled, so each time the pin on the RPi is on it triggers 3 relays in my case (one for each actuator in my desk).
  5. For each of my actuators I use two relays.  This allows the signal to be reversed by flipping which switch is on, thereby telling the actuator to extend or contract.

So, after all this, the code to extend, retract, and stop is easy!

comments

Good luck!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s