Posts

Showing posts from August, 2023

Reverse engineering a backup sump pump controller

Image
The circuit board in this article came from a battery-powered backup sump pump controller. This device is generally used in conjunction with a mains-powered sump pump. Should the mains-powered pump fail, this device will switch on a battery-powered backup sump pump once the water level in the sump reaches a certain level. This device also charges the battery from mains and monitors the battery voltage. Note on reference designators: Many chips contain multiple copies of the same circuit (for example, 74HC00 NAND chip). Each copy will be shown individually, but will have the same reference designator. To distinguish these copies, the lowest pin number belonging to that copy will be placed in brackets after the reference designator. For example, the gates a 74HC00 with reference designator U1 will be referred to as U1[1], U1[4], U1[8], and U1[11] Operation The device does the following things: Charge the battery from mains when the battery voltage drops below 13.5 volts and stop

Kernel program for driving ws2811 LEDs on a Raspberry Pi

Image
In this aritcle I will describe a kernel program that can be loaded on a Raspberry Pi to control ws2811 addressable LEDs. Unlike other programs that can be used to drive these LEDs on a Raspberry Pi, this program can drive multiple strings in parallel. This allows the user to break up long strings of LEDs into sections to allow them to be updated faster. The kernel program uses the Raspberry Pi's secondary memory interface (SMI) and direct memory access (DMA) hardware to drive the LEDs. User-space programs can interact with the kernel program through the /dev/ws281x file. User-space programs must first use ioctl calls to configure the size and number of LED strings connected to the Raspberry Pi. Then, they can write the LED pixel data directly to the /dev/ws281x file. Finally, the user can either manually update the LEDs with an ioctl call, or configure the kernel program to automatically update after a write. The source code for this project can be found on Github ws2811

Radio music variety

This tool can be used to analyze the variety in the songs a particular radio station plays. iHeart Radio SWR3 Number of songs: Search Title Artist Time Title Artist Occurrences Artist Songs Occurrences Unique songs % unique % of all songs Download

Electronic doorbell circuit based on an ATtiny85

Image
In this article I will explain the operation of an electronic doorbell circuit based on the ATtiny85. The doorbell circuit can produce a realistic-sounding bell effect by generating a sine wave with a decaying amplitude. When the circuit is activated, the device first produces a 720Hz bell sound, followed by a 580Hz bell sound. When the doorbell is not ringing, the ATtiny goes into sleep mode to reduce the power consumption. Since the ATtiny does not have an analog output, I will also describe how the ATtiny can be made to output an analog voltage. The source code, schematic files, and PCB files for this project can be found at https://github.com/mnigmann/doorbell Decaying sine generation The decaying sine waveform is generated by storing a 16-bit fixed-point complex number and repeatedly multiplying that complex number by a constant value. Due to a property of complex multiplication, this results in the complex number rotating around the origin of the complex plane, and decrea

Fusion 2048 running on an Arduino Mega with bitbanged video output

Image
In this article, I will describe a program that allows an Arduino Mega to output video with 3-bit color to a VGA monitor at a resolution of 150 by 100 pixels with a refresh rate of around 54Hz. No external video driver chip is used, so the Arduino must generate the vertical and horizontal timing signals at the correct frequencies as well as output the video data. To demonstrate the Arduino's video output, I programmed the game Fusion, which is a variant of the game 2048 that uses the first 20 elements instead of the first 11 powers of two. I chose this variation because the two-letter element names work better with the low output resolution than the four-digit numbers. The game consists of a 5 by 5 grid, where each cell in the grid can contain a tile corresponding to an element or no tile. The game is controlled by four buttons, each corresponding to a direction. When a button is pressed, all of the tiles slide in that direction. Adjacent tiles in the direction of the move of t