Andy's Blog
Project S1.4 - Control panels
As I mentioned in UPDATED: My Home Automation Roadmap, I found that controlling lamps with remote switches is an easy and efficient method of bringing dumb lamps into the smart home fold. However, it introduces a new issue, I don't want to have to pull out my phone every time I want to turn one on or off. Imagine needing to get up in the middle of the night and having to find the phone in the dark, blinding yourself when you turn the screen on, finding the app and the lamp in the app and flipping it on ... all while trying to stay somewhat asleep. Enter, control panels.
Overview
It seems strange to remove local control of a lamp and then having to make something to bring it back. Seems counter productive - and if all you were going to do with it was turn the lamp on and off when you wanted it, that's entirely true. Don't bother adding the wireless control. A lamp works just fine as a lamp.
However, if you want to do more, then one necessary evil in adding the wireless switch is putting back the basic functionality that we all want in a lamp and maybe expanding it in the process. This project is actually several projects in one centered on a central platform that can then be modified based on need to do slightly different things.
The Core
State: Beta - Version 2.0b1
Code: Alpha - Version 2.0a1
Hardware
* UPDATE - This description of the core is now out of date. I have expanded the core with more IO via a port extenders, variability of binary IO devices assigned and more feedback options such as a passive amplified piezo, a RGB neopixel and a rotary encoder. The code has subsequently been upgraded to support more types devices (binary, analog, and I2C) and now uses a web interface to setup devices and systems settings. A seperate article is in the works to describe the core in more detail.
At the core of this project is a ESP8266 chip that handles all of the processing and wireless communication all in one nice small package. Not to mention, it is very inexpensive. Depending on how you decide to incorporate it, the base parts can be had for as little as $2 USD. For my beta versions, I am using the ESP8266 on a NodeMCU development board which makes prototyping very easy and fast.
The core has the following requirements that may or may not all be used for each sub-project as needed:
- Take inputs from 6-8 buttons / inputs
- Display data on a small OLED screen
- Control an AC relay for controlling a low current (15amp max) house voltage device like a light, fan, etc
- Take in on variable analog input (for data collection, variable resistor input)
- Must be able to be powered by AC house voltage and if powered by AC, contain safety circuitry for overload protection
These sets of parameters is the framework I use to write the code for the processor and while limited, can be reconfigured in a wide range of use cases and incorporated into appliances.
The wiring is pretty simple and shown below but to summarize, the ESP8266 has 13 usable digital I/O pins and 1 analog pin. Of those 13, there are some limitations and considerations for 8 of them so, the use case of the core can impact which pins are used so, my code allows for choosing which pins are used. I designed the core to use:
- At least six as digital inputs
- One pin is used as a digital output to control a relay.
- I am using two of the remaining 6 for I2C communication to the screen.
- I'm using the analog input with a LDR for dynamic screen dimming.
That leaves four digitial I/O for expanded use cases. There are some really good resources for pin configurations for the ESP8266 and some are here:
- http://www.electronicwings.com/nodemcu/basics
- https://tttapa.github.io/ESP8266/Chap01%20-%20ESP8266.html
- https://www.instructables.com/id/NodeMCU-ESP8266-Details-and-Pinout/
- https://www.youtube.com/watch?v=7h2bE2vNoaY
Code
The code is very early in development but basically this device communicates via MQTT over WiFi. State changes are transmitted in real time and the device can subscribe to MQTT topics for display on the screen or to toggle the AC relay. When the code reaches beta level, I'll release it on GitHub but for now, it is really basic and simple. The overall goals are as follows:
- MQTT based communication
- Definable I/O assignments
- Modular device configurations
- Web interface for settings config
- WiFi adoption via default host on first startup
Project S1.4-A - Bedside Control Panel with Wireless Phone Charger
State: Alpha - Version 0.4
This project was the third to be devised but the first to be implemented and tested. The scenario above is exactly why I decided to move this one to the top of the list. This device adds a self contained wireless charger kit from China to the Core and the Charging LED was converted into an input for the Core. Additionally, I use this control panel to raise and lower the head of the bed through a relay board I built separately. (more to come on that project)
I designed and printed a box for one side of the bed for initial testing. Once it was pretty clear that I didn't make any critical design errors, I mirrored the design and printed it for the other side. The designs are on my TinkerCad profile as listed below. Please note that this is a early proof of concept design and is not the final finished design. It works as is and we've been using them for a couple of months without issue but you're mileage may vary as they say. I've also posted the super basic POC code on my GitHub profile as well. Please don't send me messages detailing how terrible the code is as I know - it's not finished.
But here is a quick rundown:
- Choose a side to print (not were the power plug is as that is the "back" of the device)
- There are 3 small items that are spacers for different uses a long bar that you'll need two of as a set of stand-offs for the buttons and one F shaped stand off to raise the perf board for the NodeMCU. The final U shaped stand-off is to separate the charging board from the coil. I used this in my first box but not in the second - I had enough space to mount the board next to the coil.
- I used hot glue to affix all of the components in place but other glues and methods that are non-conductive should be fine as well.
- Use the circuit diagram below to wire the control panel. I used breadboard style perf board for the main board for simplicity but used standard no-trace perf board for the buttons. I wound up using two as I didn't have one that was wide enough.
- NOTE: Check your spacing of the buttons before you affix them as the holes in the enclosure aren't based on the standard perf board hole placement.
- Remove the charging LED on the charging board by heating it up with a solder iron tip and then solder a wire to the + side. This will be the input to the processor for charging status.
NOTE: Measure the voltage from this line with respect to ground. I received a pack of 4 of these and of the two I've built, one outputs 5 volts on that line and the other, 3.3. If the output is 5V, you'll need to use a voltage divider to lower the 5V to 3.3 before connecting it the ESP8266 lest you risk burning out the input and possibly damaging the processor altogether.
Resources:
- Wireless Phone Charger - https://www.aliexpress.com/item/VEEAII-Hot-sale-Qi-Wireless-Charger-PCBA-Circuit-Board-Coil-Wireless-Charging-Micro-USB-Port-DIY/32888190242.html
- Tinkercad of enclosure - https://www.tinkercad.com/things/bNXxmOuSeAE-bedside-cp-alpha-2
- Code repository - https://github.com/AndrewHoover/SimpleBedsideCP
- Full build documentation - https://www.instructables.com/id/Bedside-Home-Control-Panel-W-Wireless-Charger/
Project S1.4-B - Countertop Control Panel
State: Pre-Alpha - In development
Similar to the bedside control panel listed above, the countertop version is intended for central locations in the house. As this unit is still in the initial design stage, there are some aspects that I haven't decided on yet but I am considering the following:
- Simple - Very basic stripped down 8 button version with no screen or chargers.
- Media Charging Hub - Same configuration as above except that instead of a wireless charger, it will include USB charging ports for tablets and phones that is both standard 5v and the fast charging 9v as well.
- Data Gathering - A combination of 6 button CP with the unit I'm designing for Project S1.8 - Indoor Environmental Sensors
In the end, I may design each of these three as separate projects. More to come on this one.
Project S1.4-C - In-Wall Control Panel
State: Pre-Alpha - In development
This project is wrapping up initial design. Ordinarily, I'll create a very simple proof of concept device and test attributes along the way but due to the riskier nature of this device, I have been proofing individual components and ideas in blocks during the design. My full proof of concept device will start out as a fully designed device that has had individual components stress tested before construction. My goal is to prep this device for UL listing. I'm not sure how I'll pay for it considering the price tag but I'd like to market this product in the future.
Without giving too much away, the goals of this project is to have a MQTT based in wall switch with multiple buttons for controlling more than one device - including the AC circuit it is connected to. There are two versions of this device in development - one with a screen for displaying data per the user's specification and another without.
Project S1.4-D - In-Wall Control Panel with Dimmer
State: Pre-Alpha - In development
This project is in its early design stage. The goals of this project is similar to the project above but also incorporates a dimming circuit instead of just on/off control of the circuit.
Project S1.4-E - In-Wall Three-way Switch Control Panel with Circuit State
State: Pre-Alpha - In development
This project is wrapping up initial design. The goals of this project is similar to the project S1.4C above but is designed to be one node in a three-way switch configuration. The three-way part is simple enough. The challenge is in creating circuit that can detect the state of the load without injecting voltage in the line as some devices in this category do.