For decades, we dreamt of a future where all of our electronics used a standardized power connector. Most of us probably didn’t expect that USB would ultimately fill that role, but we’ll take what we can get if it means a future without getting a new wall wart for every piece of tech we buy. From soldering irons to laptops, the number of things you can power with a lowly USB cable these days is pretty incredible.
Which makes it all the more surprising it took so long for somebody to come up with a way to toggle USB devices off and on over the network. The Sonoff “USB Smart Adaptor”, which the company says will start shipping before the end of the year, is the logical evolution of their exceptionally popular mains voltage smart switches. The Smart Adapter is designed to go between the device and its existing power supply, allowing the user to drag any USB powered device kicking and screaming into their existing smart home setup. All for the princely sum of $6.50 USD.
In the video after the break, Sonoff gives a few potential uses of the Smart Adapter: from controlling a string of LEDs to limiting how long a smartphone is allowed to charge for. But really, there’s a nearly limitless number of devices which could be easily and cheaply integrated into your home automation routines thanks to this gadget.
On the other end of the spectrum, those who are looking to keep a tighter control on the ears and eyes that are active in their home could use the Smart Adapter to make sure their Google and Amazon listening devices assistants are only powered up during certain hours of the day.
Unfortunately, there’s a catch. Sonoff smart switches are best known, at least among the type of folks who read Hackaday, for the fact that they’re based on the eminently hackable ESP8266 microcontroller. Given the size of this product and its intended use, it would seem logical enough to assume this device also utilizes the insanely popular chip. But according to a Sonoff representative, the USB Smart Adapter won’t be using an ESP at all; leaving its hackability an open question until people can actually get their hands on them and start poking around.
A Challenger Appears
So if there’s not an ESP heart beating at the core of this device, what is there? Sonoff says the chip is called the CKW04, which is apparently so new that there’s very little information available about it online. The best source of information we have right now is a cache of Chinese technical documents posted to GitHub by the manufacturer, CoolKit.
The tiny QFN-48L chip measures just 6 x 6 mm, and provides an all-in-one WiFi solution just like the ESP8266. According to the documentation, it also seems to have some sort of integrated timer functionality to trigger a dedicated GPIO pin on either a delay or a regular interval.
Whatever other advancements they made with their chip, it looks like the fine folks at CoolKit haven’t managed to improve on the ESP’s high energy consumption, though. The documents list a maximum current of 345 mA at 3.3 V, with an average energy consumption during normal operation of approximately 80 mA.
Unfortunately, it doesn’t seem like there’s any information about the software side of things, such as what the toolchain would look like to get your own firmware on the CKW04. Nor does it appear that any of the documents actually lists the chip’s specifications. Beyond the quick mention that pins 10 and 11 can be used to flash a new firmware, you wouldn’t even know the thing is programmable.
There’s plenty of hackers out there who want to write (or at least modify) the firmware that runs on their devices, and the ease with which you could do that on Sonoff’s ESP8266-based products was a definite selling point. With a new and only lightly documented chip under the hood of the USB Smart Adapter, it looks like the Sonoff hacking community is going to have to play catch up.
But who knows? The success of the ESP8266, originally intended as little more than a WiFi to serial bridge, took everyone by surprise. Perhaps by this time next year, the CKW04 will be the hot new MCU that everyone’s hacking on.
How likely is it that this is a scratch build? Hopefully it uses a toolchain in common with something wr’ve already got.
The rise of the ESP8266 was kind of a happy fluke, and hackers like me have benefitted mightily. Manufacturers like Sonoff and Tuya have exploited its ease of use to grow the home control market… and we have exploited the ability to reflash them, because they can’t be locked down.
But it’s probably naive to expect that the next generations of commercial IoT chips won’t be locked down. So there’s a great opportunity here for someone to make an ESP8266 or ESP32 based USB to USB (or 5v to USB) switching device and sell a few on Tindie.
We need to get manufacturers of those IoT gadgets to embrace the open source and DIY community. Maybe it’s time for Naomi to do the magic she did with Creality? :)
Likely not, even if the hackaday community is happy with partial openness as opposed to none.
Some loud opensource absolutists “100% open source or DEATH!” have harassed Naomi and Creality enough that the next printers likely won’t be open source hardware.
As steps towards the right direction are naturally enough for some folks.
If Sonoff makes money selling sub-ten-buck modules, giving you the control software for free and provides control via their servers at no charge, why would they care if you repurpose the module with 3rd party firmware or your own code? They make the same amount of money regardless…unless knowing what time you turn on the lights is worth something to somebody.
I suspect that for most companies, having such a great record of home activity married to your credit card info would be very attractive. And charging you monthly or annually to use their cloud and apps is going to be a great ongoing revenue stream.
Lolz conspiracy theories roflcopter
Because we didn’t see this happen in the past decade. Oh no, wait, that’s pretty much exactly what we now know has been going on for a while.
For any modern company, having users locked into an ecosystem is the main selling point when attracting investors or when looking to be bought out for huge sums of money. Most times the worth of the company is its client base and having user accounts active on your server is proof of that client base.
I have to assume that Sonoff knows that a good chunk of their devices are being re-flashed, given that they sell more than ever hit their cloud servers.
I just hope they see it as a profit from a niche market that they otherwise wouldn’t have as customers and embrace it. I assume they do since they keep leaving breakouts on the boards…
I’m pretty sure that “good chunk” only they know the true size of is not even one device in a hundred, which is why they don’t bother giving a f##k about it either way – much like with everything else that gets popular in any DIY scene where the echo chamber effect prevents people from realizing how thoroughly irrelevant they are to sales compared to the sheer bulk of the goods shipped to everyone else.
And the popular threat of “influencing” others is equally worthless – so many things have proven themselves seriously lacking to those who understand the underlying tech, yet hardly any ever actually suffers any drop in sales in spite of all those techies swearing to bring them down; nothing really happens until things start bursting in flames of have their server switched off or get hacked, at which point the public at large goes “oh noes” and collectively drops the item like hot potatoes (or just continues to not give a crap). What we think of it? Only we care…
It would be interesting to know exactly how much it costs to graft secure-boot capability into a SoC. It’s certainly not zero, you need the ability to burn a vendor key into storage that can’t be modified afterwards(and you need to actually burn it during manufacturing, as well as handling the secret keys and code signing during firmware development); and doing cryptographic checks very early in boot means a more complex boot loader that need to be written to a higher standard.
That said, it’s probably not a whole lot, and if it is a commonly demanded feature volume could easily make it an effectively baseline feature if having multiple SKUs is more expensive than standardizing on the most popular one.
Merely having the capability wouldn’t guarantee that all vendors would use it; but it would make it more popular than the scenario where you have to specifically chose the part that costs 10 cents more in order to have the option.
Anyone know what the cost might be? Any already released parts that differ only in boot loader crypto and price?
Possible scenario: you invest in Sonoff products. Then they’re bought from a larger company. The switches are left unsupported and the server decommissioned (it happened to me with Runtastic products)
Naturally the darker side of is that they have an app on your phone, an unknown device on your network, and credentials. Nothing saying ESP chips are secure, either, of course.
There is a copy using ESP8266 already, but not as far as I know Sonoff firmware. I have this one, it’s pretty good, even if you unplug it, it gets updated after a short while as Off.
can you provide a link?
Looks like this chip (CNXSOFT found it https://www.cnx-software.com/2019/12/12/icommsemi-sv6166f-is-a-low-power-wifi-andes-risc-soc-for-iot-and-embedded-systems/):
http://www.icomm-semi.com/Uploads/Temp/files/20181205/5c074a3a55977.pdf
A on-chip dcdc is nice, and should provide a better power efficiency!
You are right, it is SV6166.
I have got a smart light switch from Cookit already, it used SV6166F
I dont understand what’s keeping you from using any Esp8266 with a bypass for this?
Besides everyone not knowing what a bypass is, nothing.
I believe that the existing Sonoff series is based on the ESP8285 rather than the ESP8266.
I use a LOT of smart switches in my home, but I can’t think of a single application where I’d want to remotely power on/off a USB device.
This. Plus, I’d be skeptical how well power delivery would work through one of these. Much easier and more reliable to bet on a mains voltage smart switch in which you plug the device’s wall wart.
Since it’s USB-A – the answer as far as PD is “not at all’
I can think of a few. Number one being able to turn off charging my phone at night once it’s at full.
I don’t understand why you would ever do this though? It doesn’t save any power in the end, except maybe if you turned off the brick at the wall, but to turn off the brick you need another smart device running on it that draws power, netting this back to zero gain from a power usage standpoint, and waking up with a marginally less charged phone as a secondary result.
Many people mistakenly believe that it harms your phone’s battery to “charge it past 100%” because they are not aware that lipos and such have had integrated charge controllers for over a decade. You can safely ignore these people, generally.
Charging past 100% isn’t a problem, but ever getting close to 100% or 0% in the first place is. You can get a huge cycles life increase (2 or 3 times more) by not deep cycling and not fully charging.
Not with lead acid though, they like being full.
People that doesn’t know avout charge protection circuits don’t care about their batteries much.
On the other hand people that know about batteries a bit know that lithium batteries sees more degradation the more you keep it near 4.2V. Plus some charge protection circuits cut-off voltage are 4.25V, which is enough to prevent explosions, but does not help prolong battery life.
If you cut your battery charge at 4.1 or even 4.0V , you can triple the number of cycles your battery will take. See solar community for that, they often use such strategies to have super long lasting batteries (not in terms of Wh capacity, but in term of cycles).
Obviously, the same occurs if you discharge your battery too low, but that’s not something we need a device to handle.
When lithium batteries are topped up, they form “dendrites” that create a path for current that decreases the efficiency of the battery. So the farther you are from 4.2V and 2.5V the less subjected you are to this, the better your battery maintains. That’s why we keep lipo at 3.7 for storage.
Plus, you don’t lose much capacity by going from 4.2 to 4.1 (capacity is not a linear function of battery voltage, below 3.3-3.2V there’s not much capacity left, and above 4.1 there’s not much more to store).
Don’t think of it as USB. Think of it as wifi-controlled 5 volts. Then think of how many things could run from 5 v, or accept a 5v logic input. Think of relays with 5v coils…
Absolutely right. Also this seems like the type of item that could find its way to the impulse-buy-while-waiting-in-line shelf at the local China-mart. So when inspiration strikes at 10 pm…..
I have actually thought of building something like this around a ESP8266 board.
Not for anything that would run off the mains, but for things that I want in places I don’t have mains power….
A 5v USB fan in the shed running off a solar panel…
Add an open GPOI pin for a temp/humidity sensor and I can keep my shed cooler during the day…
Outdoor smart lights powered off a usb power pack that is in turn charged by a USB solar panel during the day…
Add a battery, solar panels, you now have access to dozens of USB powered devices that you can control remotely, all “plug and play” with USB ports.
There is a 12 volt board with like 8 relays and some bluetooth module I forget which and an app to control it. I got one somewhere years ago and it was a joke with Bluetooth only. Need to dig it out and see if I can bodge an esp8266 or 32 onto it.
You could also Check out the Sonoff 4CH pro. ~$20
4 independent relays, powered by 5-24v DC or 90-250 AC, and comes with a flash-able ESP (though not as easy to flash as some others).
Down side is that it’s a bit harder to flash than some other sonoffs, and no exposed GPIO for other sensors…
And it’s not as clean looking as the option posted in the article….
I tried a simple setup with an esp8266 that went between a set of battery-powered LED lights (the little “fairy” type lights you see everywhere) and got as far as switching and dimming them remotely.. Unfortunately the whole thing was too much of a drain on the battery to be of much use long-term, but I can imagine these Sonoff switches would be useful for lighting setups that use a lot of low-voltage LED stuff.
I use several USB switches for USB-powered LED strips, mostly for an aquarium at home, where I prefer the space savings of a single multiport USB charger rather than multiple AC-to-5V transformers. I built a device a lot like the one mentioned in this article, except it is based on the ESP8266, and it has a USB-drive-like profile so that I can plug several of them into adjacent USB ports on the charger. The project is at https://github.com/sowbug/smart-usb-switch.
Here is an use case: limiting your phone’s battery to 90 percent max to limit the wear on your glued on battery.
I have an Amcrest security camera that is super nice but it stops responding after a day or two. It is USB powered and I use it off of an existing USB power brick that also powers other devices. Something along these lines would be perfect to remotely reset it when the connection is lost. My only wish is that it was using an ESP chip so I could put esphome on it.
Many (if not most) cheap Chinese made USB charger/power supplies will draw power from the USB connected device if the charger is unplugged from the wall. Let’s hope this Sonoff cuts off the USB power path (relay? PMOS?), or at least uses a steering diode with the voltage feedback tap at the cathode to prevent this.
It doesn’t work without a power supply. As soon as you plug it out the AC-adapter, it turns off.
interesting when I put a comment up pointing to what was probably the initial source of this article (which this article mainly copies from) – that was live two weeks ago, which includes more technical details, it didn’t get posted.. Oh well, google is your friend, so google “CKW04 sonoff” and you will see it near the top (cnx software). They (same site) also reckon the ckw04 might be based on the “iCommSemi SV6166F” – if you search their site you’ll find it..
I think that’s the first time I’ve had a comment killed by HaD.. Maybe they didn’t like me putting a link in to essentially the same article that was on another site two weeks ago..
With power consumption like that, it is not going to save power. :P 345 mA at 3.3 V = 1.1W
Not sure you should be trusting or shilling proprietary silicon from China, especially in an IOT application. But time will tell I guess.
Admitted my first thoughts were, this is a really bad idea. Most people are getting to the point where they have simply accepted they can’t avoid the Orwellian nightmare and have simply chosen to embrace it. That yurt is looking more tempting every day :D
No need to dream- do it!
Except Sonoff already did it. This product is basically an evolution of this (Sonoff SV) https://www.aliexpress.com/item/32907812902.html to this (Sonoff RE5V1C) https://www.aliexpress.com/item/4000089805053.html to a neatly packaged item in a nice enclosure.
I have two USB-powered IKEA lamps which would work great with this module.
I have now purchased the Sonoff Micro Plug and am sad that I cannot use it. Because without alternative firmware it will be sold soon.
Correct. It doesn’t work without proprietary software. It will not respond to requests on the local network (intranet), but requires a live internet connection to a server.
I’ve done some tracings here if interested:
https://www.elektroda.com/rtvforum/viewtopic.php?p=21311332#21311332