Hello!
In this project you will learn how to control an LED via your phone or desktop computer threw apache server!
Step 1: What are we going to do in this project
Iāve been working with the Raspberry Pi 2 for about a month now, and when I got it I knew I want to control it, via a website from a mobile phone or computer.
I finally got the chance to find the easiest way to do this, it only needs a Raspberry Pi 2 (of course), resistor, led and an internet connection.
Letās get into it!
Step 2: Resources
(Iām linking everything, on ebay and also amazon)
1)
Of course without a Raspberry Pi you canāt do this project, I used a RPi 2, but the original one will do fine.
If you are not tight in the budget, itās the best to buy an adapter, case and maybe some heat sinks for it.
Link to buy it: ebay http://www.ebay.com/itm/EU-Power-Supply-RASPBERRY-ā¦
amazon:http://www.amazon.com/CanaKit-Raspberry-Complete-Oā¦
!!!WARNING!!!
The amazon link has HDMI for the raspberry pi 2 packed, if you consider using SSH, you donāt need the HDMI cable.
2)
Iām using a RED colored LED, so my resistor needs to be 330 ohm, you can calculate your resistor for your led with ohms law.
Link to buy: ebay: http://www.ebay.com/itm/1-2w-Watt-0-5W-330-Ohm-330ā¦
amazon:http://amzn.com/B009XOP5WM
You got an ohms laws calculator on the internet: http://www.ohmslawcalculator.com/ohms-law-calculatā¦
Ohms law:
I = V / R , R = V / I , R = resistance, V = voltage , I = amps
We know that the GPIO pin (general purpose input output) is outputting 3.3 volts and the led needs only 2 volts, so we put a resistor.
GPIO can give out 16mAmps but 4mA itās enough for the LED to light (0,004 Amps)
We start by 3,3V ā 2V = 1,3V left. (we need to eliminate 1,3V, if we donāt itās possible to damage the Raspberry Pi)
Ohms law is R = V / I . R = 1,3 / 0,004 (donāt forget to convert the mA to A) and we get 325 ohms.
But we will use 330 ohms, because itās easier to find.
To find more about ohms law visit this link: https://en.wikipedia.org/wiki/Ohm%27s_law
3)
The RED LED, if you are using my resistance, you must use RED LEDs.
Link to buy: ebay:http://www.ebay.com/itm/3mm-5mm-Clear-White-Red-Blā¦
amazon:http://amzn.com/B004UMA60S
4)
Breadboard
This is not MUST HAVE, but itās good for testing electronics, and for the next step to be easier.
5)
Jumper cables
You can buy male to male, male to female ones.
It depends on you, you can also find this anywhere.
You can find everything on this list in every electronics shop.
Step 3: Connecting the Raspberry Pi, Resistor, LED
When you get the resources, you sit down, and start connecting.
I have attached an image so itās easier for you.
As I mentioned in the previous step, the breadboard is there just for testing, itās okay if you just attach the LED and the resistor to the pins. (Do it on your own risk)
How do we attach a simple LED to our Raspberry Pi?
Itās very easy.
First!
You need to determine the + and ā of your LED. This is very IMPORTANT
To determine which is + and which is ā you look at the length of the ālegsā of the LED.
For more detail: Control LED via website