Arduino Measures Remaining Battery Power With Zero Components, No I/O Pin

[Trent M. Wyatt]’s CPUVolt library provides a fast way to measure voltage using no external components, and no I/O pin. It only applies to certain microcontrollers, but he provides example Arduino code showing how handy this can be for battery-powered projects.

The usual way to measure VCC is simple, but has shortcomings.

The classical way to measure a system’s voltage is to connect one of your MCU’s ADC pins to a voltage divider made from a couple resistors. A simple calculation yields a reading of the system’s voltage, but this approach has two disadvantages: one is that it constantly consumes power, and the other is that it ties up a pin that you might want to use for something else.

There are ways to mitigate these issues, but it would be best to avoid them entirely. Microchip application note 2447 describes a method of doing exactly that, and that’s precisely what [Trent]’s Arduino library implements.

What happens in this method is one selects Vbg (a fixed internal voltage reference that is temperature-independent) as Vin, and selects Vcc as the ADC’s voltage reference. This is essentially backwards from how the ADC is normally used, but it requires no external hookup and is only a bit of calculation away from determining Vcc in millivolts. There is some non-linearity in the results, but for the purposes of measuring battery power in a system or deciding when to send a “low battery” signal, it’s an attractive solution.

Being an Arduino library, CPUVolt makes this idea very easy to use, but the concept and method is actually something we have seen before. If you’re interested in the low-level details, then check out our earlier coverage which goes into some detail on exactly what is going on, using an ATtiny84.

Hacking An NFC E-Paper Display From Waveshare With Mystery MCU

These days e-paper (eInk) displays are everywhere, with stores being one of the largest users of smaller, monochrome versions of these persistent displays. This has also made them a solid target of hackers who seek to not only reverse-engineer and reuse discarded ones, but also ones sold to consumers, with [Aaron Christophel] recently reverse-engineering and flashing custom firmware (GitHub source) to a Waveshare 2.13″ NFC-Powered E-Paper display.

What’s perhaps most notable is how locked-down and devoid of documentation these devices are. The board [Aaron] looked at did not have any markings on the main IC, and Waveshare did not provide more information other than the Android and iOS apps. This led to some matching of various NFC-enabled MCUs with the pinout, with the Chivotech TN2115S2 rolling out as the most likely candidate. This is an 8 MHz Cortex-M0 MCU with not only NFC, but also an energy harvesting feature (up to 300 mW), which is why this e-paper tag can update the display without external power or a battery.

With the Chivotech datasheet being rather sparse, more reverse-engineering needed to be done, which included dumping the firmware and exploring it with Ghidra. During this, the secret key was discovered to make the Flash writeable along with how to control the peripherals and display. With this knowledge it’s now possible to make this tag display update without being limited by manufacturer-supplied tools and software, making it infinitely more useful.

Continue reading “Hacking An NFC E-Paper Display From Waveshare With Mystery MCU”

Take The Minimal Pain Out Of ESP32 Programming

Perhaps without many of us realising it, our single board computers perform the task of making programming their processor or SoC a lot easier. They take care of setting the right lines or commands to put the chip in programming mode, they deal with timings, such that we simply fire our code from our dev environment without having to expend much thought. It’s not as though it’s difficult to program most microcontrollers, but there is usually a procedure to set the chip in programming mode. Tired of pressing buttons to achieve this with the ESP32, [DoganM95] took the time to create an all-in-one USB ESP32 programming board.

It’s a straightforward enough CH340C design that also has a USBC-PD chip on-board allowing powering of an attached ESP32 from PD sources. It’s all the stuff you’d find incorporated on a little dev board, without the ESP32, so while it’s nothing earth-shattering it’s also a neat and useful little addition to your arsenal. Unsurprisingly it’s not the first time someone’s created a similar board for a commercially available ESP32 module.

DIY Walkie-Talkie With ESP32 And ESP-NOW

In a recent article in Elektor magazine, [Clemens Valens] describes the construction and software for an ESP32 walkie-talkie system that uses ESP-NOW for the wireless connection between units, along with a low-cost condenser microphone with a transistor-based preamplifier and an LM386 op-amp for the speaker circuit. In the ESP32 module the built-in DAC and ADC are used for audio in and output, which provide just about enough resolution for voice communication.

