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”

Quick And Simple Morse Decoder

[Rostislav Persion] wrote a simple Morse Code decoder to run on his Arduino and display the text on an LCD shield. This is probably the simplest decoder possible, and thus its logic is pretty straightforward to follow. Simplicity comes at a price — changing the speed requires changing constants in the code. We would like to see this hooked up to a proper Morse code key, and see how fast [Rostislav] could drive it before it conks out.

In an earlier era of Morse code decoders, one tough part was dealing with the idiosyncrasies of each sender. Every operator’s style, or “fist”, has subtle variations in the timings of the dots, dashes, and the pauses between these elements, the letters, and the words. In fact, trained operators can recognize each other because of this, much like we can often recognize who is speaking on the phone just by hearing their voice. The other difficulty these decoders faced was detecting the signal in low signal-to-noise ratio environments — pulling the signal out of the noise.

A Morse decoder built today is more likely to be used to decode machine-generated signals, for example, debugging information or telemetry. This would more than likely be sent at fixed, known speeds over directly connected links with very high S/N ratios (a wire, perhaps). In these situations, a simple decoder like [Rostislav]’s is completely sufficient.

We wrote about a couple of Morse code algorithms back in 2014, the MorseDetector and the Magic Morse algorithm. While Morse code operators usually rank their skills by speed — the faster the better — this Morse code project for very low power transmitters turns that notion on its head by using speeds more suitably measured in minutes per word (77 MPW for that project). Have you used Morse code in any of your projects before? Let us know in the comments below.

SMART Response XE Turned Pocket BASIC Playground

Ever since the SMART Response XE was brought to our attention back in 2018, we’ve been keeping a close lookout for projects that make use of the Arduino-compatible educational gadget. Admittedly it’s taken a bit longer than we’d expected for the community to really start digging into the capabilities of the QWERTY handheld, but occasionally we see an effort like this port of BASIC to the SMART Response XE by [Dan Geiger] that reminds us of why we were so excited by this device to begin with.

This project combines the SMART Response XE support library by [Larry Bank] with Tiny BASIC Plus, which itself is an update of the Arduino BASIC port by [Michael Field]. The end result is a fun little BASIC handheld that has all the features and capabilities you’d expect, plus several device-specific commands that [Dan] has added such as BATT to check the battery voltage and MSAVE/MLOAD which will save and load BASIC programs to EEPROM.

To install the BASIC interpreter to your own SMART Response XE, [Dan] goes over the process of flashing it to the hardware using an AVR ISP MkII and a few pogo pins soldered to a bit of perboard. There are holes under the battery door of the device that exposes the programming pads on the PCB, so you don’t even need to crack open the case. Although if you are willing to crack open the case, you might as well add in a CC1101 transceiver so the handy little device can double as a spectrum analyzer.

Continue reading “SMART Response XE Turned Pocket BASIC Playground”

Miata Sci-Fi Digital Dash

One of the hardest, but sometimes best, things you can do for a project is to walk away. [Jroobi] had spent hundreds of hours crafting the digital dash for his MX5 Miata (video, embedded below) and after spending far too long chasing down I2C bugs, he made the difficult decision to step away for a while. However, as of May 2021, [Jroobi] returned to the project and found a power supply was under-specified and was causing brownouts that resulted in crashes.

All in all, it’s an incredible work of engineering. Everything from the massive codebase that describes all the different states to the tasteful graphic design is masterfully done. The Star-Trek-inspired theme and attention to detail really show in the different modes on the tachometer. The dynamic soft RPM limit based on engine temperature is particularly ingenious.

Under the hood of this custom dash are two Ardunios running the show. The center media console offers more controls with a generous touch screen while the instrument cluster shows most of the data. They talk over I2C to each other and communicate with other parts in the car, such as the RGB cabin lighting and the TEIN electronic suspension dampeners. Fuel and temperature levels come in as voltage levels which can be read via an ADC. The gear position is calculated based on RPMs and speed given the wheel size and the transmission in the vehicle.

It is a phenomenal labor of love and if you’re inspired to further upgrade your Miata you might want to see how to put carbs on the engine or RGB light rings in the instruments. Continue reading “Miata Sci-Fi Digital Dash”