screenshot of the code defining a hid descriptor by using essentially macros for common descriptor types

Coupling STM32 And Linux? Consider HID Over I2C

If you’re pairing a tiny Linux computer to a few peripherals — perhaps you’re building a reasonably custom Pi-powered device — it’s rightfully tempting to use something like an STM32 for all your low-level tasks, from power management to reading keyboard events.

Now, in case you were wondering how to tie the two together, consider HID over I2C, it’s a standardized protocol with wide software and peripheral support, easily implementable and low-power. What’s more, [benedekkupper] gives you an example STM32 project with a detailed explanation on how you too can benefit from the protocol.

There are several cool things about this project. For a start, its code is generic enough that it will port across the entire STM32 lineup nicely. Just change the pin definitions as needed, compile it, flash it onto your devboard and experiment away. Need to change the descriptors? The hid-rdf library used lets you define a custom descriptor super easily, none of that building a descriptor from scratch stuff, and it even does compile-time verification of the descriptor!

The project has been tested with a Raspberry Pi 400, and [benedekkupper] links a tutorial on quickly adding your I2C-HID device on an Linux platform; all you need is DeviceTree support. Wondering what’s possible with HID? We’ve seen hackers play with HID aplenty here, and hacking on the HID standard isn’t just for building keyboards. It can let you automate your smartphone, reuse a laptop touchpad or even a sizeable Wacom input surface, liberate extra buttons on gamepads, or build your own touchscreen display.

Showing a Raspberry Pi 4 board connected to an ESP32 devboard using jumper wires for the purposes of this project

ESP-Hosted Turns ESP32 Into Linux WiFi/BT Adapter