So why use ESP-NOW rather than WiFi or Bluetooth? Mostly because of range, power usage and convenience with no SSIDs and passwords to bother with.

The DIY Walkie-Talkie circuit diagram. (Credit: Clemens Valens, Elektor magazine)
The DIY Walkie-Talkie circuit diagram. (Credit: Clemens Valens, Elektor magazine)

ESP-NOW is Espressif’s own network protocol that uses the same underlying hardware as 2.4 GHz WiFi and Bluetooth, but focuses on more basic direct and mesh-style communication. It can be considered to be somewhat like low-level UDP with MAC address instead of IP address, which makes it useful for fire-and-forget traffic such as from IoT devices.

In the past, we’ve seen ESP-NOW control everything from fake security cameras to CNC machines. In fact, we’ve even seen it used in another walkie-talkie a couple years back.

Cat-o-Matic 3000 Serves Your Feline Masters

When you have three cats and three humans, you have one problem: feeding them on a schedule without over or under feeding them. Even if there was only one human in the equation, the Cat-o-Matic 3000 would still be a useful tool.

Essentially, it’s a traffic light for cats — where green means you are go for feeding, and red means the cat was just fed. Yellow, of course, means the cat is either half-full or half-empty, depending on your outlook.

The brains of this operation is an ATmega88PA leftover from another project. There’s a no-name voltage regulator that steps up the two AA cells to 5 volts. Timing comes from a 32 kHz crystal that allows the microcontroller to stay in power-saving sleep mode for long periods of time.

Creator [0xCAFEAFFE] says the firmware was cobbled together from other projects. Essentially, it wakes up once per second to increment the uptime counter and then goes back to sleep. Short-pressing a button shows the feeding status, and long-pressing it will reset the timer.

Wanna make a cat status indicator without electronics? Give flexures a try.

Hacked Tea Lights Flicker Just Right

Flickering LED tea lights are a friendly and safe alternative to having flaming little pots of wax situated around your home, but sometimes the flicker scheme leaves something to be desired.

[Roger Rabbit] found a set of six such rechargeable tea lights with a base and a remote, and replaced the controller with an ATtiny85 for a more realistic flicker. When [Roger] opened up one of the candles, they found an IR sensor for the remote, a driver chip, and of course, an LED. No surprises there.

After desoldering the original controller, [Roger] wired in a socketed ATtiny85 on a piece of perfboard and hooked everything back up.The coolest part of this hack might just be the fact that there’s a perfect little compartment for the new microcontroller. How about that?

The Arduino code for this project is available in the Git repository, and the wonderful instruction manual is available in PDF form. Be sure to check out the brief video after the break.

You like these flickering LED candles? Here’s one you can blow out.

Continue reading “Hacked Tea Lights Flicker Just Right”

Monitoring Energy Use And Saving Money

On the surface, the electric grid might seem like a solved piece of infrastructure. But there’s actually been a large amount of computerized modernization going in the background for the past decade or so. At a large scale this means automatic control of the grid, but for some electric utility customers like [Alex] this means the rates for electricity can change every hour based on demand. By keeping an eye on the current rate, you can extract the most value from these utilities.

[Alex] is located in the United Kingdom and has an energy provider whose rates can change every half hour. This information is freely available well enough in advance to download the data and display it visibly in with a NeoPixel LED ring around a clock. The colors displayed by the LEDs represent an increase or decrease in price for the corresponding time and allow him to better plan out the household’s energy use for the day. The clock uses a TinyPICO ESP32 module to gather the data and handle the clock display. A second wall-mounted device shows real-time energy readings for both gas and electricity using two old analog voltmeters modified to display kilowatt-hours.

While not everyone has a utility which allows this sort of granularity with energy pricing, having one can make a bit of a difference as electricity rates under this system can sometimes go negative. [Alex] estimates that using these two displays to coordinate his energy usage has saved around £50 a month. Even if your utility offers minimal or no price adjustments for time-of-use, it’s still a good idea to monitor energy use in your home. Here’s a fairly comprehensive project that does that without modifying any existing wiring.