Author Topic: RFD22131 - RFduino Relay Shield - Schematics and PCB  (Read 9613 times)

mrFAMtastic

  • RFduino Team
  • *****
  • Posts: 11
  • Karma: +0/-0
    • View Profile
RFD22131 - RFduino Relay Shield - Schematics and PCB
« on: October 25, 2013, 05:36:41 PM »
Hi Everyone,
Here is the Schematics and PCB files for the RFD22131 Relay Shield!

thenecroscope

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #1 on: December 27, 2013, 01:55:29 PM »
hi there,

im new to the forum. im looking to purchase an rfdunio soon, i was just interested to see if there is a way I get the rfduino to work with a 240v relay?

many thanks
steve

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #2 on: March 07, 2014, 09:51:20 AM »
Hi, sure you could. I would suggest using the relays on the relay shield to switch on a larger 240v relay. Be careful working with mains voltages  :)

artandmath

  • RFduino Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #3 on: March 20, 2014, 03:48:18 AM »
Hi - I'm trying to get the relay module to work. The relays are not switching when I send the rfduino data.

Any help would be much appreciated.

Thankyou

Here's my sketch

Code: [Select]
/*
The sketch is an empty template for Bluetooth Low Energy 4.
Simply remove what you dont need, and fill in the rest.
*/

#include <RFduinoBLE.h>

int relayA = 0;
int relayB = 1;

void setup()
{
  //RFduinoBLE.deviceName = "RFduino";
  RFduinoBLE.advertisementData = "relay";
  //RFduinoBLE.advertisementInterval = MILLISECONDS(300);
  //RFduinoBLE.txPowerLevel = -20;  // (-20dbM to +4 dBm)

  // start the BLE stack
  RFduinoBLE.begin();
}

void loop()
{
  // switch to lower power mode
  RFduino_ULPDelay(INFINITE);

  // to send one char
  // RFduinoBLE.send((char)temp);

  // to send multiple chars
  // RFduinBLE.send(&data, len);
}


void RFduinoBLE_onDisconnect()
{
    // don't leave the relay on if they disconnect
    digitalWrite(relayA, LOW);
    digitalWrite(relayB, LOW);
}


void RFduinoBLE_onReceive(char *data, int len)
{
  // if the first byte is 0x01 / on / true
  if (data[0])
  {
    digitalWrite(relayA, HIGH);
    digitalWrite(relayB, HIGH);
  }
  else
  {
    digitalWrite(relayA, LOW);
    digitalWrite(relayB, LOW);
  }
}


tolson

  • Global Moderator
  • *****
  • Posts: 812
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #4 on: March 20, 2014, 07:32:13 AM »
You should define the relay pins as OUTPUTs in your setup().
On powerup many CPUs I/O pins default to inputs or tri-state.

Code: [Select]
void setup() {
   pinMode(relayA, OUTPUT);
   pinMode(relayB, OUTPUT);
}

artandmath

  • RFduino Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #5 on: March 20, 2014, 06:39:25 PM »
Thank you. Works perfectly.

MarcC

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #6 on: April 22, 2014, 01:24:03 PM »
Hi,

I'm writing myself a garage door opener and so far so good... even writing the iPhone app was strangely quick and simple!

Everything is working except for 1 tiny detail: when power is applied to the RFduino it momentarily boots up in "Normally Closed" mode...

This behavior makes the garage door *open* anytime there's a power failure and the power comes back on... doh!

I've got the code in the setup() so that the pinmode is set to Output and the relays are set to "low" (i.e. normally open)... but it seems that by default when the RFduino + Dual Relay shield boots up: the circuit is in the "NC" position and, in my case, opens my garage door.

Just in case you want to see it, here is my "setup" code:

Code: [Select]
void setup()
{

  // First and foremost, let's set the relays pins to output..
  // Note to self: I set the pin mode on both relays just to be safe... even
  //               if I will only use the 1st relay.
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);   
 
  // By default, the Relays appear to be "On" unless we turn them off right away...
  digitalWrite(relay1, LOW); 
  digitalWrite(relay2, LOW);
 
  // Setup the RFduino name and power level...
  RFduinoBLE.deviceName = "RFduino";
  RFduinoBLE.advertisementData = "Garage";
  RFduinoBLE.advertisementInterval = MILLISECONDS(300);
 
  // Note to self: power adjusted from -18 to -12 so that the signal would
  // be able to punch thru the garage door which seems to be made of
  // some sort of metal mined from an astroid that fell from space and blocks
  // the bluetooth signal...
  RFduinoBLE.txPowerLevel = -12;  // (-20dbM to +4 dBm)

  // Start the BLE stack
  RFduinoBLE.begin();
 
}

Is this normal and is there a workaround?

Also, I've done a simple test with a breadboard and a LED: when power is applied to the RFduino, the led turns on for a millisecond and then turns off.

Thank you for any ideas you might provide me with,

Marc

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #7 on: April 23, 2014, 11:52:56 AM »
Hi Marc, are you using the USB shield when you see this behavior? Because the USB shield will have GPIO 0 and 1 pulled high.

MarcC

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #8 on: April 23, 2014, 01:42:43 PM »
Hi Mkay!

