Web-based Wifi Power Controller

Dear all,
after some tweaks I managed to develop a Wify Power Controller to take care of the home electric power consumptions. I know that there are many of similar projects, so I would like just to share the knowledge on how to build up a Web-based Wify Power Controller starting from well-known Arduino compatible components.

I took inspiration from a very well written Italian article (link) and a previously presented architecture (link).

The idea is to monitor the electric power need, to monitor some environmental parameters (temeprature, humidity and ambient light) and to control 4 relays using a simple web (http get / json) protocol over the wifi.


  • Arduino UNO (link)
  • Relay Shield v2.1 from DFRobot (link)
  • WiFly RN-XV from Sparkfun (link)
  • Power Meter SO+/- Finder 7E.
  • Temperature and Humidity sensor DHT22
  • Ambient Light sensor TEMT 6000

I powered up the hardware configuration with a 12V DC power supply.
I connected the Light sensor to the analog pin 0 (A0)
I connected the Temp/Humid sensor to the digital pin 5 (5)
I connected the SO pulse to digital pin 3 (3)

The connection with the SO+ and SO- pins of the Finder power meter has been done accordingly with the “DIN 43-864” standard, following this scheme:

[SO+] [SO-]-------[GND]
| 10k
[Digital 2] ------o—///---- [Vcc=5V]

With the attached sketch (find below the link to download it, plus related libraries), once you setup correctly the SSID and passphrase, you can point your browser to the IP_Address of your WiFly and do the following:

  • http://IP_Address/?RELEX=ON (activate relay X, where X = 1,2,3,4, then shows the unit status)
  • http://IP_Address/?RELEX=OFF (de-activate relay X, where X = 1,2,3,4, then shows the unit status)
  • http://IP_Address/?RELEX=TOGGLE (activate relay X for 0,8 seconds, where X = 1,2,3,4, then shows the unit status)
  • http://IP_Address/?ALL=ON (activate all the relays, then shows the unit status)
  • http://IP_Address/?ALL=OFF (de-activate all the relays, then shows the unit status)

Consider that I tested it only with the above mentioned configuration. I tested it also an Arduino MEGA 2560, but I failed, probably due to an incompatibility with the WiFlyHQ library.

When programming, do not forget to operate the micro-switch on the Relay Shield so that it is in the “prog” position. When running the sketch, do not forget to operate back the micro-switch on the Relay Shield.

Check that the WiFly is well connected to the Relay Shield, push it firmly so that the pins completly get into their holes.

The sketch does not provide a serial communication with the USB cable, so you should rely on the web interaction (do not forget to sign somewhere the IP address dynamically given to the WiFly module by your home router).

Best regards,

PowerUnit.ino (14.7 KB)

libraries.zip (218 KB)

Hi Vincenzo, very interesting project! Congrats!