Recently at Yoctopuce, we started to build, for internal use, many small boxes that some wouldn't hesitate to call "Smart Extension Cords", but which are in fact a simple application of the Yoctopuce technology: Wifi controlled extension cords. We thought that you might be interested in knowing how we build them.
The whole adventure started when we discovered in the neighborhood DIY store junction boxes with a socket on the side. They are just big enough to contain all the required Yoctopuce electronics to commute by Wifi the mains current.
The boxes which started it all
The main idea is very simple: commuting the socket in the box with a relay driven by a YoctoHub-Wireless and powering everything directly from the mains thanks to an AC/DC converter. Here is a small diagram:
The system diagram
The is a small subtlety: rather than connecting the 5V converter output on the hub, we decided to go through a Mini-Battery-Supervisor, and this has two advantages:
- We have a USB socket that we can easily mount on the side of the box and which allows us to configure the hub without disassembling everything every time.
- When they are disconnected from the mains, most AC/DC converters don't shut down their output properly: because of the large capacitors they contain, voltage goes down slowly, sometimes for several seconds, which is never good to power digital electronics. The supervisor will perform a clean shutdown if the voltage becomes too low.
To build this Wifi extension cord, we used:
- A box with a socket, those we found are OBO T60.
- A Yocto-PowerRelay-V3.
- A YoctoHub-Wireless-SR, we selected the SR version because it doesn't need an antenna.
- A Mini-Battery-Supervisor, not strictly required, but very convenient.
- An AC/DC 5V converter, we selected a TRACO POWER TIW 06-105 for its small size.
- An electric cord with a male plug to connect the box to the mains.
- A few accessories for assembly: a cable gland, a 1.27-1.27-11, a Board2Board-127, a Fix-2.5mm, and a Fix-3x8mm.
All the parts
We started by cleaning the bottom of the box with a small sander to make it fully flat.
Cleaning the bottom of the box
We then installed the 1.27-1.27-11 cable on the configuration socket of the YoctoHub-Wireless-SR. We soldered the Board2Board-127 headers on the hub and the relay. For safety's sake, we protected all the contacts close to the relay connector with electric insulant. Hot glue would probably have done the job as well. When the insulant was dry, we mounted the relay on the hub with the Fix-2.5mm.
Protecting the contacts and fixing the relay on the hub
Installing the hub at the bottom of the box
We then drilled openings for the cable gland and the Mini-Battery-Supervisor, which we mounted.
Note, as the converter provides exactly 5V, we must configure the Mini-Battery-Supervisor to re-arm itself below this voltage, otherwise the system won't start. The only available setting corresponding to this criteria is a 3.6V shutdown voltage.
Don't forget to configure the shutdown voltage of the Mini-Battery-Supervisor
Finally, we set the converter in the box, it just fits, and we wire everything. Note, from a purely functional standpoint, we can use the relay to cut any of the two power wires, but for safety's sake, it is better to cut the phase. In Europe, it's the brown wire. We must also remember to take care of the ground wire.
About safety, the box is certified for 3680W, the electric wire is certified for 2500W, and the relay can commute up to 1250W. To keep some margin, we think that we should limit the use of this box to devices consuming less than 1000W, which is quite honorable.
Here is it, we now have a box enabling us to remotely turn on or off devices powered by the mains.
It's done and it works
You might wonder why we went to so much trouble to build such a device when one can find many similar products on Amazon, smaller and most of all cheaper. The difference is that ours doesn't need a third party server to work and we have all the power of the Yoctopuce API to make it do everything that we want. We'll have a chance to talk about it again.