Archive

Posts Tagged ‘esp8266’

1btn is a Battery Powered Open Source ESP8266 WiFi Button

July 8th, 2017 17 comments

If you have some WiFi power switch like Sonoff TH16 at home, you’d normally control them using a mobile app or a web interface. This is all good, but getting your phone, unlocking it, and launching the app to turn on or off an appliance is not the most efficient way to operate, and in some cases, some people in the household may not know how to use a smartphone. Physical WiFi buttons are the solution, but there aren’t so many for sale. We’ve seen previously it was possible to hack an Amazon Dash, but it’s not really that flexible, and 1btn could potentially be a better option, as it’s open source and based on Espressif ESP8266 WiSoC.

1btn specifications:

  • WiFi Module – ESP-12F based on Espressif ESP8266
  • MCU – Microchip Atmel ATmegaxx8 AVR MCU
  • Connectivity – 802.11 b/g/b WiFi up to ~50 meter range
  • USB – 1x USB port for charging and programming (via on-board USB to Serial chip)
  • Misc – User button, multi-color LED, power on/off switch
  • Expansion –
    • AVR MCU – 2x 8-pin headers with ADC, I2C, SPI, RESET, 3.3V, and GND signals
    • ESP8266 – 1x 8-pin header with GPIO, Tx/Rx signals, 3.3V and GND signals
  • Battery – Rechargeable 3.7V/500mAh battery
  • Dimensions – Around 60 mm side to side
  • Weight – ~50 grams

The hardware design files, mechanical design, and NodeMCU (Lua) based firmware can all be found on Github, releases under an MIT license. The button can be used to send an email, text message (via Twilio SMS), or a tweet, as well as invoke an URL action allowing to use all sort of APIs and services such as IFTTT.


The Atmel MCU is used to keep battery life under check, as the button will only connect to WiFi then you press the button. It takes about 5 to 7 seconds to wake up from sleep, and send the message, after which the button goes back to sleep. The battery will last around 300 presses before it needs to be recharged, or about 5 months if you use the button twice a day.

1btn sells on Tindie for $40 plus shipping. That’s a little more than expected, so tried to look for alternative beside Amazon Dash, and I found “ESP8266 IFTTT WiFI Button Dev Kit” – aka Abutton – on Aliexpress going for $13.43 shipped. The button can be re-programmed with custom firmware, and is based on Apixel  ESP8266 dev board with an ESP8266, but not MCU, so it has to rely on ESP8266 low power mode, so battery life is likely to be quite lower than 1btn. Talking about batteries, there are none, and instead there’s a compartment for 2 AA batteries. The Arduino or NodeMCU source code for Abutton can also be found on Github.

Click to Enlarge

WiFi is not exactly the ideal wireless solution for this, that’s maybe why Bluetooth buttons are much more common, and quite cheaper, so maybe having a ESP32 wireless power switch with WiFi and Bluetooth, plus a BT button would be both a better and cheaper solution. The only problem is that AFAIK ESP32 wireless switches don’t exist right now, except in board form factor, and not in a neatly packaged product like the Sonoff switch.

Sonoff B1 is an $18 Hackable WiFi RGB LED E27 Light Bulb based on ESP8285 WiSoC

July 4th, 2017 6 comments

Earlier this year, I wrote about an ESP8266 based RGB LED “AI Light” lightbulb that was hacked to run ESPurna open source firmware. That’s all good, except some people tried to get one, and ended with a different hardware. So if you’d like something that’s more of a “sure thing”, ITEAD Studio has designed Sonoff B1 dimmable RGB LED E27 light bulb based on ESP8285 processor, and with a “4 pads” to allow for custom firmware flashing.

Sonoff B1 hardware specifications:

  • Typical Lumen Output – 600lm
  • Beam Angle – 120 degrees typ.
  • Color Temperature –  2800K-6500K & RGB full color
  • Connectivity – WiFi 802.11 b/g/n @ 2.4GHz
  • Power Supply – 90-260V AC 50/60Hz via E27 base
  • Power Consumption – Light off: 0.5W Max; rated power: 6W
  • Temperature Range – Operating: 0ºC~ 40ºC; storage: -20ºC~ 80ºC
  • Operating Humidity – 5%-90% RH

