Musings after buying a smart plug

I know that people will go and start ranting on using terms like “Internet of Shit” just for the title I’m using here. Despite being as wary and cynical about the subject of connected appliances as the next security-aware engineer, I want to point out that those reactions are blind and lacking empathy. So if your answer is to think that you’re smarter than the plug and me combined, there’s maybe no reason for you to stay around to read the post.

I also need to put the usual disclaimer forward: I work for Google, a company that produces “smart” appliances. I don’t have anything to do with the hardware products, have no special insight into them, and I am her talking about things as myself alone. I’m also not really talking about Google hardware beside for a few references to the Assistant here and there, and that’s simply because I happen to be using Google Home as my hub.

As I said I’m fairly cynical about smart appliances. It took quite a bit for me to even buy a single one, but I’m now a very happy user of a LIFX Mini Colour smart bulb. It was probably this year’s best gadget buy for me, and it is not just about the ability to control the light with an app on my phone — or with the Assistant. The bulb can dim, change colours, and can be set onto a dynamic schedule. It’s extremely convenient, and an improvement in my quality of life, particularly by setting it to red as I go to sleep, instead of keeping it bright white.

Of course, like always when buying a device that relies on external services to work (the infamous “cloud”), I am still worried about the risk of the company going under, or dropping support for my specific device, and letting me deal with the broken pieces. But quite honestly, if you tried to avoid all the cloud-based services and hardware nowadays, you will end up a luddite. And maybe you want that. Besides IKEA, that requires their full bridge, I don’t know of any other smart home brand that provides local-only controls — and local-only means no talking to the Assistant to turn on the light as part of the morning routine.

I’m happy enough that my LIFX can be controlled without an active Internet connection (this happened before). Maybe I’ll follow Matthew Garrett’s example and start reverse engineering it into a Python script for the rainy days.

But I digressed enough. What I wanted to talk about was rather smart plugs. Because that’s a device I’m not entirely sold on the idea of smart plugs, I started the original draft of this post because I thought they were completely useless. I changed my own mind as I was writing this, and that’s why I actually wanted to post this.

So why did I buy a smart plug if I am not sold on the idea? Well, since this is our first Christmas together, my girlfriend wants to have a proper Christmas tree at home. And since I would like to see the tree while I approach the apartment on the bus or on foot (hey, I have not had a Christmas Tree for more than a decade, I can have some fun!), I would like to have IFTTT turn it on for me.1

I ended up buying a TP-Link Smart Plug (UK version), which comes with their own app, and integration with the various services including IFTTT and Google Assistant. Which means we’ll be able to say “Hey Google, turn on the Christmas Tree!”

There are differences between a smart bulb and a plug though. The former adds a significant amount of value add, with things like dimming, different colours, and so on. A smart plug is still only a binary operator, it’s either on, or off. You cannot do fine-grained control over that, you can only turn things on or off.

So after thinking about this, I realized there are a few requirements for something to make sense to have connected to a smart plug:

It needs to be something that cannot stay on standby the whole day. Because if it can, there’s no real advantage in having a smart plug for it, keeping it in stand by is easier, and can easily be cheaper, as the stand-by of the plug connected to WiFi might be higher consumption than the device itself.

It needs to be something that can be at least “readied” unattended. Turning on the plug for a hairdryer is not going to be very useful, if you’re not there to use it. Also if readying something unattended is too risky, it’s a bad idea to use a smart plug. This is the case for clothes irons for instance; I wouldn’t want to turn mine on if I’m not there to make sure that it’s not on top of something it shouldn’t be.

If it’s something that comes with consumables, it needs to have big enough reserves, or a way to feed itself. Going back to the clothes iron, the one I have does not have enough of a water tank. If I was to turn it on too soon, it would just waste all of it and I would go and find it empty, which is just as bad.

Given these considerations, one of the common suggestions I hear is coffee makers. At first I thought this was pointedly American, as indeed a percolator style coffee can be filled in in the evening, and then be set to turn on in the morning and make coffee for you to drink. When I spent extensive time in Los Angeles, I used the timer on a percolator to make sure I would have hot “coffee” ready immediately after waking up. But then I realized that this is very similar for Italian-style espresso machines, too: they have an internal boiler that takes a while to get to temperature and be usable, they usually have a tank big enough for a full day (or in some cases they may be connected to the water mains), and they consume enough power in standby that you wouldn’t want to keep it turned on overnight. For those who don’t drink coffee, the same can be true of automated teawakers or teamakers — I had one from Twinings back in Italy.

Another appliance that fits the bill fairly well is the electric bathroom heater, or towel rack. Heating in general is likely better suited by a smarter “whitebox” approach — indeed I have booked an appointment to install a Nest thermostat at my apartment, after getting my landlord’s permission, because I want to be able to automate hot water availability and easily tweak the temperature over the day. But in some cases, you have additional bathroom heating that has less control: I have on/off towel racks in my bathrooms in London, and my mother uses a small electric heater in Italy, after we messed up with the house’s heating plan by replacing a bulky and leaky boiler with a more modern and efficient one.

