Wearable Wi-Fi Gadget
A wearable ESP8266-based device with conductive-thread-compatible connections and a WS2812 addressable RGB LED string driver.
The circuit is basically a NodeMCU with the CP2101 USB-to-serial bridge from Silicon Laboratories (a.k.a. Silabs) replaced by the (cheaper) FT231XS from FTDI. Also, a port for an addressable WS2812-based LED string (NeoPixels, if you prefer) has been added.
The available GPIO ports and power supply are brought out on special pads with large holes placed in a circle at the edge of the round board. These pads are intended for use with conductive thread, but you can, of course, also solder wires to them or use crocodile clips.
Power for the circuit is supplied by either the micro-USB port or by connecting an external 5V power supply to one of the 5 V pins. This is useful when using long LED strings as they demand more power than a normal USB port can provide. A high-capacity USB power bank is also an option. Note that the LED interface is for 5 V strings. Also note that the 5 V input does not have reverse-polarity protection.
ESPHome uses a modular approach where ready-made code blocks are combined to form an application. The blocks required by the application are listed in a configuration file, the "YAML" file. YAML stands for "Yet Another Markup Language" and is a set of rules to format a text file containing parameters and values.
Each block is configured individually, to specify for instance the GPIO pin(s) it should use or the communication protocol or its type, things like that.
The YAML configuration file starts with the obligatory esphome: section to specify a name, the MCU used (ESP8266) and the board type (NodeMCU).
Next comes the Wi-Fi section to specify the network to connect to and rescue options in case of network problems. Note that the order of sections has no importance.
Specifying the logger: option activates status output on the serial port. The api: option enables easy integration with Home Assistant and ota: is for over-the-air device programming (from e.g. Home Assistant), which is very practical as it removes the requirement of having a physical connection to the device.
Next comes the meat of the application, starting with the specification that GPIO16 must be an output. This is needed if you want to use the LED that is connected to it as a light device, which is interesting as lights have different options as for instance switches.
Lights can have effects, and ESPHome has a few built in that you can use (if your light supports them, of course). It goes without saying that you can also program your own light effects. I specified most of the built-in effects for the LED ring. Effects can have parameters but without them default values will be used. Home Assistant lets you choose which effect is active. I like the random twinkle effect.
Finally, the board has an analogue input on pin A0 with a voltage divider in front of it (R15 & R16), which explains the multiplication factor of 3.2. The maximum input voltage is 3.3 V.
An interesting possibility here is to use Home Assistant. With a few of these wearable ESP8266 boards integrated in Home Assistant interesting lighting effects for e.g. Christmas can be created. But, even though Home Assistant is optimised for home automation, it can also do other things, like controlling a game at the birthday party of your toddler. Stick a board on every kid and use Home Assistant to create and control teams or decide which candidate may answer a question or who is ‘it’ when playing tag. I am sure that with a bit of creativity lots of fun applications can be invented.
The design files are available from the download section.
The available GPIO ports and power supply are brought out on special pads with large holes placed in a circle at the edge of the round board. These pads are intended for use with conductive thread, but you can, of course, also solder wires to them or use crocodile clips.
Power for the circuit is supplied by either the micro-USB port or by connecting an external 5V power supply to one of the 5 V pins. This is useful when using long LED strings as they demand more power than a normal USB port can provide. A high-capacity USB power bank is also an option. Note that the LED interface is for 5 V strings. Also note that the 5 V input does not have reverse-polarity protection.
Software Design with ESPHome
Of course, you can write the software for this board from scratch, but adopting an open-source project like ESPHome saves you a huge amount of work. This lets you create a connected application for the ESP8266 or ESP32 featuring over-the-air (OTA) programming, fallback hotspot, webserver user interface, and interfaces for over 200 devices in minutes. Really.ESPHome uses a modular approach where ready-made code blocks are combined to form an application. The blocks required by the application are listed in a configuration file, the "YAML" file. YAML stands for "Yet Another Markup Language" and is a set of rules to format a text file containing parameters and values.
Each block is configured individually, to specify for instance the GPIO pin(s) it should use or the communication protocol or its type, things like that.
The YAML configuration file starts with the obligatory esphome: section to specify a name, the MCU used (ESP8266) and the board type (NodeMCU).
Next comes the Wi-Fi section to specify the network to connect to and rescue options in case of network problems. Note that the order of sections has no importance.
Specifying the logger: option activates status output on the serial port. The api: option enables easy integration with Home Assistant and ota: is for over-the-air device programming (from e.g. Home Assistant), which is very practical as it removes the requirement of having a physical connection to the device.
Next comes the meat of the application, starting with the specification that GPIO16 must be an output. This is needed if you want to use the LED that is connected to it as a light device, which is interesting as lights have different options as for instance switches.
Lights
As lights I defined the blue LED on GPIO16 and the LED string. The latter is handled by the neopixelbus platform, which has a few options that must be specified like the length of the string and the port it is connected to. In this case the port is GPIO2 which allows the use of the ESP8266_UART1 method. Actually, when specifying this method, you don’t have to specify GPIO2 as it is implied.Lights can have effects, and ESPHome has a few built in that you can use (if your light supports them, of course). It goes without saying that you can also program your own light effects. I specified most of the built-in effects for the LED ring. Effects can have parameters but without them default values will be used. Home Assistant lets you choose which effect is active. I like the random twinkle effect.
Other In- and Outputs
The unused GPIO ports are declared as switches so you can toggle them on and off from within Home Assistant. In home automation, a switch is a device that is controlled by the system (e.g. a relay). A switch that is controlled by the user (or occupant) is a binary sensor. GPIO0 has a pushbutton connected to it and therefore it is specified as a binary sensor.Finally, the board has an analogue input on pin A0 with a voltage divider in front of it (R15 & R16), which explains the multiplication factor of 3.2. The maximum input voltage is 3.3 V.
Social Distancing Alarm
ESPHome features automation and you could, as an example, add a proximity sensor to the board to change the colour of the LED ring depending on what the sensor sees. This way the board could for instance be a social distancing alarm. It can also just be decorative electronic pin or brooch; let your imagination go wild.An interesting possibility here is to use Home Assistant. With a few of these wearable ESP8266 boards integrated in Home Assistant interesting lighting effects for e.g. Christmas can be created. But, even though Home Assistant is optimised for home automation, it can also do other things, like controlling a game at the birthday party of your toddler. Stick a board on every kid and use Home Assistant to create and control teams or decide which candidate may answer a question or who is ‘it’ when playing tag. I am sure that with a bit of creativity lots of fun applications can be invented.
The design files are available from the download section.
Diskussion (0 Kommentare)