Control relays trought internet and get sensor values.   Controla relés pela internet e obtem dados de sensor.

This project allows you to control 4 relays, also get methereology info throught internet. Localy you can see the same info in the LCD, with an pushbutton you can alternate the LCD info of the sensor and the relays states.

 

You can easily addapt to one or another application, relays or sensors.

 

You'll need:

  • 1x Arduino Uno
  • 1x W5100 Ethernet
  • 1x DHT11 Sensor
  • 1x 16x2 LCD display with I2C
  • 1x Pushbutton
  • 1x 10k Resistor
  • some wires to connect
  • pc with Apache installed (you can easily find a tutorial on Youtube)

Optcionaly this project also requires fixed IP to controll from "outside".

 

Se vc mora em Araçatuba ou região não deixe de conferir: http://grassicomponentes.com.br

Comprei meus componentes aqui!

 

Aditional Info:

For outside conection you'll have to set DMZ in your router to the host computer IP.

 

This project is for experimental (or improve your own with this functional example), doesnt include any user access control. Remember to disable DMZ after tests.

 

Comments are in Brazilian Portuguese but I can translate if needed.

 

Instrucions:

arduino.html -> line 12 change to your arduino IP on your network

MetOnline.ino -> change accordly to your network this variables: 

 

IPAddress ip(192, 168, 0, 105); // your arduino IP again
IPAddress gateway(192, 168, 0, 1); 
IPAddress subnet(255, 255, 255, 0);

 

To find the gateway and subnet in windows just run in CMD this command: ipconfig

 

Remember to atribute your arduino IP to an address that not already in use. To check if its in use some IP open CMD again and ping it. Like this: ping 192.168.0.105

If you have no answer this IP is good.

 

Techinical Info:

When the webpage access the Arduino url (ex. http://192.168.0.105) makes the Arduino answer an JSON with current status. Like this: {"temperature":29.36,"humidity":66, ...} The relays are operated with an argument in URL like http://192.168.0.105?r1=0 The arduino recognize this "r" and do the request.

 

The JQuery takes care of everything sending this argument to update the relay, also updates the page each 2 secconds.

 

I opted to use JQuery to avoid refresh the webpage also to syncronize the relays status if we have more than one person acessing the page. So if one person turns any relay on, that will update in the others device. The update time is set to 2s to avoid overcharge requests on Arduino.

 

Also I opted JSON format cause you can make use in almost everything.

 

This project dont include any power supply but you'll need it if you wish to run it. I think 12V with 2A will be enought (need confirmation). Also you may want an independent power supply on relays to isolate your circuit, just remove the jumper and connect your source. If you just want to test just the USB power will be enough but more relays are on, less current you'll get for the LCD.

 

I started the project thinking in control everything just with the Arduino but the hard way to write html "inside" Arduino and the constant bugs with large strings makes me re-think in implement this very nice solution.

 

Any questions or suggestions please make yourself confortable.

 

Cheers!!