ESP32Synth : An Audio Synthesis Library For The ESP32

With MCUs becoming increasingly more powerful it was only a matter of time before they would enable some more serious audio-processing tasks. [Danilo Gabriel]’s ESP32Synth library is a good example here, which provides an ESP-IDF based 80+ voice mixing and synthesis engine. If you ever wanted to create a pretty impressive audio synthesizer, then all you really need to get started is an ESP32, ESP32-S3 or similar dual-core Espressif MCU that has the requisite processing power.

Audio output goes via I2S, requiring only a cheap I2S DAC like the UDA1334A or PCM5102 to be connected, unless you really want to use the internal DAC. With this wired up you get 80 voices by default, with up to 350 voices demonstrated before the hardware cannot keep up any more. You can stream multiple WAV files from an SD card for samples along with the typical oscillators like sinewave, triangle, sawtooth and pulse, as well as noise, wavetables and more.

In order to make this work in real-time a number of optimizations had to be performed, such as the removal of slow floating-point and division operations in the audio path. The audio rendering task is naturally pinned to a single core, leaving a single core for application code to use for remaining tasks. While the code is provided as an Arduino project, it uses ESP-IDF so it can likely be used for a regular ESP-IDF project as well without too much fuss.

ESP32 Hosts A Public Website

If you wanted to host a website, you could use any one of a number of online services, or spin up a server on a spare computer at home. If you’re a bit more daring, you could also do what [Tech1k] did, and run one on an ESP32 microcontroller.

The site in question is available (or at least, should be) at HelloESP.com. The first revision ran entirely on an ESP32, serving pages from a SPIFFS filesystem. The device was also fitted with a BME280 environment sensor and an OLED screen. It had an uptime of 500 days before the board failed.

The site has since been relaunched, running on a board that is framed on [Tech1k]’s wall. It runs on an ESP32-WROOM-32D, paired with a BME280 again, along with a CCS811 CO2 and air quality sensor and a DS3231 RTC for accurate timekeeping. The ESP32 is setup to hold an outbound WebSocket to a Cloudflare worker, with the Worker routing HTTP requests to the site via that route. This avoids the need for port forwarding for the ESP32 to be visible to the outside world, and the Cloudflare Worker will also serve a static version of the page in the case of WiFi dropouts or other temporary failures.

It’s true that this isn’t a completely unheard of project—microcontrollers have been working as simple web servers for a long time now. Still, [Tech1k] did a great job of making this as robust as possible and more like a real functional webserver rather than just something that runs on a local network to serve up a config page. That’s worthy of note.

You can run webservers on all kinds of chips these days, even the Raspberry Pi Pico. If you’re doing web stuff on something weird, you know we always wanna hear about it on the tipsline!

DIY Smart Button Gets Surprisingly Complicated

There’s a reason that the standards specifications for various wireless communications protocols are extremely long and detailed. [Made by Dennis] found this out first hand when he decided to build a wireless button from scratch.

The major issues with wireless devices is one of power consumption. If reliable power is available from a wall plug or solar panel, this isn’t as serious of a concern. But [Dennis] is using batteries for his buttons, so minimizing power consumption is a priority. He’s going with the nRF52, a microcontroller designed for low power and which has a built in wireless radio, and configuring it in a way that uses the least amount of energy possible.

From there, [Dennis] turns to the wireless communication. He goes into detail about how the microcontroller is woken up, how it sends its data packets to another wireless-enabled microcontroller, and how they handle handshakes and acknowledgements of data. For something as simple as a button press, it gets quickly more complicated especially when adding some basic encryption and security to the communications protocol.

With all the design decisions out of the way, the system can be built. [Dennis] has created custom PCBs for his devices, and also included some expansion I/O for other sensors and peripherals beyond just a pushbutton. All of the schematics and code are available on the project’s GitHub page and the STL files can be found at Printables.

For those new to offline home automation or who are turning away from cloud-based services lately, there are some easy entry points that don’t require much extra hardware or expenditure.

Continue reading “DIY Smart Button Gets Surprisingly Complicated”

Espressif’s New ESP32-S31: Dual-Core RISC-V With WiFi 6 And GBit Ethernet

In a move that’s no doubt going to upset and confuse many, Espressif has released its newest microcontroller — the ESP32-S31. The confusing part here is that the ESP32-S series was always the one based on Tensilica Xtensa LX7 cores, while the ESP32-C series was the one using RISC-V cores.

