Wireless sensors


Edsard Boelen, 14-may-2015
Wifi and celular networks are available everywhere, it is best to use those also for small data packets. No zwave or zigbee which need their access points. Usually I was against wifi because the high cost and power consumption. (arduino wifi shield was 5 times the cost of an arduino, a home router was cheaper.) But recently the chineese made ESP8266 has taken those constraints away. About 5 euros and a stand-by current of 10uA. The on-board controller is programmable, but I will use the default serial interface.


wifi thermostat


My first experiment will be a wifi controlled thermostat. It will also have a display which lights up when I wave my hand before it.

The hardware


The hardware will consist of some cheap standard expansion boards:
. .

The connections to the arduino are as follows:

   
D0, D1USB serial / program
D2, D3Soft serial to esp8266
D4, D5, D6, D7Lcd data
D8, D9, D10Lcd RS,EN,BL
D11, D12Ultrasonic sensor
D13LED diagnostic
A0Buttons
A1DHT22
A2Relay for CV

Software


First test the ESP8266 connection: get the arduino code here not to set your wifi password

The arduino code overview is as follows:

    setup:
  • set initial values
  • send bootup msg to server.
  • display values.
loop:
  • delay 200ms
  • check Sonar
    • (turn backlight on if movement is detected within 50cm)
  • check ButtonPress
    • (if sync button is pressed, sync immediately)
    • (if up/down pressed, increase/decrease thermos setting with .5 degrees)
  • check Backlight counter
    • (if backlight is on for 1 minute, then turn backlight off)
  • check Measure Temp counter
    • (measure temperature)
    • (handle thermos)
  • check Sync counter
    • (sync with webserver, send temps)
    • (get new thermos if available)


Get the full arduino code as thermos.c .

Web handling


The web handling is ofcourse the reason to built it in the first place.