Now for both of these examples, smart plugs are not the only obvious solution. Indeed, percolators, teawakers, and espresso machines, as well as many small electric heater, often come with their own timer. This works great for the people who have a clear schedule and fixed routine. In my case that’s rarely the case: I wake up at a different time depending on what my day looks like, sometimes I oversleep because I had a bad night, sometimes I’m up earlier than average because my girlfriend is staying over and she has to go to work. A similar result exists for my mother due to different requirements: she lives alone and really doesn’t have any reason to get up a fixed time unless she’s waiting for deliveries, services, or stuff like that. And since the house is on two floors, and she has knee pain, being able to turn on the heating, get the bathroom ready, or make sure that the coffee machine is warmed up without having to get downstairs immediately, would be a very nice feature.

I can definitely see myself appreciating the idea of saying “Hey Google, Good Morning”, and know that by the time I finished listening to the BBC News headlines, the coffee is ready and still hot for me, while the bathroom is warm enough to take a shower in. Doesn’t really work for me here, because I make pour-over coffee, and the towel rack is not controlled by a normal plug, but I can dream can’t I?

By the way, Google Assistant can do that, although it’s a bit hidden: from the [Home](https://play.google.com/store/apps/details?id=com.google.android.apps.chromecast.app app, go into the Account tab (the last one on the right), click Settings, go to the Assistant tab, and then select Routines. From there you can set up the actions you want taken when you give it a specific hotphrase.

For most of other appliances, I would probably need more whitebox smartness. I already rely on the timer for my washing machine, but it would be nice to just put it into “standby”, loaded and locked, but not start it until I wake up, or until I’m actually leaving the apartment (I don’t get woken up by the noise of the one I have here in London, but I would have been by the one in Dublin). And something that can remind me was I get home (“Hey Google, I’m home”) that I need to unload the dishwasher.

One of the things that I actually nearly considered giving a smart plug to was the Air Wick freshner. While I would love having a fine grained intensity control that would keep a background fragrance during the day, but raise it just as I’m ready to get home, to make me feel good, just having the ability to turn it off the moment I leave and on again when I come back home, would be a very nice thing to have. On the other hand, it turns out that the plug-in device consumes significantly less power than the smart plug in stand-by, so it makes no sense as it is.

I guess using more sophisticated fragrance delivery devices, such as Yankee Candle’s Scenterpiece (that my mother has, at home) would make more sense. Alternatively, Muji has very nice oil burners, though they have a small tank for water, and candle warmers are getting more common (these are probably better than the Scenterpiece in my experience). Unfortunately these are usually table-top devices, rather than plug-in, and I don’t have the space where I would want to use it. So if someone from Air Wick or Ambi Pur is reading, consider that I would pay just as much as a smart plug to have a smart plug-in freshener that can be set to adjust the intensity over the day!

So to close it up, I’m somewhat skeptical about getting more smart plugs for myself, but I can definitely see a number of useful cases for them, as well as for smarter “whitebox” appliances. Indeed, if my mother had a decent Internet connection in 2018, I would probably set her up with quite a few of those, to make her life easier. Call them accessibility helpers, maybe.


  1. You may remember that I have some particular attachment to Christmas lights Rube Goldberg machinery. The idea of having my own IFTTT-compatible smart Chrimast light tube did pass through my head. 

Some news about my christmas lights

So today I was able to ask to a couple of friends who knows electronic way better than I do, and they confirmed what I was already thinking. The IN4007 are actually 1N4007 diodes, simple 1000V-rated diodes, and the way they are used is just a standard Graetz bridge (a rectifier bridge).

For those who want to see what I’m talking about, I uploaded the photos on Flickr, see the set here .

After passing through the diodes, the 220V AC wave is replaced by a (very bad) approximation of (about) a 220V DC supply. I wonder if it was the unstable supply (there is no capacitor to smooth the wave) that blew up the SCR.

The 180KΩ resistor is part of the CR/RC net (not sure what it is yet, I haven’t dug that up, as I don’t much care), together with the capacitor; they are used as a timered trigger for one port of the actual controller, so I’m counting them off, as I need to replace the thing anyway.

The 240KΩ resistor is used to reduce the voltage that powers the controller, not knowing the current absorbed by the controller, it’s difficult for me to guess which voltage was given to the controller. I could probably just plug the thing in and take a look with a voltmetre. It’s anyway superfluous, as the controller is, once again, something I want to get rid of.

Now what I know is that the lights are powered by DC, there’s no resistor, so the direct output of the bridge is used, they probably don’t need the supply to be stable at all.

So now I know something more about the thing I’m working on, which is an interesting thing. Now I just need two ideas to complete the basic design of the thing, so that I can move to a proper design with microcontroller and code.

The first idea is how to reduce 220V DC to something usable for the microcontroller supply; for smaller voltages I usually used LM7805, but the LM78 series does not support voltages higher than 40V; a quick search around suggested that the LM78S series could actually support 220V voltage, but I can’t find any datasheet of that series, nor I can find the ICs anywhere around.

The second idea is how to dim the lights; what I was thinking of was using a digital potentiometer, I know I seen some of those around, but I’m not sure if they work well with a 220V passing voltage, and how easy are to actually program.

I’m also wondering if it’s easier to get an IC for the diode bridge or just using the four diodes as the current PCB does (adding a capacitor to smooth the output); I seen Texas Instruments have DIP packages with two or four Schottky diodes, but those are rated only up to 50V, I need at least 240V.

Any suggestion is welcome :)

