Summary of Arduino Internet Controlled Desk Lamp
This project demonstrates how to control an Arduino-connected relay via a Linux web server using PHP. The Arduino reads serial commands ('1' or '0') to switch a relay on or off, controlling a light bulb. The relay is driven through a transistor connected to pin 13. A PHP script communicates with the Arduino over a specified serial device. Uploading the Arduino code and PHP files to the server enables internet-based control of a desk lamp.
Parts used in the Arduino Internet Controlled Desk Lamp:
- Arduino
- Relay
- Transistor
- Light bulb
- Linux web-server with PHP
- Connection cables
Step 1: What You’ll need
A linux web-server with PHP, an arduino, a relay and some other components.
Step 2: Upload your code to the arduino
Upload the following code to your arduino:
void setup(){
Serial.begin(9600);
}void loop()
{
if (Serial.available() > 0) {char inByte = Serial.read();
if(inByte == ‘1’){
digitalWrite(13,HIGH);
}
else if(inByte == ‘0’){
digitalWrite(13,LOW);
}
}
}

Step 3: The circuit
Connect the base of the transistor to the pin used in the code I used pin 13Connect your light bulb in series with switching contacts of the relay.And connect your arduino to your server.
Step 4: The webpage
make sure you put the path of your arduino on the following line:
$serial->deviceSet(“/dev/ttyUSB0”);Upload this two files to your server in the same directory.