Yep - I'm using the USB shield so that explains it :-)

And I've got some good news: I found a super simple work-around after reading this post: http://forum.rfduino.com/index.php?topic=245.msg710#msg710

The work-around for my particular case is as follows:

(1) "unstack" the dual relay shield from my USB Shield + RFduino so that it's next to it.
(2) Run a wire from the RFduino's 3V to the dual relay shield 3V.
(3) Run another wire from the RFduino's ground to the dual relay shield ground.
(4) Run yet another wire from the GPIO #2 on the RFduino over to the GPIO 0 of the dual relay shield.
(5) Run one last wire from the GPIO #3 on the RFduino over to the GPIO 1 of the dual relay shield.
(6) Modify 2 lines of code so that the HIGH and LOW commands are sent to the GPIO #2 and GPIO #3 instead of 0 and 1 respectively.

The two lines of code I modified are global variables "relay1" and "relay2" at the top of my code:

Code: [Select]
// Include the RFduino Bluetooth Low Energy libraries.
#include <RFduinoBLE.h>

// Declare the relay #1 as the GPIO port #2 (use a breadboard and use a wire and don't
// forget to plug the 3V and the ground wire as well) then do the same for relay #2
// but use GPIO port #3... that solves the behavior of the relay being in the "Not Closed"
// position when the RFduino boots up because it sends a HIGH signal to the GPIO 0
// and causes the relay to go to the "Normally Closed" position... which would make
// the garage door open... not cool at all... especially when it's -30C outside!
int relay1 = 3;
int relay2 = 2;

// =======================================================================================
// =
// = Function "setup()"
// =
// = Description:   this function simply "configures" the RFduino shield to advertise
// =                itself every x milliseconds with a specific power level. We also,
// =                prepare the pin for the relay #1 on the dual relay shield.
// =
// =======================================================================================
 
void setup()
{

  // First and foremost, let's set the relays pins to output..
  // Note to self: I set the pin mode on both relays just to be safe... even
  //               if I will only use the 1st relay.
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);   
 
  // By default, the Relays appear to be "On" unless we turn them off right away...
  digitalWrite(relay1, LOW); 
  digitalWrite(relay2, LOW);
 
  // Setup the RFduino name and power level...
  RFduinoBLE.deviceName = "RFduino";
  RFduinoBLE.advertisementData = "Garage";
  RFduinoBLE.advertisementInterval = MILLISECONDS(300);
 
  // Note to self: power adjusted from -18 to -12 so that the signal would
  // be able to punch thru the garage door which seems to be made of
  // some sort of metal mined from an astroid that fell from space and blocks
  // the bluetooth signal...
  RFduinoBLE.txPowerLevel = -12;  // (-20dbM to +4 dBm)

  // Start the BLE stack
  RFduinoBLE.begin();
 
}

Thanks for your answer!

Regards,

Marc

dognotdog

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #9 on: May 25, 2014, 11:07:27 AM »
Is there a particular reason the relay shield is rated only for 12V, considering the relays are ok for 250V AC?

yoonghm

  • RFduino Jr. Member
  • **
  • Posts: 22
  • Karma: +1/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #10 on: May 25, 2014, 03:36:50 PM »
I do not have the module but I believe the first rating (12V) is the maximum input voltage to the coil.
The second voltage (200 or 220V) is the maximum input voltage for the contact.
In other words, a relay has two circuits: coil and contact.

dognotdog

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #11 on: May 26, 2014, 10:57:54 AM »
I do not have the module but I believe the first rating (12V) is the maximum input voltage to the coil.
The second voltage (200 or 220V) is the maximum input voltage for the contact.
In other words, a relay has two circuits: coil and contact.

What second voltage? The relay coil input is rated at 3V/50mW.

matsk

  • RFduino Jr. Member
  • **
  • Posts: 59
  • Karma: +1/-0
    • View Profile
    • Tinnio IT Konsulting
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #12 on: May 26, 2014, 12:48:34 PM »
From the relay shield schematic:

K1 = IM21GR (Tyco Electronics Corporation)

Data sheet for IM21GR

CoilContact ratings, UL
220V DC, 0.24A, 60W
125V DC, 0.24A, 30W
250V AC, 0.25A, 62.5VA
125V AC, 0.5A, 62.5VA
30V DC, 2A, 60W


The data at Digikey's web
http://www.digikey.com/product-search/en?mpart=IM21GR&vendor=41

Rated coil current = 16.7mA is probably wrong!

tolson

  • Global Moderator
  • *****
  • Posts: 812
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #13 on: May 26, 2014, 01:24:20 PM »
The 64 ohm coil 3V relay is IM03GR.

The IM21GR is a 3V 180 ohm coil. Thus the 3/180 = 16.7mA.


matsk

  • RFduino Jr. Member
  • **
  • Posts: 59
  • Karma: +1/-0
    • View Profile
    • Tinnio IT Konsulting
Re: RFD22131 - RFduino Relay Shield - Schematics and PCB
« Reply #14 on: May 26, 2014, 01:36:05 PM »
The 64 ohm coil 3V relay is IM03GR.

The IM21GR is a 3V 180 ohm coil. Thus the 3/180 = 16.7mA.

Your right! My mistake.

 

anything