Uncategorized

PIC Beeper

After learning about the PIC12F752 in a mechatronics class, I was tempted to use the cheap microcontroller to play music. The device has 1024 Bytes of program memory, but only 64 Bytes of flash, making storing a song in data memory very difficult. Instead, I hacked together a code generation program in Python that would read MIDI files and output the notes as a C program, which could reside entirely in program memory.

Even while storing notes in program memory, each PIC could only hold around 40 notes. I took this as an opportunity to create a chainable series of boards, each of which could only play a set portion of the song. Each board has input pins for power and the master reset pin on the microcontroller, and has output pins for the same functions. Powering one board in the stack provides power to all of the boards, and the first board in the stack boots up and asserts a LOW on its master reset output, thus disabling the subsequent boards. Once the first board is done playing, it asserts a HI on master reset, allowing the next board in the chain to play. When the next board is done, it asserts a HI on its master reset output, and the chain continues to play.

Early prototypes of the PIC beeper board were made on a CNC in my dorm room using 1-sided FR4 copper-clad boards.

An original prototype milled out of single-sided copper clad FR4.

I later moved to commercially produced PCBs for the final product (2-sided boards). In order to reduce the form factor of the board, I switched to a QFN package for the 12F752 and added a custom POGO programming header to interface with the PiCKit programmer. At some point in this process I also realized that the CR2032 battery didn’t have enough current to power some of the louder / lower resistance beepers I wanted to use, so I switched to a design with two AA batteries powering all of the beepers in a stack.

Closeup of the new board with its compact programming header.
A prototype board being programmed, with a Genuine Bodge (TM) visible on the left.

I purchased the final boards as a small panel with v-scoring, and used a solder paste stencil and my Controleo3 reflow oven for assembly. I used water wash solder paste, and covered the buzzers with Kapton tape to protect them during the water wash / ultrasonic cleaning process.

Once the boards were fully assembled, I fired up my code generator and programmed them in sequence with their corresponding portions of the song.

The assembled chain of beepers worked as intended! Some of the notes are a little bit scratchy or weirdly loud, but I think that’s attributed to them being close to the resonant frequency of the beeper or the PCB. The notes are synthesized by varying the period of a 50% duty cycle square wave, so there are lots of higher frequency harmonics, but it works in a pinch!

Posted by jmcnelly, 0 comments

Birdcam

Live stream
I decided to build a bird feeder with a live-streaming camera for my significant other’s birthday. It seems to work pretty well! The system is based on a Raspberry Pi Zero W running the Motion firmware, with an image mask and motion trigger set to activate when birds land on the feeder. Every night, a shell script runs the imagemagick utility to convert all images with the same minute time stamp into fun little combined gifs. This project is a work in progress–automatic image tweeting and imgur uploads should be coming soon! In the meantime, if anyone needs an absolutely massive number of tiny bird gifs, I’m happy to share!

Parts List

Code

Posted by jmcnelly, 0 comments

3D Printer Enclosure Fan Controller

Overview

After building my 3D printer enclosure, I ran into the issue of my printer enclosure getting too warm. Temperatures during extended prints were climbing above 130 degrees Fahrenheit, which was causing my printer electronics to overheat, leading to extrusion issues and missed steps. I remedied this by propping the door open with a rag, but that removed the noise damping benefit of the enclosure. An overcomplicated but fun solution in the form of a PID fan controller was devised. This controller uses and Arduino nano to PWM control a logic-level N-channel MOSFET that feeds into a low-pass filter in order to control a 12V radial blower fan with a varying analog voltage. Bit-shifting in the Arduino Nano code takes advantage of the built-in timers in the Atmel Atmega 328p processor in order to generate PWM frequencies at 25kHz, which is outside the range of human hearing and thus less annoying. Initial attempts to control the fan using straight PWM without a low-pass filter proved to be unreliable, but the current setup with the low-pass filter has been running strong for over 6 months as of the writing of this post.

Code

Parts List

Pictures

Electronics
Main menu
Config screen 1
Config screen 2
Controller and fan

Posted by jmcnelly, 0 comments

LED Trumpet

Overview

This is my second iteration of my LED trumpet.  The first iteration used an Arduino Nano, but I upgraded to a Teensy this time around for more processing power (gotta get all them FFT’s).  The system is powered by Lipo batteries (from my rc aircraft projects) feeding a Castle 10A SBEC that provides 5V to the Teensy and SK6812 individually addressable LEDs.  There’s an Adafruit microphone module buried inside the 3D printed electronics housing, allowing the LEDs to run an FFT pattern and volume-activated effects.  Three buttons on the side of the electronics housing allow the user to change modes (or play snake, in one of the modes), and a power switch allows the user to easily flick the system on or off with their thumb.  The top of the electronics housing has an LED voltmeter built in to allow the user to monitor the battery voltage of the trumpet.

Code

Parts List

Posted by jmcnelly, 0 comments

Fire Alarm Pull Light Switch Cover

I got bored during finals and measured the fire alarm pull outside my dorm room.  Adding a slot to the back allowed me to fit it over my room’s existing light switches, and a dual-color print from PETG gave it a somewhat realistic look.  Shenanigans ensued.

Thingiverse Link

Posted by jmcnelly, 0 comments