A friend of mine was looking for inexpensive power outlets/strips with USB control and he couldn't find a decent one. It came to my mind that this is a great project for Hexabitz! There are plenty of wifi-controlled power outlets out there but what if you want a CAN-controlled power socket? Or IR-controlled? Or simply old-fashioned serial port? It's almost impossible to find something off-the-shelf to cover all these needs so why not build your own? Hexabitz modules are so tiny and you can combine together whatever modules you want to get any weird functionality! Turned out a really fun project trying to squeeze these modules in such a tight space.
WARNING: Voltages higher than 24V can be dangerous! Make sure you know what you're doing and use protection (circuit breakers, etc.) whenever possible. Don't attempt this without supervision if you haven't dealt with higher voltages before.
Build instructionsStep 1 - Acquire few standard power stripsI got few power strips from Home Depot. It's really difficult to tell if there's enough room inside before you open them up so you might need to experiment with few models (but at least make sure they're wider than a single module, i.e. 30mm, which almost all power strips are.) In some power strips, there's enough space to stuff in modules without any modifications. In other ones, you might need to remove the power switch or one or more sockets. In most cases, you will probably need to at least remove some internal ribs or drill some holes. Also, wiring gets tight with thick power cables so try to get the spaciest power strip you can find!
Step 2 - Choose what modules you want in thereI modified two power strips. Once has the IR Lidar or Time-of-Flight (ToF) sensor module (H08R60) to replace its power switch so that you can use hand gestures to turn power on/off. The other one has a BLE and a USB modules so that you can control power via a smartphone or connect to your PC and use the CLI. Of course, you need an AC relay and a 3.3V power supply as well as few mounting modules. Here's the complete list.
Setup 1
- 1 x 600 VAC / 1.2A Solid State Relay Module (H0FR60)
- 1 x 3.3V / 1A DC-DC Buck Power Supply Module (H03R00)
- 1 x Time-of-flight IR Sensor Module (H08R60)
- 4 x M2/M2.5 Triangle Mounting Hole Module (T00R10)
- 1 x power strip
- M2 nylon screws and spacers (height according to your design)
The USB module is optional.
Setup 2
- 1 x 600 VAC / 1.2A Solid State Relay Module (H0FR60)
- 1 x 3.3V / 1A DC-DC Buck Power Supply Module (H03R00)
- 1 x Bluetooth V4.0 Dual Mode Module (H23R10)
- 1 x Mini USB-B-to-UART Converter (H1AR20)
- 4 x M2/M2.5 Triangle Mounting Hole Module (T00R10)
- 1 x power strip
- M2 nylon screws and spacers (height according to your design)
I ended up using Mini USB-B module instead of the USB-B in the picture to reduce size.
Step 3 - Start assembling the modules together and find out best fitThis step will require some iterations. You will need to find the best place inside the power strip and maybe remove some internal features that are blocking the modules. Remember that you can also go vertical and tune vertical spacing to access your modules the way you want based on module height and available space.
You might end up drilling holes and using metal screws or gluing nylon spacers from inside. Sometimes when the space is really tight, the modules will be constrained just by their cables.
You need to bridge power vertically and at least one array port if you have vertical modules that should communicate with each other. I designed my array so that I can remotely program all modules when I'm connected to one of them. This way I can update firmware on any module I want. When I built this project I had to do the bridging manually with some wires. Fortunately, we now have triangular vertical extension modules (T00R20) that can perfectly replace these messy jumpers!
One of the power lines needs to be cut, routed to the relay module and then back to power sockets. I used an external AC-DC wall adapter to power the 3.3V DC-DC module since it's really difficult to fit the adapter inside. One of the module designs didn't actually fit inside so I had to remove part of the cover. One can 3D-print a transparent cover to give an awesome look! Also don't forget to make an opening for USB port.
The second design fit perfectly and the IR sensor aligned with the power switch opening making it a great success!
I loaded standard H0FR60 firmware on the relay module. Check latest release here in the Compiled folder. For the IR module (H08R60), I made this simple code (attached project) that detects a hand sweep within 500mm range.
The FrontEndTask -or the main() function in Hexabitz firmware- simply configures the IR sensor to stream values to a memory location (the sensor variable) and then checks for hand sweeps. If a hand gesture is detected, the indicator LED is toggled and the relay module is ordered to turn on or off via the appropriate message. This can be simplified a little bit by directly sending a toggle message to the relay module but I wanted to keep the internal toggle state in the IR module in sync with the relay so that the indicator LEDs on both modules can be used to signal power ON state (the relay module has an orange indicator LED hard-wired to relay output).
And here's some testing with an AC lamp. So fun! If you move your hand quickly, it might not get detected correctly but the code can be sped up and optimized more to detect faster gestures.
Comments
Please log in or sign up to comment.