PNG Image Decoding Library Does It With Minimal RAM

Want to display a PNG file on a display attached to an Arduino or other microcontroller board? You’ll want to look at [Larry Bank]’s PNGdec, the Arduino-friendly PNG decoder library which makes it much easier to work with PNG files on your chosen microcontroller.

The PNG image format supports useful features like lossless compression, and was generally developed as an improved (and non-patented) alternative to GIF files. So far so great, but it turns out that decoding PNG files on a microcontroller is a challenge due to the limited amount of memory compared to desktop machines. When the PNG specification was developed in the 90s, computers easily had megabytes of memory to work with, but microcontrollers tend to have memory measured in kilobytes, and lack high-level memory management. [Larry]’s library addresses these issues.

PNGdec is self-contained and free from external dependencies, and also has some features to make converting pixel formats for different display types easy. It will run on any microcontroller that can spare at least 48 K of RAM, so if that sounds useful then check out the GitHub repository for code and examples.

We’ve seen [Larry]’s wonderful work before on optimizing GIF playback as well as rapid JPEG decoding, and these libraries have increasing relevance as hobbyists continue to see small LCD and OLED-based displays become ever more accessible and affordable.

[PNG logo: PNG Home Site]

DIY PECS Board Uses Pictures To Communicate

One way of communicating with autistic and non-verbal people is through the use of a Picture Exchange Communication System or PECS board, which they can use to point out what they need or want throughout the day. However, the commercial versions of these boards have their share of problems — they’re expensive, and they’re fairly rigid as far as the pictures go. [Alain Mauer] has created an open-source PECS board that is far more personalized, and has audio to boot.

The number one requisite here is sturdiness, as [Alain]’s son [Scott] has already smashed two smartphones and a tablet. [Alain] went with a laser-cut MDF enclosure that should last quite a while. Inside is an Arduino Pro Mini and a DF Player Mini that plays corresponding clips from a micro SD card whenever [Scott] presses a button on the 16-key copper foil capacitive keypad. This PECS board is smart, too — it will sound a turn-me-off reminder after a few minutes of inactivity, and issue audible low battery warnings.

So far, [Scott] is responding better to photographs of objects than to drawings. Watch him interact with the board after the break.

This is far from the first thing [Alain] has built to help [Scott]. Be sure to check out this Pi-based media player built to engage and not enrage. Continue reading “DIY PECS Board Uses Pictures To Communicate”

Analog Style VU Meter With Arduino And OLED Display

Looking for a digital recreation of the classic analog volume unit (VU) meter? If you’ve got an Arduino, a few passive components, and a SSD1306 OLED, then [mircemk] might have the answer for you. As you can see in the video below, his code turns a handful of cheap parts into an attractive and functional audio display.

The project’s Hackaday.IO page explains that the idea is based on the work of [stevenart], with code adapted for the SSD1306 display and some tweaks made to the circuit. While [mircemk] says the code could be modified for stereo as long as the two displays don’t have conflicting I2C addresses, he decided to simply duplicate the whole setup for each channel to keep things simple. With as cheap as some of these parts are nowadays, it’s hard to blame him.

[mircemk] has provided source code for a couple different styles of VU indicators, the colors of which can easily be inverted depending on your tastes. He also clarifies that the jerky motion of the virtual “needle” seen in the video is due to the camera; in real-life it sweeps smoothly like the genuine article.

Much like the project that aimed to recreate authentic “steam gauges” with e-paper displays, this as an excellent technique to file away for use in the future. Compared to authentic analog gauges, these digital recreations are quicker and faster to implement, plus going this route prevents any antique hardware from going on the chopping block.

Continue reading “Analog Style VU Meter With Arduino And OLED Display”

DIY Forth On Arduino

On a recent rainy afternoon, [Thanassis Tsiodras] decided to build his own Forth for the Arduino to relieve the boredom. One week of intense hacking later, he called it done and released his project as MiniForth on GitHub. [Thanassis] says he was inspired by our series of Forth articles from a few years back, and his goal was to build a Forth interpreter / compiler from scratch, put it into a Blue Pill microcontroller. That accomplished, he naturally decides to squeeze it into an Arduino Uno with only 2K of RAM.

Even if you are ambivalent about the Forth language, [Thanissis]’s project has some great ideas to check out. For example, he’s a big proponent of Makefile automation for repetitive tasks, and the project’s Makefile targets implements almost every task needed for development, building and testing his code.