Sonoff B1 with stock firmware can be controlled using the usual eWelink Android / iOS app to turn the light on and off, define timers, select the color, and/or dim the light. The aopp also supports 4 scenes for resting, reading, partying and casual use that you can customize as you wish. The LED bulb is also compatible with Amazon Alexa, and Google Assistant services so you can use voice commands to control the light instead. Bear in mind that you may need to wait a little longer to get custom firmware working for it, unless you are willing to get your hands dirty. But this looks so similar to “AI Light”, that I’d expect a port not to be too difficult.

You can purchase Sonoff B1 light bulb for $18 + shipping on ITEAD Studio website.

Apple Opens HomeKit Accessory Protocol Specification to Non-Commercial Projects

June 9th, 2017 11 comments

HomeKit is a software framework that allows Apple users to control smart devices with their iPhone or iPad. But so far, you had to become an MFI licensee to design a HomeKit compatible device, you product had to be tested by Apple, and – according to a story on Hackster.io – also required a special cryptographic chip for authentication. Developers creating commercial devices still need to become an MFI license, but Apple has now opened HomeKit Accessory Protocol Specification for non-commercial projects, meaning you can now use the Framework on Arduino, ESP8266 boards,  Raspberry Pi, and other development boards using software authentication.

You could already use HomeKit on Raspberry Pi board previously using HomeBridge, but the advantage now is that you don’t need to breach Apple’s terms and conditions, and you can talk directly to your phone without the need for a bridge.

If you want the specifications got to HomeKit’s developer page, click on “HomeKit Accessory Protocol Specification”, login with your Apple ID, and download the specs after the following disclaimer and agreeing with a license agreement:

HomeKit Accessory Protocol Specification

(Non-Commercial Version)

This document describes how to create HomeKit accessories that communicate with Apple products using the HomeKit Accessory Protocol for non-commercial purposes.

Companies that intend to develop or manufacture a HomeKit-enabled accessory that will be distributed or sold must be enrolled in the MFi Program.

Continue to License agreement.

Thanks to Harley for the tip.

Karl’s Home Automation Project – Part 4: MQTT Bridge Updated to Use YS-IRTM IR Receiver & Transmitter with NodeMCU

April 20th, 2017 1 comment

In a previous article, I wrote about an MQTT bridge by 1technophile. I added a DHT temperature and humidity sensor as well as a light sensor. Previously it included a software decoder to decode the IR signal. I never did test the IR transmitter on the gateway, as I didn’t have the parts. But thanks to IC Station, who sent me over a small YS-IRTM hardware based decoder and NodeMCU that I am writing about today. I have replaced the software based version with the YS-IRTM module in the latest update.

Click to Enlarge

Click to Enlarge

I found this project challenging. I admit I am a little weak in my programming skills. It was difficult to find documentation but I found a forum talking about this device and basics of how it works. When an IR code is recognized it sends 3 hex codes via serial connection on the transmit pin. To transmit, it expects 5 hex codes: A1,F1,xx,xx,xx. A1,F1 tells it to send the following codes. You can also set the baud rate but I left default 9600.

It is simple wiring wise. It only takes 4 dupont wires. It took a bit of coding to get it working but I finally got it to communicate via software serial. I started on a Arduino Uno with the code and then migrated it over to the ESP8266 board. I did have a little trouble when I first moved to the ESP board. I initially thought I might need a level shifter but that didn’t help. I am a little surprised I didn’t need a level shifter because the ESP needs only 3.3 volts. I was getting some weird responses and finally figured out I had to put in a slight delay. Maybe the ESP’s speed comes into play.

The way to use this is fill out your SSID and password and your MQTT server with credentials. Flash the device. You will need to add the necessary libraries. 1technophile has good documentation in his wiki.

