# Control LED via website

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.

!!!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.

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.

amazon:http://amzn.com/B004UMA60S

4)

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

## About The Author

### Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.