Newbie how to turn a SPDT Relay(30A) on and off connected to a beaglebone green

73 views
Skip to first unread message

niv...@gmail.com

unread,
Aug 23, 2016, 5:18:54 AM8/23/16
to BeagleBoard
When I got my new bbgw I ran an internet search to find how to use the relay and did not find an easy answer, so here goes:
1. The Grove - SPDT Relay(30A) - uses +5V , so you need to solder the third pin of that groove connector. Disconnect it from the board, and connect it to the input 5v power.
The groove connector pinout are:

J4
1- I2C2_SCL - P9_19
2- I2C2_SDA - P9_20
3- VDD 3.3
4- GND

J5
1- UART2_RXD - P9_22
2- UART2_TXD - P9_21
3- VDD 3.3
4- GND

The pinout of the relay is:
1- Signal
2- not connected
3- +5V
4- GND

If you connect the relay to J4 use this python code, to toggle it on and off
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO
.setup("P9_19", GPIO.OUT)
while True:
    GPIO
.output("P9_19", GPIO.HIGH)
   
time.sleep(0.5)
    GPIO
.output("P9_19", GPIO.LOW)
   
time.sleep(0.5)


Przemek Klosowski

unread,
Aug 24, 2016, 10:24:13 PM8/24/16
to beagl...@googlegroups.com
On Tue, Aug 23, 2016 at 5:18 AM, <niv...@gmail.com> wrote:

When I got my new bbgw I ran an internet search to find how to use the relay and did not find an easy answer, so here goes:
1. The Grove - SPDT Relay(30A) - uses +5V , so you need to solder the third pin of that groove connector. Disconnect it from the board, and connect it to the input 5v power.

It seems that your relay requires nominal 5V coil voltage and 185mA coil current. This is far beyond what a BBB pin can provide: they put out 3.3V and barely above 10mA. Additionally, switching the coil on and off generates inductive spikes that are likely to damage the BBB output circuits. You need some sort of coil driver; I suggest buying something, e.g one of http://blog.machinekit.io/p/hardware-capes.html, or building your own circuit like this one http://i.stack.imgur.com/OhY9d.png

John Syne

unread,
Aug 25, 2016, 1:51:16 AM8/25/16
to beagl...@googlegroups.com
This image is incomplete. You still need a diode across the relay coil or the transistor collector will see a much higher potential than the supply rail. 

Regards,
John

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgFMYszu7ETm7KWi6UvcvzRZFXE5Z2dsy3Bt2wf2tB2ROA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Mark Lazarewicz

unread,
Aug 25, 2016, 3:23:41 AM8/25/16
to beagl...@googlegroups.com
John your feedback is always uesefull how refreshing


From: John Syne <john...@gmail.com>
To: beagl...@googlegroups.com
Sent: Thursday, August 25, 2016 12:51 AM
Subject: Re: [beagleboard] Newbie how to turn a SPDT Relay(30A) on and off connected to a beaglebone green

niv...@gmail.com

unread,
Aug 25, 2016, 7:12:06 AM8/25/16
to BeagleBoard, niv...@gmail.com
small updates:
1. The Grove - SPDT Relay(30A) - uses +5V. So for each groove socket used, you need to solder the third pin, to disconnect it from the board, and connect it to the input 5v power. +5V is at  P9_7 or P9_8.
The groove connector pinout are:

J4 marked as I2C

1- I2C2_SCL - P9_19
2- I2C2_SDA - P9_20
3- VDD 3.3
4- GND

J5 - marked as UART

1- UART2_RXD - P9_22
2- UART2_TXD - P9_21
3- VDD 3.3
4- GND

The pinout of the relay is:
1- Signal
2- not connected
3- +5V
4- GND

If you connect the relay to J4 use this python code, to toggle it on and off
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO
.setup("P9_19", GPIO.OUT)
while True:
    GPIO
.output("P9_19", GPIO.HIGH)
   
time.sleep(0.5)
    GPIO
.output("P9_19", GPIO.LOW)
   
time.sleep(0.5)

The relay kit from seeed, has a buffer transistor and a protection diode. So if you use +5V the relay will turn on.
Reply all
Reply to author
Forward
0 new messages