How Low Can An ESP8266 Go?

We’ve been tuned into coin cell designs lately given the coin cell challenge, so we were interested in [CNLohr]’s latest video about pushing the ESP8266 into the lowest-possible battery drain with coin cells. The result is a series of hacks, based on a reverse-engineered library and depends on a modified router, but that gets the power consumption down by more than a factor of ten!

Although the ESP8266 has a deep sleep mode that draws only 20 microamps or so, that isn’t as rosy as it seems. If you could go to sleep for a while, wake up for just a moment, send your data, and then go back to sleep, that might be one thing. But when you use conventional techniques, the device wakes up and has to do about ten seconds of work (at high power) to connect to a nearby access point. Then it can do what you want and go back to sleep. That ten-second hit is a killer on small batteries.

Since that’s all you can do with the standard libraries, the next step was to find [pvvx] who has reverse engineered a great deal of the libraries and provides a library with no WiFi capability. That’s a two-edged sword. The pro is you get a 30 ms startup from a deep sleep. The downside is — well — you don’t have WiFi.

Continue reading “How Low Can An ESP8266 Go?”

The Best Conference Badge Of 2017 Is A WiFi Lawn

It’s February, conference season hasn’t even started yet, and already there’s a winner of the best electronic badge of the year. For this year’s MAGfest, [CNLohr] and friends distributed 2,000 ESP8266-based swag badges.

These custom #badgelife badges aren’t. Apparently, MAGFest wouldn’t allow [CNLohr] to call these devices ‘badges’. Instead, these are ‘swadges’, a combination of swag and badges.  On board theses swadges is an ESP-12, a quartet of RGB LEDs, and buttons for up, down, left, right, A, B, Select, and Start. The swadge is powered by two AA batteries (sourced from Costco of all places), and by all accounts the badge was a complete success.

[CNLohr] is one of the great ESP8266 experts out there, and one of the design goals of this badge is to have all of these swadges communicate over raw WiFi frames. This turned out to be a great idea – using normal WiFi infrastructure with two thousand badges saturated the spectrum. The control system for was simply three badges, one per WiFi channel, that tells all the badges to change the color of the LEDs.

The swadge was a complete success, but with a few hundred blinkey glowey WiFi devices, you know [CNLohr] is going to come up with something cool. This time, he turned his lawn into a rave. About 175 swadges were laid out on the lawn, all controlled by a single controller swadge. The color of the LEDs on each swadge in the yard changes in response to the WiFi signal strength. By swinging the controller badge around his head, [CNLohr] turned his yard into a disco floor of swirling blinkieness. It looks awesome, although it might not visualize WiFi signals as well as some of [CNLohr]’s other ESP hacks.

This is a fantastic build and was well received by everyone at MAGFest. Be sure to check out the videos below, they truly show off the capabilities of this really cool piece of wearable hardware.

Continue reading “The Best Conference Badge Of 2017 Is A WiFi Lawn”

[CNLohr] Reverses Vive, Valve Engineers Play Along

[CNLohr] needs no introduction around these parts. He’s pulled off a few really epic hacks. Recently, he’s set his sights on writing a simple, easy to extend library to work with the HTC Vive VR controller equipment, and in particular the Watchman controller.

There’s been a lot of previous work on the device, so [Charles] wasn’t starting from scratch, and he live-streamed his work, allowing others to play along. In the process, two engineers who actually worked on the hardware in question, [Alan Yates] and [Ben Jackson], stopped by and gave some oblique hints and “warmer-cooler” guidance. A much-condensed version is up on YouTube (and embedded below). In the links, you’ll find code and the live streams in their original glory, if you want to see what went down blow by blow. Code and more docs are in this Gist.

Continue reading “[CNLohr] Reverses Vive, Valve Engineers Play Along”

The ESP: A New 1kB Contender Appears

The ESP8266 is officially checking into the Hackaday 1kB Challenge. Doing something meaningful in 1kB of compiled code is tricky; modern SDKs like the ones often used for ESP8266 compile even the simplest programs to nearly that size. If you want to use this hardware in your 1kB Challenge entry, I have a solution for you!

The ESP8266 now has a barebones build environment focused on minimizing code size, as little as 131 bytes to boot up and blink an LED. It also “supports” some new, insane clock rates (like 346 MHz) and crazy development cycle speeds. The WiFi is stuck in “airplane mode,” but it will be worth your time to consider the ESP for the next non-WiFi project you’ll be doing.

Far too often, we follow design patterns that ‘just work’ instead of looking for the ones that are optimal because we’re afraid of wasting time. The benefits of keeping code tight and small are frequently overlooked. When code is small and environments minimal, RAM and FLASH become easier to come by, compiled binaries shrink and time wasted by compiling and flashing can decrease by an order of magnitude! We rarely see just how much value is added when we become a good engineer: being done only when there’s nothing left to remove from a design. Nosdk8266 will let you see what it’s like to test out code changes several times a minute.

