5V relay with ND+ - Page 2 - Netduino Plus 2 (and Netduino Plus 1) - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

5V relay with ND+


  • Please log in to reply
24 replies to this topic

#21 Giuliano

Giuliano

    Advanced Member

  • Members
  • PipPipPip
  • 361 posts
  • LocationSimi Valley, CA

Posted 11 June 2012 - 04:10 PM

Short update - I've received the new 2-relay board. Works fine. I power it via 5V into the JD-VCC. The VCC next to the IN1/IN2 gets 3.3V. And everything works great. I'll start working on a wiki page for it.


Where you able to get a wiki page for this project/relay usage?

#22 Cabadam

Cabadam

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 11 June 2012 - 04:19 PM

Where you able to get a wiki page for this project/relay usage?


Yup - take a look at http://wiki.netduino...lay-Module.ashx

#23 Giuliano

Giuliano

    Advanced Member

  • Members
  • PipPipPip
  • 361 posts
  • LocationSimi Valley, CA

Posted 12 June 2012 - 07:38 PM

Yup - take a look at http://wiki.netduino...lay-Module.ashx


Awesome, thanks.

#24 jkrarup

jkrarup

    New Member

  • Members
  • Pip
  • 8 posts

Posted 12 December 2012 - 07:06 PM

This certainly saved me. I bought this "Chinese Cheapo" 4 Channel Relay off eBay with a stamp of Banggood on it. I could get a relay to switch ON but never switch OFF until I tried using TriStatePort as the OutPut.

Now it works perfectly. The only thing I can add is to test if the port.Active == true before trying to reset it to true or it will throw an exception.

Thanks,

Jens

Sorry its taken so long to answer Adam.

I just did a Google search for "SainSmart + schematic" and I found this page that has a schematic for a four channel relay board. The picture is different from the one you linked to on Amazon, but I think it explains what is going on:
http://www.hoyasourc...92p9eaa2pt55p32

This schematic only has one Vcc connection (+5V).
Vcc is connected to the emitter of a PNP transistor (the leg with the arrow). When the base (the leg connected to the resistor) is pulled down by around 0.7V below the emitter, the transistor will turn on and allow current to flow from the emitter (Vcc) to the collector which is connected to the relay and LED.
If the base is left unconnected, or if it is pulled up close to 5V, the transistor will turn off and this will stop current flowing into the relay and LED.

If we assume that this is the same design as your board, I think the symptoms you reported would all be the same.
When the relay board Vcc is powered with 5V, setting any of the inputs to 3.3V (the maximum from the Netduino), the base of the transistor will see a voltage that is 2.7V less than the emitter, and this will turn on the transistor. So no voltage from the Netduino is high enough to turn off the transistor.

But, I think you can solve the problem by using a TristatePort instead of the normal OutputPort.
When you want to turn on a relay, set the pin to an output with logic zero - this will pull the output low and turn on the transistor as before.
When you want to turn off a relay, set the pin to an input (with ResistorMode.Disabled), this will cut off the path for the current and the transistor should turn off.

I'm afraid I have not used a TristatePort before, but from reading the class definition on the link above, it looks like you set port.Active = true to make the pin an output, and set it false to make it an input.
I am guessing that you can set the pin to logic zero as normal port.Write(false)

Doing this, I am hoping that it should be possible to run the relay board Vcc at either 5V or 3.3V, rather than just at 3.3V as you have been forced to do so far. Once you can use 5V, the relays will be much more reliable.

See if this helps - Paul



#25 Charlyv

Charlyv

    New Member

  • Members
  • Pip
  • 1 posts

Posted 03 January 2013 - 09:33 AM

Since the original relay board in this post was really an excellent relay board, it should have worked properly with the correct
sequence for operating active low relay boards on arduino:
 
#define RELAY_ON 0
#define RELAY_OFF 1
//prime the relay variable off before setting the pinmode
digitalWrite(Relay_1, RELAY_OFF);
pinMode(Relay_1, OUTPUT);  
//good to go





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.