The Sonoff WiFi switch from ITEAD is real cheap WiFi enabled mains powered switch.
The idea here was to reflash the firmware using the Arduino IDE with the ESP8266 plugin.
So we could repurpose this unit as a IR controller for a Heat Pump (Air Con)
Below is a Picture of the completed and modified unit.
Once you have the unit open it should look like the picture below
First you will need to add a 4 pin header to U4 this will give us access the serial port
VCC and GND. Please note at no stage connect the unit to mains power. To power the unit while
testing or programming use the 3.3v and GND pins on U4 with a suitable 3.3v power supply
You will need to install the ESP8266 package using Boards Manager into your Arduino IDE I followed this guide
Installing with Boards Manager
U4 has the following pinouts
Pin1 VCC (3.3V)
Connect this to your 3.3v serial adapter and set your Arduino IDE to use a Generic ESP8266
Now you can program the Sonoff just like a any other Arduino.
Here is the schematic of the Sonoff (note this includes the 433mhz module) but the units I have do not
have these fitted. The schematic is not perfect but it is close and will give you a good idea of how things
are connected together
To achieve my goal I had to make few hardware changes to the device.
Remove the following components
R5 1k Resistor
R3 1k Resistor (If fitted)
D1 Bi Colour LED
Then add a IR LED in place of D1 use the two outer holes.
Fit this with the anode(+) to right of the board (looking from the front)
Then run 2 small wires from the holes vacated by the relay to to IR LED
make sure the right hand wire(+) goes to the right hand leg of the IR LED
Using a short piece of 3 core ribbon cable solder 2 cores across C3 and the
third core to left hand pad of the vacated R5 (this is for the DHT22)