Christmas tube lights

So, my mother is preparing the house for Christmas, yes it’s tremendously late, but this year we had some problems, somehow related to my health condition.

One recurring problem with Christmas time, is when the lights break. In most cases the lights lasts for enough years to let us just throw off the broken ones, and get new ones. This year, though, a tube of light broke down, this was bad because I bought it just four years ago, and they aren’t as cheap as standard lights.

So I opened the controller box on the cable to check it out, and indeed, one of the ICs was burnt down. The IC is a PCR406J, produced by UTC. For what I gather on Google, this IC is used in mass production of Christmas light controllers, it works directly on the 230V alternate current, although I’m still not sure *what the IC does*… (the best I could find is that it’s a Silicon Controlled Rectifier I can’t seem to be able to order that IC anywhere on my usual webshops, and also for what I read it’s also hard to find in standard shops; also, the lights controller might as well be fried, if something was able to fry this IC.

So what are my current options? The first and probably easiest is to throw away the tube, and buy a new one. But it’s not funny to do.
The funny thing to do is… design a new controller! :)

I certainly won’t be able to design it before this Christmas, or before the end of the holiday season, but I can try for next year’s at least. It will be a nice project to distract me from other more complex stuff, and might finally give me the time to refresh my electronic skills, as I don’t want to die knowing to do just one thing (developing).

Right now, I need to find how the thing works: it’s entirely AC-powered, no transformer or converter of sorts. There are the two PCR406J, a 50V 10µF capacitor, two resistors (one 180KΩ, one 240KΩ, neither seems to be ready for high power dissipation), and four things that are probably diodes, they seem to be IN4007 from DC Components (they are Rectifiers, but I admit I don’t know what they are or what they actually do). The board is certainly handmade, and the only two components I could track down to a producer, are Chinese, so I suppose the whole thing is Chinese.

The lights themselves look like a lot of LEDs, but I somehow doubt they are actually LEDs, probably some gas lights or something like that. The lights are connected through three wires, one red and two black wires. I know there are two series of lights, so one is the common (probably the red one), and the other ones are returns for the two sets. Also, as one of the programmed modes had the lights fading in and out, I’m sure that they work at different voltages, and they decrease their luminosity depending on the voltage they are given.

I start to doubt they actually use 220V and even less that they work on AC, as the red wire is connected to two rectifiers, each of one connected to one of the two mains’ wires. I suppose this could be the part of the circuit that straighten AC into DC, although I’m by no mean expert of that. The 220V idea was mostly killed by the 50V capacitor, and the size of the two resistors.

This is the time when I’d like to have a controllable power supply like I had in the lab at school, to check out which voltage do the lights take correctly.

Actually, I think the capacitor and the 180KΩ resistor could actually be an RC net, which makes sense, as the controller changes the program after a few seconds. So I should probably ignore those two, as they are part of the controller. There is also a button used to change the current program, but that just concerns the controller circuit which I don’t care about.

The controller is connected to the two SCRs (PCR406J) by two lines, which are, as far as I can see, connected the gates of the ICs. Which makes sense, as the controller decides when to turn on either of the lines.

I have doubts right now on how the thing the fade in/out thing, as that was a pretty nice effect.

Now, I suppose it shouldn’t be too difficult to design a new controller, maybe with some extras like music (this one does not support it), through a programmable (versus hardwired) microcontroller. It might not be convenient (as in it could probably cost more than a new tube of lights) but it would be interesting.

My main problem now is how to control the lights, do they work in DC or AC? Which voltage do they support? If they work in DC, I suppose I could get the fade in/out effect by using a potentiometer, a digitally controlled one for instance, or by using two properly sized capacitors.

If I need DC, I can use that to power up the microcontroller, otherwise I can simplify things by using batteries to power it.

Anyway, this is the start of a new project for me. If someone can help me by providing information I might be lacking in all this, it’s certainly welcome. As it would be welcome a configurable power supply, or at least some idea on where to find a cheap one.

Oh by the way, there’s a good side to writing your own lights controller if one breaks, I think and hope: it should produce less waste to just create a new controller rather than throwing away the old lights and buy a new tube.