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

How do I control an output of 5V?


  • Please log in to reply
12 replies to this topic

#1 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 30 December 2011 - 10:06 AM

Hi, Oops! I thought the digital outputs provided 5V, not 3.3V, and I have a 5V relay. Is there a way I can provide 5V to the relay as an output? (since I need to turn it on and off)...

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 December 2011 - 10:11 AM

Hi Reactive, You can use a level shifter or a MOSFET or a transistor to accomplish this. Have you used transistors before? Chris

#3 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 30 December 2011 - 10:51 AM

Hi Chris, I haven't used a transistor - but I've got a few SparkFun tutorials I can read up on. What's the easiest approach?

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 December 2011 - 04:22 PM

I haven't used a transistor - but I've got a few SparkFun tutorials I can read up on. What's the easiest approach?

That's a good first step right there. As you have specific questions that are unanswered by online tutorials, let us all know and we can help provide answers that many people can use in their own projects.

Chris

#5 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 01 January 2012 - 08:03 AM

Hi,

Oops! I thought the digital outputs provided 5V, not 3.3V, and I have a 5V relay. Is there a way I can provide 5V to the relay as an output? (since I need to turn it on and off)...


The Arduino relay schematic will show you how to wire up a relay to the Netduino. It consists of a resistor, transistor, anti-feedback diode (very important when using an inductive load like a relay or motor).

The resistor limits the current to the transistor, when the pin is switched on the transistor conducts 5v to the relay causing it to engage. Make sure you either configure the port as using a pull_down resistor, or (my preferred route) put a 4k7 ohm resistor between the base of the transistor and ground to pull-down the transistor to ground. That way, the relay is transistor is always in a known state.

-dan

#6 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 01 January 2012 - 02:31 PM

Hi,

Oops! I thought the digital outputs provided 5V, not 3.3V, and I have a 5V relay. Is there a way I can provide 5V to the relay as an output? (since I need to turn it on and off)...


Reactive,

I am using relays that also call for a 5V input with 3.3V. They work great. I power them with the 5V from the ND but I trigger them with the Digital IO (3.3V). Here are the ones I am using: http://www.ebay.com/...#ht_6578wt_1241 These boards already have the transistor and diode that others have mentioned... plus they're inexpensive!

#7 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 03 January 2012 - 10:26 AM

Reactive,

I am using relays that also call for a 5V input with 3.3V. They work great. I power them with the 5V from the ND but I trigger them with the Digital IO (3.3V). Here are the ones I am using: http://www.ebay.com/...#ht_6578wt_1241 These boards already have the transistor and diode that others have mentioned... plus they're inexpensive!


Hi seascan,

Thanks for the info. I wasn't aware that the transistor mentioned in the arduino relay schematic actually assumed a 3.3V output and would convert it to 5V!

As for your relays - those look perfect. Just another question though... how do I trigger them with the digital pins? I have no clue how to wire it up with the 5V and the 3.3V digital pin?

#8 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 03 January 2012 - 11:31 AM

Probably have a look at this thread: http://forums.netdui...tronic-project/
This is a great tutorial on very basic electronic shematics and useage.
I also worked with transistors the first time and after reading the transistor example, everything seemed clear to me :) (especially the difference between NPN and PNP tranistors)

Greets, Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#9 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 03 January 2012 - 03:01 PM

Hi seascan,

Thanks for the info. I wasn't aware that the transistor mentioned in the arduino relay schematic actually assumed a 3.3V output and would convert it to 5V!

As for your relays - those look perfect. Just another question though... how do I trigger them with the digital pins? I have no clue how to wire it up with the 5V and the 3.3V digital pin?


Reactive,

The 3.3V is not converted to 5V... The Netduino 5V output is connected to the screw terminal labeled 5V on the relay. A ground wire is also connected between the ND and the screw terminal on the relay board.

For each relay one digital pin from the ND is connected to the IN screw terminal on the relay board. In the case of the board I referenced above, it has two relays so two separate output pins can be used. The output pin high is 3.3V which is enough for the relay board to trigger the relay to 'turn on' (contacts are closed). Also, the relay board has a diode for each relay which prevent a voltage spike from harming the ND when the relay is turned off (contacts are opened).

The best part is that there are no calculations and no things to stuff into your head (unless you want to)... simply attach the four wires and start turning on and off whatever you want. I am using a number of relays to turn on and off AC lights, Fans and Pumps depending on sensor input to the ND.

Hope this helps!

#10 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 03 January 2012 - 03:12 PM

Reactive, One other note: The board I mentioned draws 200mA from the 5V pin on the ND. This is the combined maximum that the ND can deliver... so I wouldn't try to power anything else (even from the 3.3V pin) unless they draw micro-amps.

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 03 January 2012 - 03:50 PM

The board I mentioned draws 200mA from the 5V pin on the ND. This is the combined maximum that the ND can deliver... so I wouldn't try to power anything else (even from the 3.3V pin) unless they draw micro-amps.

Just to clarify...the MCU can only deliver 200mA max current from its pins...but you can draw a bit more than that from the power headers. Technically you can go up to 400mA or so...although that will result in very warm power regulators :)

Chris

#12 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 03 January 2012 - 04:48 PM

Just to clarify...the MCU can only deliver 200mA max current from its pins...but you can draw a bit more than that from the power headers. Technically you can go up to 400mA or so...although that will result in very warm power regulators :)

Chris




That's great news! Thanks Chris.

#13 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 04 January 2012 - 04:40 AM

That's great news! Thanks Chris.


I'm glad my inexperience has brought enlightenment to others, even if indirectly :D




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.