Arduino Internet Controlled Desk Lamp

Controlled Desk Lamp

Arduino Internet Controlled Desk Lamp 1

This is a little project I did to control my desk lamp over the internet.

[mom_video id=’ULmMASScJvo’]

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

Circuit

Circuit

Connect everything as shown in the image.
Connect the base of the transistor to the pin used in the code I used pin 13

Connect your light bulb in series with switching contacts of the relay.

And connect your arduino to your server.

Step 4: The Webpage

The Webpage

php_serial.class.php = Serial library

example.php = The code
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.

Step 5: Test It

Test It

Make sure your permissions are right
go to your terminal and type: ls -l /dev/ttyUSB0
then you’ll should get a response like:  crw-rw-rw- 1 root ………….
otherwise you have to set the permissions type: chmod 666 /dev/ttyUSB0

Browse to the example page.

Normally you should be able to control your lights.

Source: Arduino Internet Controlled Desk Lamp

0/5 (0 Reviews)

About The Author

Hassan Zaka

I am an expert in accounting and have diverse experience in technical writing. I have written for various industries on finance, business, and technology. I have a clear and simple writing style and use infographics and diagrams to make my writing engaging. I can benefit any organization needing technical writing services.

Follow Us:
LinkedinTwitter
Home Automation >> Custom Home Automation Projects >> Arduino >> Arduino Internet Controlled Desk Lamp

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top