I’ve received Netduino Plus yesterday. After playing with the on-board LED and button switch, I tried something else today. Since I don’t have a background in electronics, I googled a bit, asked around and connected LED, a couple of resistors and a transistor (BC108C) to control the external LED with the digital output of a Netduino.
The project goal is simple enough for a seasoned electronics guy, but for me, it is quite a challenge:
- Function as a regular thermostat
- Which can be controlled remotely via SMS as well:
- to check current temperature on location
- to set desired temperature on location
- to switch power on or off for the oil boiler (heating furnace) and water pumps
- to alert via SMS when the temperature drops below a defined threshold
The Netduino/Arduino boards are amazing in that they offer a high level language to control them and create your stuff. You can develop & debug with Visual Studio in case of Netduino boards using the familiar interface and software development skills. There are tons of shields (addons, plugins) available for those boards as well. I’m planning on integrating real time clock, digital temperature sensor and a cellular shield (GSM functionality) and a graphical LCD next. Baby steps.
So, how did I wire the external LED?
First, I had to learn some basics:
- You have to limit current for the LED, otherwise it will burn
- You have to drop the voltage, or the LED will burn
You can limit current by using resistors. I used the 5V pin on the Netduino, and LED needs only 2.5V, so I had to halve the voltage and limit current at the same time. You can do this simply by using two resistors. Smart people call this voltage divider. First, I calculated the maximum current that is allowed for the LED, and that is 20mA. Given the 5V voltage and formula V = R*I, the resistor comes out to 5V / 0.02A = 250Ω (Ohm). Given that, I now needed to lower the voltage, which in my case is simple. The formula for voltage divider is Vout = Vin * R1 / (R1 + R2). Now that I know that R1 + R2 should be 250Ω it is easy to calculate that R1 = R2 = 125 Ohm. I actually used 120Ω resistors as I didn’t have 125Ω ones.
So, the LED was lit, but I wanted to control it via software, so I needed a “switching” mechanism. I asked around used NPN transistor for that. I connected the LED output to collector of a transistor, and connected the emitor part of the transistor to ground. Now, we need to tell the transistor to “open up”. I figured I’ll just connect the digital output to base of transistor, but friendly guys on a Slovenian electronics forum suggested that I use a resistor in between. So I did.
The end result? A program, which turns the LED on whenever I press the button. The final schema looks something like this:
This image was made with Fritzing which looks like a very promising project as well.