High Precision Analog IO With Digital Pins

Reading the temperature of your environment is pretty easy right? A quick search suggests the utterly ubiquitous DHT11, which speaks a well documented protocol and has libraries for every conceivable microcontroller and platform. Plug that into your Arduino and boom, temperature (and humidity!) readings. But the simple solution doesn’t hit every need, sometimes things need to get more esoteric.

The technique summarized by an image from Microchip Appnote AN685

For years we’ve been watching [Edward]’s heroic efforts to build accessible underwater sensing hardware. When we last heard from him he was working on improving the accuracy of his Arduino’s measurements of the humble NTC thermistor. Now the goal is the same but he has an even more surprising plan, throw the ADC out entirely and sample an analog thermistor using digital IO. It’s actually a pretty simple trick based on an intuitive observation, that microcontrollers are better at measuring time than voltage. 

The basic circuit

The circuit has a minimum of four components: a reference resistor, the thermistor, and a small capacitor with discharge resistor. To sense you configure a timer to count, and an edge interrupt to capture the value in the timer when its input toggles. One sensing cycle consists of discharging the cap through the discharge resistor, enabling the timer and interrupt, then charging it through the value to measure. The value captured from the timer will be correlated to how long it took the cap to charge above the logic-high threshold when the interrupt triggers. By comparing the time to charge through the reference against the time to charge through the thermistor you can calculate their relative resistance. And by performing a few calibration cycles at different temperatures ([Edward] suggests at least 10 degrees apart) you can anchor the measurement system to real temperature.

For all the gory details, including tips for how to save every last joule of energy, check out [Edward]’s post and the Microchip appnote AN685 he references. Besides this series [Edward]’s Cave Pearl Project has already yielded an impressive number of Hackday posts. For more great hardware writeups check out a general hardware build for a single sensing node, or the “temperature sensor” [Edward] made with no external parts at all!

Make Your Own SPL DB Meter With A Microphone And MCU

Measuring equipment such as SPL (Sound Pressure Level) decibel meters may seem daunting, but this article by [Shawon M. Shahryiar] shows that making your own need only have two essential ingredients: a microphone and a microcontroller. Obviously the microphone is for measuring the sound pressure level, and its output is then fed into the ADC of the microcontroller which does some math before sending the result to a display.

[Shawon] runs through all of the theory behind the calculations that have to be performed, before showing the C code that runs on the PIC18F242 8-bit MCU targeted by the prototype setup. The display is a graphical LCD type, capable of displaying the text with values as well as bar graphs indicating the measured levels. For the measurements themselves, the RMS value is taken of 16 ADC samples while the algorithm takes into account the specifications of the Seeed-sourced microphone module, specifically its average 50 dB sensitivity rating.

Although a full schematic is not provided, the essentials are all there for anyone to build their own SPL dB meter using virtually any microphone and MCU with built-in ADC. As the article also notes, opting for a higher quality microphone will yield better result and of course a faster MCU will offer more options, including FFT processing. Since the code itself is fairly basic, it should be easy enough to port it to an ARM-based MCU, which would allow one to use for example a TFT LCD.

Take a peek after the break for a video of the article’s SPL dB meter in action.

Continue reading “Make Your Own SPL DB Meter With A Microphone And MCU”

An Epic Tale Of Thermistors: Tricks For Much Better Temperature Sensing

For years [Edward] has been building professional grade underwater sensing nodes at prices approachable for an interested individual without a government grant. An important component of these is temperature, and he has been on a quest to get the highest accuracy temperature readings from whatever parts hit that sweet optimum between cost and complexity. First there were traditional temperature sensor ICs, but after deploying numerous nodes [Edward] was running into the limit of their accuracy. Could he use clever code and circuitry to get better results? The short answer is yes, but the long answer is a many part series of posts starting in 2016 detailing [Edward]’s exploration to get there.

Orange is 12 bits, red is 24

The first step is a thermistor, a conceptually simple device: resistance varies with temperature (seriously, how much more simple can a sensor get?). You can measure them by tapping the center of a voltage divider the same way you’d measure any other resistance, but [Edward] had discarded this idea because the naive approach combined with his Arduino’s 10 bit ADC yielded resolution too poor to be worthwhile for his needs. But by using the right analog reference voltage and adjusting the voltage divider he could get a 20x improvement in resolution, down to 0.05°C in the relevant temperature range. This and more is the subject of the first post.

What comes next? Oversampling. Apparently fueled by a project featured on Hackaday back in 2015 [Edward] embarked on a journey to applying it to his thermistor problem. To quote [Edward] directly, to get “n extra bits of resolution, you need to read the ADC four to the power of n times”. Three bits gives about an order of magnitude better resolution. This effectively lets you resolve signals smaller than a single sample but only if there is some jitter in the signal you’re measuring. Reading the same analog line with no perturbation gives no benefit. The rest of the post deals with the process of artificially perturbing the signal, which turns out to be significantly complex, but the result is roughly 16 bit accuracy from a 10 bit ADC!

What’s the upside? High quality sensor readings from a few passives and a cheap Arduino. If that’s your jam check out this excellent series when designing your next sensing project!