Once flashed and ready to find your IR codes you will need to subscribe to the topics with the Windows command below. Give the gateway a moment to connect and point your IR remote at the sensor and press a button to find out code.

In your window, you will get something like this “home/sensors/ir 4,fb,8,” which is my power button for my TV. To test the code:

With this code, the TV will toggle on and off.

Click to Enlarge

After this you can use your favorite home automation project and control your IR devices with automations. You can omit any sensors that you don’t need. You will get some erroneous MQTT data if not all sensors are used. Below are the bits of Arduino code added for the IR module, and here’s the link to the github code:

I plan on 3D printing an enclosure with CR-10 I am reviewing, and I will remove the IR LED, and move it to a more suitable position, as both facing the same way isn’t ideal for my setup.

I would like to thank IC Station for sending the NodeMCU ($5.81 shipped) and IR transmitter and receiver ($3.39 shipped) for review. You can get 15% discount with coupon Karics. I finally have a complete gateway.

ESP8266, Mongoose OS & Grove Sensors – An Alternative Solution for Hackathons

April 12th, 2017 5 comments

CNXSoft: This is a guest post by Cesanta

If you walked into any Hardware hackathon over the last year, you would see they are about innovation and bringing new ideas to this world and most of them are centered around the connected devices nowadays. However, just walk the floor, talk to the teams and you can quickly see an elephant in the room. The Hackathons are about connected devices, but with the ‘recommended’ and frequently sponsored hardware distributed to the teams such as Intel Galileo, Raspberry Pi, etc…. developers may struggle for a long time to even connect it to the cloud!

Not to mention the innovation is usually hindered by a tedious environment setup which takes hours, things to learn about the specific hardware and how it can be programmed using low level languages. So many teams spent most of the time fighting with those issues and oftentimes still do not have their prototype ready and connected by the end of hackathon.

This situation can be improved by using ESP8266 boards with Mongoose OS and SeeedStudio Grove Sensors. The solution brings the following benefits:

  1. Low price:
    • ESP8266 development board is $4-15 depending on the board;
    • Seeed Studio Sensors are priced  $3 to $15 each, but you can also save by purchase them as a part of Grove Starter Kit for $39.
  2. The solution is solderless & plug and play – so anyone can actually use it fast.
  3. With Mongoose OS the firmware logic can be coded within few minutes using JavaScript code
  4. The data can be pushed to any cloud or public MQTT server such as Mosquitto, HiveMQ, AWS IoT, etc…

Let’s jump into the action and get ESP8266 & Seeed Light Sensor up and running with Mongoose OS in a few minutes. This example below shows how to get the hardware (sensor) data and send it to the cloud.

  1. Get your ESP8266 (e.g. NodeMCU) and Seeedstudio Light Sensor and Button ready.
  2. Download and install mOS tool for Mongoose OS. This works in Linux, Mac OS X, or Windows operating systems
  3. Connect the hardware
    • Power the Grove base shield: connect GND and VCC pins to the NodeMCU GND and VCC pins
    • Connect light sensor to slot 7 on the Grove base shield
    • Connect slot 7 to the ADC pin on the NodeMCU board
    • Connect NodeMCU board to your computer
  4. Program the board to retrieve the light sensor data and send it to the cloud (HiveMQ in this example)
    • Start mos tool, switch to the prototyping mode, edit init.js file
    • Click ‘Save and reboot device”
  5. Go to http://www.hivemq.com/demos/websocket-client/, connect and subscribe to the topic “my/topic”
  6. Press a button and see how light sensor reading is sent to the MQTT server

Light Sensor Data Shown on HiveMQ Dashboard – Click to Enlarge

Now you can see how easy it was! Want to play with other Seedstudio sensors from Grove Kits? Check video tutorials for button, motion sensor, moisture sensor, UV sensor, relay, buzzer, etc… including the one below with the light sensor.