That said, if one looks at it as a beefier -S3 MCU it does have some appealing upgrades. The most obvious improvements are with the use of WiFi 6, as well as Bluetooth Classic and LE 5.4, including LE Audio. There is also Thread and Zigbee support for those who are into such things.

The Ethernet MAC got a bump from the 100 Mbit RMII MAC in previous MCUs and is now gigabit-rated, while the number of GPIO is significantly higher at 60 instead of 45 on the -S3. On the RAM side, things are mostly the same, except for DDR PSRAM support, with octal SPI offering up to 250 MHz compared to 80 MHz on the -S3.

On the CPU side the up-to-320 MHz RISC-V cores are likely to be about as powerful as the 240 MHz LX7 cores in the -S3, based on the ESP32-C series performance in terms of IPC. Overall it does seem like a pretty nice MCU, it’s just confusing that it doesn’t use LX7 cores with the series it was put into. When this MCU will be available for sale doesn’t seem to be known yet, with only samples available to select customers.

TinyGo Boldly Goes Where No Go Ever Did Go Before

When you’re programming microcontrollers, you’re likely to think in C if you’re old-school, Rust if you’re trendy, or Python if you want it done quick and have resources to spare. What about Go? The programming language, not the game. That’s an option, too, with TinyGo now supporting over 100 different dev boards, along with webASM.

We covered TinyGo back in 2019, but they were just getting started at that point, targeting the Arduino and BBC:micro boards. They’ve grown that list to include everything from most of Adafruit’s fruitful suite of offerings, ESP32s, and even the Nintendo Game Boy Advance. So now you can go program go in Go so you can play go on the go.

The biggest drawback–which is going to be an absolute dealkiller for a lot of applications–is a lack of wireless connectivity support. Claiming to support the ESP8266 while not allowing one to use wifi is a bit of a stretch, considering that’s the whole raison d’être of that particular chip, but it’s usable as a regular microcontroller at least.

They’ve now implemented garbage collection, a selling point for those who like Go, but admit it’s slower in TinyGo compared to its larger cousin and won’t work on AVR chips or in WebAssembly. It’s still not complete Go, however, so just as we reported in 2019, you won’t be able to compile all the standard library packages you might be used to. There are more of them than there were, so progress has been made!

Still, knowing how people get about programming languages, this will please the Go fanatics out there. Others might prefer to go FORTH and program their Arduinos, or to wear out their parentheses keys with LISP. The more the merrier, we say!

Build This Open-Source Graphics Calculator

Graphics calculators are one of those strange technological cul-de-sacs. They rely on outdated technology and should not be nearly as expensive as they are, but market effects somehow keep prices well over $100 to this day. Given that fact, you might like to check out an open-source solution instead.

NumOS comes to us from [El-EnderJ]. It’s a scientific and graphic calculator system built to run on the ESP32-S3 with an ILI9341 screen. It’s intended to rival calculators like the Casio fx-991EX ClassWiz and the TI-84 Plus CE in terms of functionality. To that end, it has a full computer algebra system and a custom math engine to do all the heavy lifting a graphic calculator is expected to do, like symbolic differentiation and integration. It also has a Natural V.P.A.M-like display—if you’re unfamiliar with Casio’s terminology, it basically means things like fractions and integrals are rendered as you’d write them on paper rather than in uglier simplified symbology.

If you’ve ever wanted a graphics calculator that you could really tinker with down to the nuts and bolts, this is probably a great place to start. With that said, don’t expect your local school or university to let you take this thing into an exam hall. They’re pretty strict on that kind of thing these days.

We’ve seen some neat hacks on graphics calculators before, like this TI-83 running CircuitPython. If you’re doing your own magic with these mathematical machines, don’t hesitate to notify the tips line.

Better Faux-Analog VU Meters

One of the coolest things about old hi-fi hardware is that it often came with flickety needles that danced with the audio level. You can still buy these if you want, or you can simulate the same look on a screen, as [mircemk] demonstrates.

It isn’t [mircemk]’s first rodeo in this regard. An earlier project involved creating simulated VU meters on round displays, but they were somewhat limited. Using the Adafruit GFX library on an ESP32 netted a working setup, but it was jerky and very jagged and digital-looking. It was more akin to a fake needle display running on an 8-bit computer than something that looked like a real vintage VU meter.

Continue reading “Better Faux-Analog VU Meters”