Introduction: Arduino Controlled by PC

I have always wanted to create a home automation system around sensors to make more easy process like see temperature , humidity or if there was some movement in the room, to I switch the lights without having to enter blindly searching the switch to turn on.

So I've decided to start a basic project. The project consists of a temperature sensor and LED which simulate the relay to switch the lights of the room on/off.

The sensor and led communicate with an arduino mega and then the Ethernet shield get the info and send using UDP packet to Java program i wrote.

Sorry for the quality of video i have not a good equipment


Step 1: Step1 : What We Need for the Project ?


1x Arduino Mega (can use arduino uno too)

1x Ethernet Shield

3x Leds different color

3x 220 Ω resistor

1x breadboard

1x DHT21/AM2301 Capacitive Digital Temperature & Humidity Sensor

Some wires


Library for DHT21/AM2301

Arduino Ide

Java ide i use netbeans

Step 2: Step2 : Connecting the HardWare

First we connect the temperature sensor in A3 analog pin.

  1. The red cable is need to connect in 3.3volt pin, caution not 5volt pin
  2. The black in GND pin
  3. The yellow in A3 analog pin.

Then set in breadboard the led with the resistors and connect them in the pins 13,12,11 Pins.

Sorry i cant find image for the DHT21/AM2301 sensor and put another

Step 3: Step3 : Download the SoftWare

First download the DHT library from hear [Download]

Download Java files from hear[Download][Download]

Arduino files from hear [Download]

Step 4: Step5 : Upload the Arduino and Java SoftWare

Open the sketch UDPClient. put the mac of Ethernet shield an IP Andress and a port

Upload the sketch to the arduino.

Make a project name UDPClient in netbeans or any of the IDE you know to use.

Then copy the two Java files in the Java project you make. In Java class Panel set the Arduino IP address and the port of arduino

Step 5: Step 9: Launch

Now youare ready to run the Java program you can open the led1 led2 and led3 and for temperature is the analog button :)

If you liked my project, please vote for me :)

I try to make an automation room with android phone and arduino, An excerpt from one of the project prepare you can see in the video.


Arduino Contest 2016

Participated in the
Arduino Contest 2016