Create A Low-Cost, High-Accuracy LCR Meter With An STM32 MCU

Having a good LCR meter was something which [Adil] had wanted for his personal lab, so as any good university student (and former Hackaday contributor) does, he ended up building his own. Using a Nucleo-F446RE board for the MCU side and a custom PCB for the side that does the actual measuring, he created a meter that reportedly comes pretty close to commercial meters, and for the low price of £55.

Running through some of the theory behind the design as well some design choices, the resulting product is then presented. The choice to not using a standard current shunt, but instead a transimpedance amplifier (TIA) is explained as well. Unfortunately there are no schematics or source code, and the text is somewhat unclear on some points, failing to explain some acronyms that’d make it hard for someone who is not active in this field to understand the full design.

We hope that [Adil] can address those points and provide design files and source code, as it does look like a very interesting project!

Live Apollo 11 Transcript On EInk Display

There are few moments in history that have ever been recorded in more detail or analyzed as thoroughly as the Apollo 11 mission to the Moon. Getting three men to our nearest celestial neighbor and back in one piece took a lot of careful planning, and recording every moment of their journey was critical to making sure things were going smoothly. As we celebrate the 50th anniversary of man’s first steps off our world, these records give us a way to virtually tag along with Armstrong, Aldrin, and Collins.

As part of the 50th anniversary festivities at the Parkes Radio Telescope in Australia, [Andrew] created a badge that would let him wear a little piece of Apollo 11. Using an ESP32 and an eInk screen, it replays the mission transcript between the crew and ground control in real-time. It’s a unique way to experience the mission made possible by that meticulous data collection that’s a hallmark of the National Aeronautics and Space Administration.

[Andrew] was inspired by the “Apollo 11 In Real Time” website, but rather than pulling the content from the Internet, he’s loaded the mission transcripts onto the ESP32’s SPIFFS filesystem as a CSV file. Not that the badge is completely offline, it does need to connect to the Internet (via a hotspot on his phone) so it can keep its internal clock synchronized with NTP. Keeping everything local does reduce power consumption compared to streaming it from the Internet, but he admits that otherwise he didn’t give much thought to energy efficiency and there’s definitely some room for improvement.

The LILYGO TTGO board he’s using combines the ESP32 with a 2.13 inch eInk display, in a formfactor not unlike the Badgy we’ve covered previously. He was able to find a STL for a 3D printed case on Thingiverse which he modified to fit a battery. Unfortunately the original model was released under a license that prevents him from distributing his modified version, but it doesn’t sound too difficult to replicate if you’re interested in building your own running ticker of humanity’s greatest adventure.

High-Tech Alms Collection With The ESP32

In an ideal world, shop space, tools, and components would be free. But until we get to that Star Trek utopia, hackerspaces will have to rely on donations from the community to help stay afloat. While asking for money, at least you can have some fun with it if you design and build an Internet-connected donation box.

Or at least that’s how [Goran Mahovlic] handled it for the Radiona hackerspace in Zagreb, Croatia. Not content with just cutting a slit in the top of a shoe box, he came up with a physical donation system that’s not only more informative for those donating, but more organized for those collecting the funds.

The key is a arcade-style programmable coin acceptor from SparkFun. When connected to a microcontroller, this allows the box to keep a running tally on how much money has been inserted. With the use of a RFM96 LoRa module, it can even report on the current haul while remaining mobile; perfect for when the hackerspace has events outside of their home base.

But counting quarters is hardly a task befitting a powerful microcontroller like the ESP32. So [Goran] gave the chip something to do in its spare time by adding a couple of buttons and an LCD. This allows the user to scroll through a list of various projects that are looking for donations, and decide which one they want to financially support. When the donation box counts how much money has been inserted, it records which project its been earmarked for.

Of course, if you’d rather the free market do its thing, we’ve seen this same coin acceptor used to build a locker-sized vending machine. Or if you’re feeling crafty, you could always try your hand at building one with cardboard.

Continue reading “High-Tech Alms Collection With The ESP32”

Hardware Notifications For ISS Flybys

Since Sputnik launched in the 1950s, its been possible to look outside at night and spot artificial satellites orbiting with the naked eye. While Sputnik isn’t up there anymore, a larger, more modern satellite is readily located: the International Space Station. In fact, NASA has a program which will alert anyone who signs up when the ISS is about to fly overhead. A better alert, though, is this ISS notifier which is a dedicated piece of hardware that guarantees you won’t miss the next flyby.

This notifier is built around the Tokymaker, a platform aimed at making electronics projects almost painfully easy to learn. Connections to various modules can be made without soldering, and programming is done via a graphical interface reminiscent of Scratch. Using these tools, [jaime_lc98] designed a tool which flips up a tiny paper astronaut whenever the ISS is nearby. The software side takes advantage of IFTTT to easily and reliably control the servo on the Tokymaker.

The project pages goes into detail about how to set up IFTTT and also how to use the block-style language to program the Tokymaker. It’s pretty straightforward to get it up and running, relatively inexpensive, and looks like a great way to get the miniature hackers in your life excited about space. If they happen to learn a little something in the proces, well, we won’t tell them if you won’t. It might also be a good stepping stone on the way to other ISS-related hacks.