cnlohr

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.

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

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.

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

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

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.

[Charles] is on a quest to complete ever more jaw-dropping hacks with the popular low-cost ESP8266 WiFi modules. This week’s project is plotting WiFi received signal strength in 3D space. While the ESP8266 is capable of providing a Received Signal Strength Indication (RSSI), [Charles] didn’t directly use it. He wrote a simple C program on his laptop to ping the ESP8266 at around 500Hz. The laptop would then translate the RSSI from the ping replies to a color value, which it would then send to the ESP8266. Since the ESP8266 was running [Charles’] custom firmware (as seen in his WiFi cup project), it could directly display the color on a WS2812 RGB LED.

The colors seemed random at first, but [Charles] noticed that there was a pattern. He just needed a way to visualize the LED over time. A single frame long exposure would work, but so would video. [Charles] went the video route, creating SuperLongExposure, an FFMPEG-based tool which extracts every video frame and composites them into a single frame. What he saw was pretty cool – there were definite stripes of good and bad signal.

Armed with this information, [Charles] went for broke and mounted his ESP8266 on a large gantry style mill. He took several long exposure videos of a 360x360x180mm area. The videos were extracted into layers. The whole data set could then be visualized with Voxeltastic, [Charles’] own HTML5/WEBGL based render engine. The results were nothing short of amazing. The signal strength increases and decreases in nodes and anti-nodes which correspond to the 12.4 cm wavelength of a WiFi signal. The final render looks incredibly organic, which isn’t completely surprising. We’ve seen the same kind of image from commercial antenna simulation characterization systems.

Once again [Charles] has blown us away, we can’t wait to see what he does next!