New Part Day: Sonoff USB Smart Adaptor Taps A New WiFi Chip

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.

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.

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.

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’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?

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.

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).

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.

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.

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.

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..

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