ESPurna-H is a Compact Open Source Hardware Board with ESP8266 WiSoC, a 10A Relay, HLW8012 Power Monitoring Chip

April 9th, 2017 7 comments

ESPurna is an open source firmware for ESP8266 based wireless switch as such Sonoff POW, which I’ve been personally using to monitor my office’s power consumption. The developer, Xose Pérez (aka tinkerman), has now developed his own hardware with ESPurna-H board, as existing wireless switches with power monitoring functions would not fit into a gang box.

ESPurna-H board specifications:

  • WiFi Module – ESP12 with Espressif ESP8266 WiSoC
  • Relay – Songle SRD-05VDC-SL-C 10A relay with NO and NC connection
  • Power Monitoring – HLW8012 chip as found in Sonoff POW
  • Expansion – 2x 5-pin header with the programming GPIOs, and two connections for external button and LEDs
  • Misc – Reset button
  • Power Supply
  • Safety – Optical isolation between the logic circuit and the relay circuit
  • Dimensions – 50x50x20mm

Xose designed the board with Eagle 8.0 and released the schematics, PCB layout, BoM and other hardware design files under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA 3.0). You’ll find the files on github.

ESPurna-H with Custom 3D Printed Plate before Installation in Gangbox – Click to Enlarge

The board is not for sale, but you could purchase the PCB on OSH Park, purchase the components separately, and finally do the soldering yourself. Since this is a hobby project, not specific safety testing has been done, and you’d better understand what you are doing since the board is meant to be connected to the mains. Even companies do it wrong from time to time. If there’s a design flaw with the board it could overheat melting the plastic around, and in the worst case even start a fire.

Xose completed the setup with a capacitive touch switch attached to the cover, in order to turn on and off the light, and the final results above looks quite neat.

Transform Your ESP8266 Board into a USB to Serial Board Easily with Arduino Serial Bypass Sketch

April 7th, 2017 6 comments

USB to serial boards are necessary to program and debug boards, and/or access the serial console, and while they are very cheap, you may be in a situation where you don’t have any around, but you do have some Arduino compatible boards. It’s been possible to transform an Arduino board into a USB to TTL debug for several years using ArduinoSerialBypass.ino sketch, but I’ve been informed this also works on ESP8266 boards such as Wemos D1 Mini.

The sketch could not be simpler:

The code simply makes sure that Tx and Rx pins are set as inputs in order not to disturb the serial connection as explained below:

This code makes the Arduino not interfere with pins 0 and 1 which are connected to RX and TX on the FTDI chip. This allows the data coming from the FTDI USB 2 Serial chip to flow directly to another device. Since RX and TX are labeled from the Arduino’s point of view, don’t cross the wires, but plug the device’s RX wire into the RX pin 0 and the TX wire into the TX pin 0

This should work with any Arduino compatible boards with a USB to serial chip, but it’s nice that it has been confirmed to work on Wemos D1 mini. If you’d rather get a WiFi to serial bridge, that’s what ESPLink firmware is for.

Thanks to Zoobab for the tip.

Categories: Espressif, Hardware Tags: arduino, esp8266, how-to

Need to Program Many ESP8266 Modules? This Wemos D1 mini based Pogo Jig Programming Board Could Be Useful

March 8th, 2017 5 comments

If you have many ESP8266 modules to flash with your own firmware this may be time-consuming, but Wing Tang Wong’s ESP8266 Pogo Jig Programming Board could greatly streamline the process, as it just hold ESP-12F module in place using pogopins, so you can go through boards quite quickly.

Wemos-ESP-Pogo V1.0 Board – Click to Enlarge

You’ll just need to a Wemos D1 mini board without ESP-12F module to the programming board, and then place your ESP-12F module (or compatible) between the pogopin to program it through Wemos D1 mini’s micro USB port.

The board is not for sale (yet?), but the EAGLE design files can be found on Github, and it should not be difficult to find a company to manufacture a few if you need it.

Via OSH Park’s Blog.

Categories: Espressif, Hardware Tags: esp8266, open source, wemos