Some development and testing tasks are easier to perform on the host computer. To that end, [Thanassis] tests his programs locally using the simavr simulator. The code is also portable, and he can compile it locally on the host and debug it using GDB along with Valgrind and AddressSanitizer to check for memory issues. He chose to write the program in C++ using only zero-cost abstractions, but found that compiling with the ArduinoSTL was too slow and used too much memory. No problem, [Thanassis] writes his own minimalist STL and implements several memory-saving hacks. As a final test, the Makefile can also execute a test suite of Forth commands, including a FizzBuzz algorithm, to check the resulting implementation.

Here’s a short video of MiniForth in action, blinking an LED on an UNO, and the video below the break shows each of the various Makefile tasks in operation. If you want to learn more, check out Elliot Williams’s Forth series which inspired [Thanassis] and this 2017 article discussing several different Forth implementations. Have you ever built your own compiler? Let us know in the comments below.

Continue reading “DIY Forth On Arduino”

Drink Water On Schedule Or Else Flood Your Desk

How much water have you had to drink today? We would venture to guess that the answer is somewhere between ‘absolutely none’ and ‘not not nearly enough’. You can go ahead and blame poor work/life balance — that’s our plan, anyway — and just try to do better. All this working from home means the bathroom situation is now ideal, so why not drink as much water as you can?

But how? Well, you’re human, so you’ll need to make it as easy as possible to drink the water throughout the day. You could fill up one big jug and hoist it to your mouth all day long (or use a straw), but facing that amount of water all at once can be intimidating. The problem with using a regular-sized vessel is that you have to get up to refill it several times per day. When hyper-focus is winning the work/life tug-of-war, you can’t always just stop and go to the kitchen. What you need is an automatic water dispenser, and you need it right there on the desk.

[Javier Rengel]’s water pomodoro makes it as easy as setting your cup down in front of this machine and leaving it there between sips. As long as the IR sensor detects your cup, it will dispense water every hour. This means that if you don’t drink enough water throughout the day, you’re going to have it all over the desk at some point. [Javier] simply connected an Arduino UNO to a water pump and IR sensor pair and repurposed the milk dispenser from a coffee machine. Check it out in action after the break.

Of course, if you aren’t intimidated by the big jug approach, you could keep tabs on your intake with the right kind of straw.

Continue reading “Drink Water On Schedule Or Else Flood Your Desk”

Recognising Bird Sounds With A Microcontroller

Machine learning is an incredible tool for conservation research, especially for scenarios like long term observation, and sifting through massive amounts of data. While the average Hackaday reader might not be able to take part in data gathering in an isolated wilderness somewhere, we are all surrounded by bird life. Using an Arduino Nano 33 BLE Sense and an online machine learning tool, a team made up of [Errol Joshua], [Ajith KJ], [Mahesh Nayak], and [Supriya Nickam] demonstrate how to set up an automated bird call classifier.

The Arduino Nano 33 BLE Sense  is a fully featured little dev board that features the very capable NRF52840 microcontroller with Bluetooth Low Energy, and a variety of onboard sensors, including a microphone. Training a machine learning model might seem daunting to many people, but online services like Edge Impulse makes the process very beginner-friendly. Once you start training your own models for specific applications, you quickly learn that building and maintaining a high quality dataset is often the most time-consuming part of machine learning. Fortunately for this use case, a massive online library of bird calls from all over the world is available on Xeno-Canto. This can be augmented with background noise from the area where the device will be deployed to reduce false-positives. Edge Impulse will train the model using the provided dataset, and generate a library that can be used on the Arduino with one of the provided sample sketches to log and send the collected data to a server. Then comes the never ending process of iteratively testing and improving the recognition model. Edge Impulse is also compatible with more powerful devices such as the Raspberry Pi and Jetson Nano if you want more intensive machine learning models.

We’ve also seen the exact same setup get used for smart baby monitor. If you want to learn more, be sure to watch at [Shawn Hymel]’s talk from the 2020 Remoticon about machine learning on microcontrollers. Continue reading “Recognising Bird Sounds With A Microcontroller”

This Arduino Isn’t Color Blind

You can sense a lot of things with the right sensor, and [Nikhil Nailwal] is here to show us how to sense colors using a TCS230. The project is a simple demo. It displays the color and lights up an LED to correspond to the detected color.

If you haven’t seen the TCS230 before, it is a chip with an array of photosensors, for different light wavelengths. The controlling chip — an Arduino, in this case — can read the intensity of the selected color.

Continue reading “This Arduino Isn’t Color Blind”