Limiting Battery Risk On Repurposed Smartphones With PostmarketOS

PostmarketOS is a Linux distribution specifically designed for those who wish to repurpose old smartphones as general-use computers, to a degree. This can be a great way to reuse old hardware. However, for [Bry50], it was somewhat discomforting leaving the phone’s aging lithium battery perpetually on charge. A bit of code was thus whipped up to provide a greater measure of safety.

The concept is simple enough—lithium batteries are at lower risk of surprise combustion events if they’re held at a lower state of charge. To this end, [Bry50] modified the device tree in PostmarketOS to change the maximum charge level. Apparently, maximum charge was set at a lofty 4.4V (100%), but this was reconfigured to a lower level of 3.8V, corresponding to a roughly 40-50% state of charge. The idea is that this is a much healthier way to maintain a battery hooked up to power for long periods of time. There’s one small hitch—the system will get confused if the battery voltage is higher than the 3.8 V setpoint when switching over. It’s thus important to let the device discharge to a lower level if you choose to make this change.

It’s a neat mod that both increases safety, but keeps the battery on hand to let the system ride through minor power outages. If you’re new to the world of repurposing old smartphones, fear not. [Bryan] also has a tutorial on getting started with PostmarketOS for the unfamiliar. If you’re working on your own projects in this space, we’d love to hear about them—so get on over to the tipsline!

Different Algorithms Sort Christmas Lights

Sorting algorithms are a common exercise for new programmers, and for good reason: they introduce many programming fundamentals at once, including loops and conditionals, arrays and lists, comparisons, algorithmic complexity, and the tradeoff between correctness and performance. As a fun Christmas project, [Scripsi] set out to implement twelve different sorting algorithms over twelve days, using Christmas lights as the sorting medium.

The lights in use here are strings of WS2812 addressable LED strips, with the program set up to assign random hue values to each of the lights in the string. From there, an RP2040-based platform will step through the array of lights and implement the day’s sorting algorithm of choice. When operating on an element in the array the saturation is turned all the way up, helping to show exactly what it’s doing at any specific time. When the sorting algorithm has finished, the microcontroller randomizes the lights and starts the process all over again.

For each of the twelve days of Christmas [Scripsi] has chosen one of twelve of their favorite sorting algorithms. While there are a few oddballs like Bogosort which is a guess-and-check algorithm that might never sort the lights correctly before the next Christmas (although if you want to try to speed this up you can always try an FPGA), there are also a few favorites and some more esoteric ones as well. It’s a great way to get some visualization of how sorting algorithms work, learn a bit about programming fundamentals, and get in the holiday spirit as well.

Twelve Days Of Christmas As Performed By 1980s Speech Chip

In a curious historical twist, the “Twelve days of Christmas” are actually the days of revelry that followed the 25th. The preceding period, Advent, was traditionally a fast, not unlike Lent. When and why a fast became an excuse for chocolate calendars we cannot say, but this historical information is presented to explain that this great hack by [Kevin], making a vintage speech synthesizer chip sing the classic carol will remain relevant at least until January 5th — or perhaps even the 19th, for the Orthodox amongst us.

The chip in question is an SP0256A-AL2, which you may remember from various speech projects for 8-bit computers back in the day. It can talk, after a fashion, by reproducing 56 “allophones” — the sounds that make up English speech — from ROM. Singing, though? We cannot recall much of that back in the day, but then, a talking computer was impressive enough.

As it turns out this is building on an earlier hack [Kevin] did in which he used an Arduino to make the venerable speech chip MIDI controllable. In that project’s write-up it is revealed that a Si5351 programmable clock module is used to give a variable pitch signal to the speech synthesizer. In this way he’s able to get about an octave an a half, which is good enough when the carol in question only spans one octave.

Of course the pitch signal needs to be varied by something and for that the venerable Arduino once again takes the place of an 8-bit computer. In this case it’s pre-programmed, but can also be set up for MIDI control.Of course nothing says you can’t use true retro hardware or a more-capable RP2040 instead of the Amtel chip.

It’s sad to think how much compute power has been wasted this year on AI-generated novelty carols when a little bit of 1980s silicon and some ingenuity can do nearly as good — or better, depending on your tastes. Continue reading “Twelve Days Of Christmas As Performed By 1980s Speech Chip”

Christmas Ornament Has Hidden Compartment, Clever Design

If you need something clever for a gift, consider this two-part 3D-printed Christmas ornament that has a small secret compartment. But there’s a catch: the print is a challenging one. So make sure your printer is up to the task before you begin (or just mash PRINT and find out).

Want a challenging print that’s also useful? This two-piece ornament has a small gift area inside, and prints without supports.