Just a month ago, when preparing the ESP8266 for a USB bootloader, I had to make a stripped-down environment for it. It’s not based on the Official Non-OS SDK or the RTOS sdk, but an environment that can boot up and blink an LED. Not just blink an LED, but tweak the clock in some totally unexpected ways and even run the I2S bus (used for espthernet and Color NTSC Broadcast Video). If you’re not at the submission phase for your 1kB challenge, you can even use the mask ROM for printf! Now you can tweak your code and — in under 2 seconds — see what the new code does!

Even in PICO mode, the part still has to use the mask ROM to be loaded, but thankfully, the 1kB Challenge has added an exception for unavoidable bootloaders. No longer bound by the shackles of WiFi, I can’t wait to see what you’ll do with the ESP8266. Just beware that the processor may not work reliably when overclocked at 346 MHz (332.5%,) and you’ll certainly be voiding any warranties you may have. Sounds like fun, right?

Editorial Note: This is a guest article from Charles Lohr, aka [CNLohr]. Although he has written a few other guest articles, he is not a regular contributor to Hackaday and therefore, this article does not disqualify him from entering the 1kB Challenge. We felt it more fair to publish this article which shares the tools he’s using to make code smaller, rather than to keep them to himself for fear of disqualification. While we have your attention, we wanted to mention one of Charles’ articles which was published on April 1st — we still think there’s a lot of people who don’t realize it wasn’t a prank.

Fail More: The Story Of [CNLohr]’s Clear Keytar

[CNLohr] is kinda famous round these parts; due to some very impressive and successful hacks. However, for his 20k subscriber video, he had a bit to say about failure.

Of course glass circuit boards are cool. Linux Minecraft things are also cool. Hacks on the ESP8266 that are impressive enough people thought they were an April Fool’s joke are, admittedly, very cool. (Though, we have to confess, posting on April 1 may have added to the confusion.)  For a guy who puts out so many successes you’d think he’d talk about the next ones planned; hyping up his growing subscriber base in order to reel in those sweet sweet Internet dollars.

Instead he shows us a spectacular failure. We do mean spectacular. It’s got beautiful intricate copper on glass key pads. He came up with clever ways to do the lighting. The circuit is nicely soldered and the acrylic case looks like a glowing crystal. It just never went anywhere and never worked. He got lots of people involved and completely failed to deliver.

However, in the end it was the failure that taught him what he needed to know. He’s since perfected the techniques and skills he lacked when he started this project a time ago. We’ve all had experiences like this, and enjoyed hearing about his. What failure taught you the most?

Continue reading “Fail More: The Story Of [CNLohr]’s Clear Keytar”

[CNLohr], ESP8266, USB…

“Round up the usual suspects…”

[CNLohr] just can’t get enough of the ESP8266 these days — now he’s working on getting a version of V-USB software low-speed USB device emulation working on the thing. (GitHub link here, video also embedded below.) That’s not likely to be an afternoon project, and we should warn you that it’s still a project in progress, but he’s made some in-progress material available, and if you’re interested either in USB or the way the mind of [CNLohr] works, it’s worth a watch.

In this video, he leans heavily on the logic analyzer. He’s not a USB expert, and couldn’t find the right resources online to implement a USB driver, so he taught himself by looking at the signals coming across as he wiggled a mouse on his desk. Using the ever-popular Wireshark helped him out a lot with this task as well. Then it was time to dig into Xtensa assembly language, because timing was critical.

Speaking of timing, one of the first things that he did was write some profiling routines so that he could figure out how long everything was taking. And did we mention that [CNLohr] didn’t know Xtensa assembly? So he wrote routines in C, compiled them using the Xtensa GCC compiler, and backed out the assembly. The end result is a mix of the two: assembly when speed counts, and C when it’s more comfortable.

Continue reading “[CNLohr], ESP8266, USB…”

How To Directly Program An Inexpensive ESP8266 WiFi Module

The ESP8266 is the answer to “I want something with Wifi.” Surprisingly, there are a number of engineers and hobbyists who have not heard of this chip or have heard of it but don’t really understand what it is. It’s basically the answer to everything IoT to so many engineering problems that have plagued the hobbyist and commercial world alike.

The chip is a processor with integrated RAM, some ROM, and a WiFi radio, and the only external components you will need are 4 capacitors, a crystal and an external flash! It’s CHEAP, like $4/ea cheap! Or $5 if you want it on a nice, convenient carrier board that includes all these components. The power consumption is reasonable (~200mA)1, the range is insane ~300m2 without directional equipment, and a PCB trace antenna and ~4km if you want to be ridiculous.

One place thing that more people need to know about is how to program directly for this chip. Too many times projects use it as a crutch via the AT commands. Read on and find out how to hello world with just this chip.

Continue reading “How To Directly Program An Inexpensive ESP8266 WiFi Module”