Amazon Smart Bulb

Csndice RGBWW Smart Bulb (box, front view)

We have a little log house (which we built ourselves and used to live in) which we let out as a holiday cottage.  It’s something that is (generally) fun to do and also pays a few of the bills, but one of the big mistakes we made when we put it together our large, wooden Lego kit was to put too many light switches in a single location (if you live in a house long enough, you’ll eventually remember what most of them do, but for short-term visitors it’s just plain confusing, even with little stick-on labels).  So one of the things we find happens quite often is that one (or two …or five) of the outside lights are left on all night (and might be left on all day too, if our guests head out in a hurry in the morning).  Long ago we changed out all of the bulbs for the little CFL corkscrew types to reduce the overall power usage and we thought we might get around to replacing them all with LEDs, if the prices ever come down.

To compound the mistake with the switches, we also bought almost all of the external lights with E17 size fittings (about half the size of a normal household bulb), not because we really wanted them, but because that was the only size the maker supplied the fittings in.  This latter issue came back to bite us when I decided I could fix the lights-left-on problem by replacing the CFLs not just with LED bulbs, but with “Smart” LED bulbs (Wow-weee!).

Nope!  No smart bulbs in E17 form-factor (at the time).  So I did what any other self-respecting ESP hacker would do and, when one of the CFLs died a noisy, sparky death one day; I chopped off its head, ripped out the charred remains of the inverter and replaced it with and ESP01S, a TRIAC and one of the brightest (and cheapest) E17 LED bulbs I could find.  I stuck my little FrankenShine monster (I admit, it wasn’t particularly pretty) into the fitting right outside our kitchen door, so that we could play with it and monitor it without inconveniencing any of our guests during the initial testing and burn-in period.

(FrankenESP) Photo of DIY E17 ESP01S light assembly

The FrankenShine in all of its glory …The ESP01S and other DC components are at the extreme R/H end of the board, with the opto-isolator to the left of the programming header.  The TRIAC is closest to the camera (slightly left of centre) with the PSU sitting over at the back.  You can just see the PROG/RUN mode jumper partially hidden by the big, black electrolytic.

I set up a TASMOTA rule to switch it on at dusk and off again a few hours later and coached my better half in how to communicate her wishes to the nice lady stuck inside that tiny, pinky-orangey UFO thingy that landed on the kitchen counter a couple of years ago (…and always say “Thank you”, because we want our grandchildren to grow up to be polite).  So, (her) “Hey Gewjull!  Turn on the kitchen door”.  (GH, pertly) “I’m sorry, I don’t know how to turn on the kitchen door”.  “Hey Gewjull, turn on the effin’ kitchen door!!”.  (GH, sullen) “Okay, turning on the effin’ kitchen door”.  “Thank you!”.  (GH, stilted and mechanically) “That makes me so ‘effin happy”.  Ah, another successful foray into the world of home subjugation.

For a while, everything went along swimmingly.  In fact we got so used to coming home at night and being able to see the keyhole that the transfer of FrankenShine to the cottage was delayed, several times.  Then one evening we came back to a dim, flickering welcome …uh-oh!  A power-cycle cured it, but only for about five minutes and then it was back to flickering again.  A PSU problem?  More likely a TRIAC issue.  Gottverdeckel!  I pulled Franky out and put the LED bulb back in the fitting (yup, works okay).  Unfortunately, as usual with these intermittent problems, Franky worked fine on the test bench, with not a flicker to be seen.  I went back outside and gave the light fitting a couple of dunts with the flat of my hand to test for loose connection, but no flickering or dimming was evident.  And so everything remained as it was for (quite) a while  …until I decided to replace the CFL in the worst offending cottage light fitting with an LED bulb, anyway (Franky or no Franky).  The light itself was identical to the test fitting next to our kitchen door, but was some four years older.  I opened it up and, lo and behold, it was an E26 holder assembly.  “Oh crikey!” said I (or maybe something similar), all of this mucking around and I could have just gone out and bought an E26 “smart” bulb and flashed it with TASMOTA.  At about the same time, the E17 bulb in the kitchen door fitting couldn’t contain its hilarity any longer and started flickering and dimming intermittently again (no Franky involved). “Oh double crikey!” (or words to that effect).

Anyway, suitable chastened with my unsuccessful techie adventure and unreliable memory, I went off to Amazon (Japan) and searched for an E26 bulb with a high output (lumens) and cool-white hue, suitable for an outside fitting.  Box (side-panel, specifications)What I finally decided on was a “Csndice” branded,  RGBWW bulb that had a 900lm stated output and an adjustable colour temperature between 2700 and 6500K.  In addition, it was tagged as being compatible with Google Home and Alexa, with “no hub required” (which is usually a pretty good indication that there’s an ESP variant in there and that it can be flashed with TASMOTA).  It wasn’t particularly cheap, but I can confirm that it is easily converted to TASMOTA (with the excellent Tuya-Convert) and seems to work reliably (my better-half has started to complain about the “Geriatric disco mode” of the colour sequencer test).

This particular bulb works with the Qualitel ALS08 setting from the TASMOTA templates repository.

Photo of CSNDICE smart bulbThe light (in WW mode) is very bright and easily equals that of the CFL.  It has the added bonus of being easily adjustable (from sliders on the TASMOTA main-menu page) if you prefer a particular hue of white output (from “cool” blue through to “warm” yellow).  If the fancy takes you, you can also fiddle with the RGB settings to have a particular colour and shade, instead of that boring old white.

