Skip to content

180. Building the iotSwitch agent module

reivaxy edited this page Sep 1, 2018 · 1 revision

It's the simplest module, it only handles one ON/OFF status to drive one output.

The ESP8266 needs to be flashed with the code from this repository.

Since its goal is to drive a power outlet, I thought it would be cool to use a ready made socket case. You could 3D print one, but I didn't want to bother with mechanical constraints for the metallic pin, that I would have to take from some other socket I guess

So I did find these rather cheap sockets on Amazon:

Once the mechanical switch and some plastic supports removed, I could fit a board holding a power down adapter (from 220VAC to 5VDC, 3W), a 5VDC to 3.3VDC circuit, and a solid state relay:

Let's test it:

Mount the esp01 on another a piece of prototyping board:

And wire it before soldering the Oled screen:

Then attach the Oled screen:

It's a wire sandwitch:

Attach the esp01 + screen to the power adapter board.

Here we can also see the solid state relay next to the HiLink power adapter. It can drive 24OV under 2A.

There is no fuse... I'm still waiting for fuse brackets for boards that I've ordered.

All is in place:

Time to close the case:

And here is a video of the working device :

https://youtu.be/egp0olpN0-E

Here is the list of components you need. I won't provide ebay links because they don't last much, but they are all available on ebay, free shipping from China (sometimes in small bulk quantities):

  1. HLK-PM01 AC-DC 220V to 5V Step-Down Power Supply Module (less than $3 a unit)
  2. Esp01 ESP8266 board (less than $3 a piece)
  3. DC 5V to 3.3V Step-Down Power Supply Module AMS1117 board (less than $1 for 5 piece) or the SMD chip itself, even cheaper
  4. Connector and wire ($3 for 20 pieces)
  5. 0.96" IIC Serial 128X64 OLED LCD LED Display SSD1306 (under $3)
  6. Solid State Relay (less than $1 each). It's supposed to be driven by 5V, but 3.3V works :)

That's less than $12 in total.

You need to add a socket case that fits your wall sockets depending on where you live, mine came from Amazon at €8.50 a batch of 4: https://www.amazon.fr/gp/product/B004XCKTGG