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

Connecting 12 v LED and a push button


Best Answer hanzibal, 09 May 2013 - 10:14 AM

Hi! For this, you need an npn transistor like a bc547 and an external 12V power supply. No soldering required if you got a breadboard and you don't need a noisy relay since there's no current to speak of. Assuming there's a current limiting resistor inside the LED holder (which there ought to be), connect as follows: Positive pole of your dome to +12V from the power supply 0V (ground) of the power supply to common ground Negative pole of the dome to the collector of the transistor Transistor emitter to common ground Base of the transistor to a digital output of your Netduino via a 2-10k resistor As for the switch, connect com to ground and the normally open pole to a digital input of your Netduino with pullup enabled. Go to the full post


  • Please log in to reply
5 replies to this topic

#1 Mori

Mori

    Member

  • Members
  • PipPip
  • 12 posts

Posted 08 May 2013 - 10:26 PM

Hi

 

I almost know nothing about electronics, but wanted to do few fun projects with Netduino.

 

All I'm trying to do is to connect this big red dome push button with 12 v led light and be able to control them via my code.

 

https://www.sparkfun.com/products/9181

 

The above link is the push button and led specs. Now my question is for the 12 v led, what should I really do? DO of netduino is not 12 v, so do I need some kind of relay? (I prefer not to do any soldering, so in case I need to use relay, I prefer using some thing like http://compare.ebay....ff13=80&ff14=63

 

which I used to call them PLC relay (not sure if it is the correct name or not).

 

Any suggestions?



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 09 May 2013 - 10:14 AM   Best Answer

Hi! For this, you need an npn transistor like a bc547 and an external 12V power supply. No soldering required if you got a breadboard and you don't need a noisy relay since there's no current to speak of. Assuming there's a current limiting resistor inside the LED holder (which there ought to be), connect as follows: Positive pole of your dome to +12V from the power supply 0V (ground) of the power supply to common ground Negative pole of the dome to the collector of the transistor Transistor emitter to common ground Base of the transistor to a digital output of your Netduino via a 2-10k resistor As for the switch, connect com to ground and the normally open pole to a digital input of your Netduino with pullup enabled.

#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 09 May 2013 - 06:04 PM

One other thing to consider, the LED will have a resistor calculated for 12V, if you are able to pull apart the LED housing you should be able to change the resistor for a lower resistance - this would allow you to use a lower voltage (e.g. 5V or 3.3V). You would still need a transistor as Hanzibal described, but no extra 12V power supply. Hope this helps - Paul

#4 Mori

Mori

    Member

  • Members
  • PipPip
  • 12 posts

Posted 09 May 2013 - 06:23 PM

One other thing to consider, the LED will have a resistor calculated for 12V, if you are able to pull apart the LED housing you should be able to change the resistor for a lower resistance - this would allow you to use a lower voltage (e.g. 5V or 3.3V). You would still need a transistor as Hanzibal described, but no extra 12V power supply. Hope this helps - Paul

Thanks! Any specific resistor?

 

BTW, if it works with 5V, why do we still need to use a transistor, can we connect the LED with a resistor directly to the netduino?



#5 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 09 May 2013 - 06:36 PM

If you take the bulb apart like Paul described and feed it 5V, you can replace the resistor with ~600 ohms since you want maybe ~5mA through the LED and it has a forward voltage of ~2V you get (5 - 2) / R = 5mA. Solving for R yields R = 600 ohm and so I would choose 470 ohm (yellow purple brown). With a load of only 5mA, I think you could do without the transistor, since I think the gpio can source the current, but it's good practice to use one never the less. EDIT: Sorry, I forgot that Netduino gpio is 3V3 so you can do with a 220 ohm resistor if you go without a transistor.

#6 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 09 May 2013 - 09:43 PM

The transistor serves two purposes, it allows a higher current to flow in the load (the LED), and it allows a higher voltage to be present. By dropping down to a few milliamps AND using 3.3V, you can eliminate the transistor. You may want to check what current the LED uses with 12V (before dismantling). Depending on the type, it may be more than the 5mA suggested by Hanzibal. Many of the high brightness ones do only need a few mA to give "normal" brightness, but others need more (20mA is a typical figure). Knowing that current will tell you whether a transistor is needed (there is wiki page giving max GPIO currents), and what value resistor to use. Have fun - Paul




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.