To help you (well, okay, to help me) test out the functionality and reliability, I’ve put up a simple, command-line exerciser on GitHub.  You’ll need to change the variables (at the top of the file) to use your TASMOTA MQTT topic name (variable: BULB_ID) and your MQTT broker (server) IP-address or name (variable: MQTT_SERV).  After that, you can just run the program from the command line with no options or arguments (to turn the bulb on in white, neutral hue mode), or use one of the following options:-

  • -c — “C”ool white. Switches on the WW LEDs in the bulb with a blue hue.
  • -w — “W”arm white. Switches on the WW LEDs with a yellow hue.
  • -n — “N”eutral white. Switches on the WW LEDs with the hue set mid-way between cool and warm.
  • -o or -0 — Switches all LEDs (RGB and WW) off (that’s a zero, by the way).
  • -s — “S”equence. Turns on various colour mixes of RGB for 2 seconds before fading to the next colour (Control-C to quit).
  • -d — “D”ebug. Fairly quiet debug output.
  • -D — “D”EBUG. Very verbose debug output.
  • -h — “H”elp. Basically this command listing.

Now you too can have fun at the geriatric disco.

ESP01S USB Adapter Mod

Up until a couple of months ago, I’d never been interested in ESP01 modules (it seemed fairly pointless to buy an ESP8266 crippled by both lack of memory and lack of IO pins when the price wasn’t substantially different). That changed recently for a couple of reasons. Obviously, the appearance of the 1MB ESP01S modules made a huge difference to the functionality of the ESP01 (TASMOTA would fit comfortably into flash and they became OTA upgradeable), but I also had the need for some physically small modules, as I’m adding functionality to some external light fittings (more on that below†).

ESP01S module and Adapter

When the modules I’d ordered finally arrived, I was pleasantly surprised by their compact size and by the 8-pin connector (I hadn’t, before now, tumbled to the fact that people might be buying these simply because they were easier to solder than the minuscule, castellated edge connections common to the other modules in the family). After assembling a prototype, I ordered more ESP01S modules and, on impulse, added a $1 USB adapter (left), which looked like an easy method of programming and testing the individual units before installing them into the main boards.

It was only when the adapter arrived that I realized why they were priced so cheaply …no reset switch, no programming switch and none of the RTS/DTR auto-program mode selection of the NodeMCU (and knock-off) boards. Duh! It turns out that there’s a very slightly larger version of the ESP01 USB adapter (with a red PCB, so it’s easy to identify) which does have a programming switch, but it sells for about $3.20.

Anyway, all was not lost; rather than wait another month for another order to perhaps arrive (and we’re getting a little too close to the Chinese new year to have warm and fuzzy feelings about estimated delivery times), I thought I’d just hack the existing $1 version to be programmable. This turned out to be even easier than expected (and even I didn’t expect the addition of one switch to be hard).

I had a bag of about 100 “tact” switches sitting in the parts bin, but if you don’t happen to have any to hand, I recommend dead, ancient, mechanical mice as a source of (usually) good quality tact switches.

Switch supported by yellow connector body

After fiddling with a switch and the USB adapter for a couple of minutes, it seemed obvious that attaching the switch to the side of the board (with the button facing horizontally outwards) at the yellow connector end of the board was a pretty good position; the switch connections were next to the ESP01S pins and the body of the yellow connector provided mechanical support. My board had the characters “HW-305” on the top surface of the PCB, just where I situated the switch.  I’m not a huge fan of hot glue, but in the spirit of a $1 hack, it looked like a good choice for this assembly. Cutting a bit of fairly dense, firm foam (shipping protection for the pins of some ICs) to shape provided a nice shim between the side of the connector and the bottom of the switch and with hot glue on both sides (as well as just a smear down the edge of the PCB), the switch was firmly held in place, even when pressed.

 

Bottom, showing switch connections

On the reverse side of the board, both of the pins we need (GND and GPIO00) are on the inside row of the connector. The ground pin is right next to the edge where the switch is situated and GPIO00 is the third pin in. I decided to use a resistor between the switch and GPIO00 for a couple of reasons …first, I have an aversion to connecting pins directly to VCC or GND and secondly, the resistor body provides extra support for the switch. I happened to use a 1k5 resistor, but the value isn’t critical and anything between 3k3 and 100Ω should work fine.  As the unit comes with unprotected soldered connections on the bottom anyway (and I’m using it on a wooden tabletop), I’m not going to worry too much about insulating it. 

Completed adapter mod with ESP01S mounted

Does it work?  Heck yes!  The switch is firmly supported against the connector body, so it’s very easy to press it at the same time as inserting the adapter into a USB port.  Obviously, inserting the adapter without pressing the switch drops the ESP straight into normal “run” mode.

 


 

† – We have about a dozen outside lights scattered around the property.  They all use E17 base bulbs (the little brother to the normal E26/E27 screw type base).  Unfortunately, there’s a severe dearth of “smart” bulbs with E17 bases and zero (that I can find, anyway) that are “smart” and (importantly) have any sort of useful light output.  I’ve started using these LED (“dumb”) bulbs, which give way better output than the older, equivalent compact fluorescents and are much smaller, too.  Using these, I can cram a mini PSU, ESP01S and a Triac (plus driver) into a cut-down compact-fluorescent base and still fit it into the oblate glass cover that these lamps all have (saving myself the hassle of running an extra neutral wire into a dozen switch boxes and/or the cost of replacing a dozen outside light fittings with E26 versions).

The ESP01S runs TASMOTA which makes control fairly trivial.  The default mode is “on”, so the light switch still works.  The lamps have a couple of  TASMOTA rules enabled; one to switch on at dusk, plus or minus a few minutes and another to switch off at about 4.5 hours after dusk (nice for coming home after dark and being able to see the keyhole).  As a bonus (though not, I have to admit, particularly useful), they all become voice controllable, too.