While we are used to USB WiFi adapters, embedded devices typically use SDIO WiFi cards, and for good reasons – they’re way more low-power, don’t take up a USB port, don’t require a power-sipping USB hub, and the SDIO interface is widely available. However, SDIO cards and modules tend to be obscure and proprietary beyond reason. Enter ESP-Hosted – Espressif’s firmware and driver combination for ESP32 (press release)(GitHub), making your ESP32 into a WiFi module for either your Linux computer (ESP-Hosted-NG) or MCU (ESP-Hosted-FG). In particular, ESP-Hosted-NG his turns your SPI- or SDIO-connected ESP32 (including -S2/S3/C2/C3/C6 into a WiFi card, quite speedy and natively supported by the Linux network stack, as opposed to something like an AT command mode.

We’ve seen this done with ESP8266 before – repurposing an ESP8089 driver from sources found online, making an ESP8266 into a $2 WiFi adapter for something like a Pi. The ESP-Hosted project is Espressif-supported, and it works on the entire ESP32 lineup, through an SDIO or even SPI interface! It supports 802.11b/g/n and even Bluetooth, up to BLE5, either over an extra UART channel or the same SDIO/SPI channel; you can even get BT audio over I2S. If you have an SPI/SDIO port free and an ESP32 module handy, this might just be the perfect WiFi card for your Linux project!

There are some limitations – for instance, you can’t do AP mode in the NG (Linux-compatible) version. Also, part of the firmware has blobs in it, but a lot of the firmware and all of the driver are modifiable in case you need your ESP32 to do even more than Espressif has coded in – this is not fully open-source firmware, but it’s definitely way more than the Broadcom’s proprietary onboard Raspberry Pi WiFi chip. There’s plenty of documentation, and even some fun features like raw transport layer access. Also, of note is that this project supports ESP32-C6, which means you can equip your project with a RISC-V-based WiFi adapter.

Title image from [zhichunlee].

A PCB business card that plays tic-tac-toe with red and blue LEDs.

2024 Business Card Challenge: Go Tic-Tac-Toe-to-Toe With Them

There is perhaps no more important time to have a business card than when you’re in college, especially near the end when you’re applying for internships and such. And it’s vital that you stand out from the crowd somehow. To that end, Electrical & Computer Engineer [Ryan Chan] designed a tidy card that plays tic-tac-toe.

Instead of X and O, the players are indicated by blue and red LEDs. Rather than having a button at every position, there is one big control button that gets pressed repeatedly until your LED is in the desired position, and then you press and hold to set it and switch control to the other player. In addition to two-player mode, the recipient of your card can also play alone against the ATMega.

The brains of this operation is an ATMega328P-AU with the Arduino UNO bootloader for ease of programming. Schematic and code are available if you want to make your own, but we suggest implementing some type of changes to make it your own. Speaking of, [Ryan]  has several next steps in mind, including charlieplexing the LEDs, using either USB-C or a coin cell for power, upgrading the AI, and replacing the control button with a capacitive pad or two. Be sure to check it out in action in the two videos after the break.

Continue reading “2024 Business Card Challenge: Go Tic-Tac-Toe-to-Toe With Them”

ESP32 Brings New Features To Classic Geiger Circuit

There’s no shortage of Geiger counter projects based on the old Soviet SBM-20 tube, it’s a classic circuit that’s easy enough even for a beginner to implement — so long as they don’t get bitten by the 400 volts going into the tube, that is. Toss in a microcontroller, and not only does that circuit get even easier to put together and tweak, but now the features and capabilities of the device are only limited by how much code you want to write.

Luckily for us, [Omar Khorshid] isn’t afraid of wrangling some 0s and 1s, and the result is the OpenRad project. In terms of hardware, it’s the standard SBM-20 circuit augmented with a LILYGO ESP32 development board that includes a TFT display. But where this one really shines is the firmware.

With the addition of a few hardware buttons, [Omar] was able to put together a very capable interface that runs locally on the device itself. In addition, the ESP32 serves up a web page that provides some impressive real-time data visualizations. It will even publish its data via MQTT if you want to plug it into your home automation system or other platform.

Between the project’s Hackaday.io page and GitHub repository, [Omar] has done a fantastic job of documenting the project so that others can recreate it. That includes providing the schematics, KiCad files, and Gerbers necessary to not only get the boards produced and assembled, but modified should you want to adapt the base OpenRad design.

This project reminds us of the uRADMonitor, which [Radu Motisan] first introduced in 2014 to bring radiation measuring to the masses. This sort of hardware has become far more accessible over the last decade, bringing the dream of a globally distributed citizen-operated network of radiation and environmental monitors much closer to reality.

Continue reading “ESP32 Brings New Features To Classic Geiger Circuit”

Hackaday Links Column Banner

Hackaday Links: June 23, 2024

When a ransomware attack targets something like a hospital, it quickly becomes a high-profile event that understandably results in public outrage. Hospitals are supposed to be backstops for society, a place to go when it all goes wrong, and paralyzing their operations for monetary gain by taking over their information systems is just beyond the pale. Tactically, though, it makes sense; their unique position in society seems to make it more likely that they’ll pay up.

Which is why the ongoing cyberattack against car dealerships is a little perplexing — can you think of a less sympathetic victim apart from perhaps the Internal Revenue Service? Then again, we’re not in the ransomware business, so maybe this attack makes good financial sense. And really, judging by the business model of the primary target of these attacks, a company called CDK Global, it was probably a smart move. We had no idea that there was such a thing as a “Dealer Management System” that takes care of everything from financing to service, and that shutting down one company’s system could cripple an entire industry, but there it is.

Continue reading “Hackaday Links: June 23, 2024”

A solar-powered decibel meter the size of a business card.

2024 Business Card Challenge: NoiseCard Judges The Sound Around You

Let’s face it: even with the rise of the electric car, the world is a noisy place. And it seems like it has only gotten worse in recent years. But how can we easily quantify the noise around us and know whether it is considered an unhealthy decibel level?

That is where the NoiseCard comes in. This solar-powered solution can go anywhere from the regrettable open office plan to the busy street, thanks to a couple of 330 µF capacitors. It’s based on the low-power STM32G031J6 and uses a MEMS microphone to pick up sound from the back of the card, which the code is optimized for. Meanwhile, the LEDs on the front indicate the ambient noise level, ranging from a quiet 40 dB and under to an ear-splitting 105 dB or greater.

When it comes to building something the size of a business card, every component is under scrutiny for size and usefulness. So even the LEDs are optimized for brightness and low power consumption. Be sure to check it out in action after the break in various environments.

Continue reading “2024 Business Card Challenge: NoiseCard Judges The Sound Around You”

2024 Business Card Challenge: Integrated Game Card

[Dan Schnur] has a simple strategy to ensure their business card stays on the client’s desk and doesn’t just get lobbed in a drawer: make it into a simple gaming platform. This entry into the 2024 Business Card Challenge is based around the tinyjoypad project, integrating an SSD1306 OLED display, joypad, and push button.

Powered by the superstar ATTiny85, the electronics are really not all that much, just a sprinkling of passives to support the display and the six switch inputs from the joystick and push button. Or at least, that’s how much we can glean from the PCB images, as the PCB design files are not provided in the project GitHub.

Leaving the heavy lifting of the software to the tinyjoypad project, the designer can concentrate on the actual job at hand and the reason the business card exists to stay at the forefront of the client’s mind. In the meantime, the card can be a useful distraction for those idle moments. A few such distractions include a tiny version of Missile Command (as shown above), tiny tris, and a very cut-down Q-bert.  Sadly, that last game isn’t quite the same without that distinctive sound.