Page 1 of 1

12V Relay Module for RCP

Posted: Thu Oct 01, 2015 3:06 pm
by rob_h
Just thought I would share this... I found a relay module that uses a 5V signal to drive a 10A 25V relay. I use this with the GPIO to drive the radiator fan based on temperature. Still working on the scripting but there are ton of things you can do with it.

I've confirmed it works great with the GPIO, the ground, and the 5V lines from the RCP and using 12V on the high amp/voltage side of the relay.

http://www.amazon.com/JBtek-Channel-Mod ... s=5V+relay

Posted: Mon Oct 19, 2015 5:47 pm
by brentp
That's great! A perfect use for the GPIO outputs on RaceCapture/Pro.

How's that radiator fan working for you? Note, we recently released v2.8.5 which will dramatically improve stability around Lua scripting.

Posted: Wed Jan 20, 2016 9:09 pm
by torkey
I am using the board linked to above and have a question. I am using this for a shift light. I have the script running to set GPIO(0,1) when the shift threshold is exceeded. I have tested the script with a multimeter attached and GPIO does change when the RPM threshold is exceeded. My issue is that when I connect GPIO(0,0) to the relay board, the relay immediately energizes and with GPIO(0,1) there is no change in the relay state.
The indicator light on the relay board on the channel is lit for GPIO(0,0) and is lit brighter with GPIO(0,1)
Any suggestions on how to fix this? Not really an electronics person and I am hoping this is something simple.

Posted: Wed Jan 20, 2016 9:19 pm
by brentp
Hi, The GPIO output will pull the output to ground when it is activated. You likely need a pull-up resistor (to 12v, or to 5v) to make sure when the GPIO output is inactive, the voltage swings away from ground voltage.

Posted: Wed Jan 20, 2016 9:56 pm
by torkey
It behaves the same with or without the pull up resistor. Anything else I could try?

Posted: Wed Jan 20, 2016 10:02 pm
by brentp
Are you verifying the voltage on the output swings between ground (when activated) and the pullup voltage (when not activated)?

If so, then there's a problem with the module you're connecting it to. I would check it's specs and ensure it's not defective.

Posted: Wed Jan 20, 2016 10:26 pm
by torkey
According to the description of the relay board it supports PIC ARM AVR DSP Arduino MSP430 TTL Logic. Is the RCP comparable with this type of device?

Posted: Thu Jan 21, 2016 12:45 am
by brentp
If you supply a 5v pullup, then the output signal is equivalent. The acid test is - when you activate / de-activate the output, you should be able to measure either 0v or 5v from the output.

Posted: Fri Jan 22, 2016 3:02 am
by torkey
The voltage at GPIO0 is 5VDC. when i connect it to the relay coil there is no response. When I connect the relay to the 5 VDC supply on RCP the relay responds. Is the problem that the GPIO can't drive the relay. It's a really small relay. 60ma coil.
Any suggestions?

Posted: Fri Jan 22, 2016 3:36 am
by brentp
The GPIO's are configured as open drains. Meaning, it's like a mechanical switch that closes a connection to ground.

When activated, The GPIO can sink up to 1A of current to ground. When inactive, it's an open circuit, like an open switch. Using a pull up resistor to 5v you'll get a 5v supply at the current the pullup resistor allows. Ohm's law says current is I = V/R http://www.dccwiki.com/Ohm's_Law

so, 5V / 1K ohm pullup = 5mA

Temporarily ignoring the relay module, you can wire up the pullup resistor and put a volt meter on the output, then you can inspect the voltage as you activate / deactivate the output.

In the Lua script, you can control the output as such: setGpio( <port>, <active> )

Note, you should ensure the GPIO configuration in the RCP config page sets the GPIO mode to 'output'. With the 5v pull-up wired, you shoud observe:

setGpio(0, 1)
-- you should measure 0v

setGpio(0, 0)
-- you should measure 5v


Sounds like this would be a good blog post / wiki how to!

Let us know what you find out from your experimentation / measurement.