Category

ESP8266

Category

Funny how a simple idea can spider out into multiple paths. Arduino EEPROM seemed like a straightforward concept. A few a years ago it was as easy as having either 512 or 1024 bytes of flash memory. The Arduino IDE offered an EEPROM library which let you read and write a single byte. Today, however, with many different processor architectures saving data to EEPROM varies. It is now possible to save any datatype to EEPROM but not on all boards and not all using the same method.

While programming an coin accepter sold by Adafruit on an AddOhms live stream, I discovered two “new” methods in the Arduino library. At least, these functions are new to me! A couple of years ago EEPROM.get() and EEPROM.put() appeared. Using these functions, you can store any datatype in EEPROM.

This post covers tidgets related to using Arduino EEPROM to store any value across multiple boards, or platforms. Specifically boards such as the Uno, Nano, Mega, and Zero are covered. Additionally Arduino-compatible boards from Espressif, PRJC, and Adafruit are covered as well.

My recent SONOFF WiFi Switch experience reminded me of something from high school. I attended an off-site electronics class with my best friend. As teenage boys, we were prone to doing stupid things. One of our favorite games was to see who could handle the highest voltage. Our bench had a variable AC supply that went from 0 to 120 volts. So we would grab the alligator clips while the other person slowly turned the knob up. John once made it to 50 volts. I seem to recall my tolerance around 30 volts. First, DO NOT do this. It was stupid. Second, I think this game is why handling AC makes me so uncomfortable.

While I am not an electrician, I do know the basics about wiring mains AC circuits. So when one of my studio lights needed a new switch, I was okay to replace it. Mains AC does not scare me when it is off. I did not have a mechanical switch available. Instead, I opted for a SONOFF WiFi Switch. I did not intend to connect WiFi, at least not yet. I just wanted to control the light with the manual push button.

The clever solution seemed to be clever, at least for a few minutes. Suddenly the light turned off. I thought maybe there was a timeout for the manual button. Annoying, but workable. The lamp remained off for about another 2 minutes when I started to smell that unmistakeable burning plastic odor. Touching the case of the SONOFF identified the culprit immediately.

Great. So I have an AC mains switch that isn’t working, but I do not want to go poking my multimeter into it. What do I do?

Turns out, that SONOFF module was defective. I wanted to debug it, but I did not want to measure anything while connected to AC. Here’s how I used a thermal camera to debug my SONOFF.

What is a SONOFF?

See the ESP8266 and Antenna?

The SONOFF WiFi switch is an inexpensive AC relay. Internally it has an ESP12 chip, which became popular with the ESP8266. There is even an unpopulatd serial header which can be used to reflash the firmware. Among hackers, these modules are a popular way to get an AC relay that is easily programmed.

Can you use voltage dividers as regulators? What if you add a Zener Diode? In this AddOhms episode, I show what happens when you try to power a complex circuit like an ESP8266 with a voltage divider instead of a regulator. (Spoiler: Get a voltage regulator.) This video tutorial is related to a write up I did recently on Zener Diodes. For questions or comments visit the AddOhms Discussion Forum.

Behind the scenes

A significant change for this AddOhms Episode is that I moved from Final Cut Pro X to Premiere Pro. I also shot the entire video in 4K, even though the output is 1080p. Animations were still done as 1080p compositions. One snag I ran into, the color corrections I applied in PPro, didn’t seem to get exported. You might notice when the breadboard is on screen, it has a very slight yellow tint to it.

I’ve been changing how I produce the videos. It’s shortening the cycle time. The key is that I’m not trying to animate every scene. The amount of work involved is just too much. I animate practically every frame. So in a 6-minute video, that’s just too much.

By the way, there are two easter eggs in this episode. Can you find them?

Voltage Dividers as Regulators on YouTube

Pulse Width Modulation (PWM) makes it possible to dim lights, control the speed of motors, and (with the help of filters) generate analog reference voltages. When measuring the voltage or current of a PWM signal, there are unique challenges. You can use this tutorial to measure PWM current with a modified moving average (MMA).

A couple of weeks ago I posted four things to know about the ESP8266 before using one. The biggest surprise from that post is people seem to think I do not like the ESP8266! This idea is not the case; the ESP8266 is awesome. I like them so much that my Adafruit Feather HUZZAH with ESP8266 has become my go-to Arduino board.

Wait what? James uses something other than Arduino? Yes, I do! I have many different boards and have used most of them for one task or another.

However, when it came to day-to-day “make something quickly” type work, I relied on my Uno. But not anymore. Here are the 5 reasons the ESP8266 is my go-to Arduino board.