This design is from [Angus] of [Maker’s Muse] and it’s not just eye-catching, but meticulously designed specifically for 3D printing. In fact, [Angus]’s video (embedded under the page break) is a great round-up of thoughtful design for manufacture (DFM) issues when it comes to filament-based 3D printing.

The ornament prints without supports, which is interesting right off the bat because rounded surfaces (like fillets, or a spherical surface) facing the build plate — even when slightly truncated to provide a flat bottom — are basically very sharp overhangs. That’s a feature that doesn’t generally end up with a good surface finish. [Angus] has a clever solution, and replaces a small section with a flat incline. One can’t tell anything is off by looking at the end result, but it makes all the difference when printing.

There are all kinds of little insights into the specific challenges 3D printing brings, and [Angus] does a fantastic job of highlighting them as he explains his design and addresses the challenges he faced. One spot in particular is the flat area underneath the hang hole. This triangular area is an unsupported bridge, and because of its particular shape, it is trickier to print than normal bridges. The workable solution consists of countersinking a smaller triangle within, but [Angus] is interested in improving this area further and is eager to hear ideas on how to do so. We wonder if he’s tried an approach we covered to get better bridges.

Want to print your own? 3D files are available direct from [Angus]’s site in a pay-what-you-like format. If your 3D printer is up to it, you should be able to make a few before Christmas. But if you’d prefer to set your sights on next year with something that uses power and hardware, this tiny marble machine ornament should raise some eyebrows.

Continue reading “Christmas Ornament Has Hidden Compartment, Clever Design”

Bare Metal STM32: Increasing The System Clock And Running Dhrystone

When you start an STM32 MCU with its default configuration, its CPU will tick along at a leisurely number of cycles on the order of 8 to 16 MHz, using the high-speed internal (HSI) clock source as a safe default to bootstrap from. After this phase, we are free to go wild with the system clock, as well as the various clock sources that are available beyond the HSI.

Increasing the system clock doesn’t just affect the CPU either, but also affects the MCU’s internal buses via its prescalers and with it the peripherals like timers on that bus. Hence it’s essential to understand the clock fabric of the target MCU. This article will focus on the general case of increasing the system clock on an STM32F103 MCU from the default to the maximum rated clock speed using the relevant registers, taking into account aspects like Flash wait states and the APB and AHB prescalers.

Although the Dhrystone benchmark is rather old-fashioned now, it’ll be used to demonstrate the difference that a faster CPU makes, as well as how complex accurately benchmarking is. Plus it’s just interesting to get an idea of how a lowly Cortex-M3 based MCU compares to a once top-of-the line Intel Pentium 90 CPU.

Continue reading “Bare Metal STM32: Increasing The System Clock And Running Dhrystone”

A Musically-Reactive LED Christmas Tree

Regular Christmas trees don’t emit light, nor do they react to music. If you want both things in a holiday decoration, consider this build from [dbmaking]. 

An ESP32-D1 mini runs the show here. It’s hooked up to a strip of WS2812B addressable LEDs. The LED strip is placed on a wooden frame resembling the shape of a traditional Christmas tree. Ping-pong balls are then stacked inside the wooden frame such that they act as a light diffuser for the LEDs behind. The microcontroller is also hooked up to an INMP441 omnidirectional MEMS microphone module. This allows the ESP32 to detect sound and flash the LEDs in time, creating a colorful display that reacts to music. This is achieved by using the WLED web installer to set the display up in a sound reactive mode.

It’s a fun build, and we’d love to tinker around with coding more advanced visualizer effects for a build like this. We’ve seen builds that go the other way, too, by toning down excessive blinkiness in Christmas decorations.

Continue reading “A Musically-Reactive LED Christmas Tree”

Bare Metal STM32: The Various Real Time Clock Flavors

Keeping track of time is essential, even for microcontrollers, which is why a real-time clock (RTC) peripheral is a common feature in MCUs. In the case of the STM32 family there are three varieties of RTC peripherals, with the newest two creatively called ‘RTC2′ and RTC3’, to contrast them from the very basic and barebones RTC that debuted with the STM32F1 series.

Commonly experienced in the ubiquitous and often cloned STM32F103 MCU, this ‘RTC1’ features little more than a basic 32-bit counter alongside an alarm feature and a collection of battery-backed registers that requires you to do all of the heavy lifting of time and date keeping yourself. This is quite a contrast with the two rather similar successor RTC peripherals, which seem to insist on doing everything possible themselves – except offer you that basic counter – including giving you a full-blown calendar and today’s time with consideration for 12/24 hour format, DST and much more.

With such a wide gulf between RTC1 and its successors, this raises the question of how to best approach these from a low-level perspective.

Continue reading “Bare Metal STM32: The Various Real Time Clock Flavors”