Wednesday, October 2, 2024

Give a Man a Fish, and He Eats for a Day. Give a Man a Singing Fish, and He'll Hate You the Rest of His Life

In this post, I will detail how I customized a Big Mouth Billy Bass animatronic fish to sing any song of my choosing.

Github Link for the lazy 

Video for instant gratification

My Annoying Life Story that Details Why I Decided to Do This in the First Place

Ever since my brother moved into his new house, I had planned to give him a classic Big Mouth Billy Bass audio-animatronic singing fish as a housewarming gift.

Billy Bass in an original box as I remember from the aughties

Alas, these have become rather scarce since they first surfaced in 1998. So, I cast my line to myriad online classified marketplaces and patiently waited for a nibble. At last, in the waning days of February, 2021, I got a bite on Kijiji (local classified ads). I purchased the fish after the seller assured me that it worked, and brought it home.
Billy Bass that I bought

I had landed what appeared to be a fine specimen. This project would ultimately teach me far more about Big Mouth Billy Bass singing fish than I ever thought I would want to know, and the first thing I would learn is the difference between ‘new-era’ Billy Bass fish and ‘legacy’ fish. The manufacturer modified their design several times throughout the years in efforts to cut costs. The most significant mechanical alteration was to reduce the number of motors from 3 to 2. This means that newer Billy Bass fish are unable to move their heads and tap their tails at the same time: the same motor controls both motions by switching its direction. The fish I’d caught was a second edition of Big Mouth Billy Bass Sings for the Holidays, manufactured in 2000. This means that it was one of the fish with 3 motors, and thus a superior range of motion. 

Alas, when I brought it home, I found that I had been misled. When I plugged it in (using the decidedly non-stock AC/DC adapter) and pressed the button, I was subjected to an arthritic performance that could be traced to a failed gear.

The gear is split and does not grip the motor shaft.

No matter, I thought, this will be straightforward to repair. At this point, I ventured into the very active genre of Big Mouth Billy Bass repair videos on YouTube. From these fine internet people, I learned how to properly fillet one of these singing fish to replace the cracked plastic gears. I tried 3D printing a gear, but the printer I have access to is not able to print at the required precision, so I wound up ordering two bags of gears from Amazon. Incidentally, please let me know if you live in Winnipeg, MB and are interested in ordering small plastic gears, I’ll be happy to share! 

Teach the Fish to Sing

Once the motion was repaired, I needed to set about changing the songs that the fish sang and danced to. This particular fish, being a Yule-themed variant, sang Appalachian-inspired versions of ‘Up on the Housetop’ and ‘Jingle Bells’. Neither of these arrangements synchronized particularly well with the fish motions, nor were they nice to listen to.

At this point, I knew I was going beyond merely repairing a broken tchotchke, and entering the fun company of Boston Dynamics and Disney Imagineers: I was going to program my own dancing robot.

Literature Review

At this point, I consulted the internet to review the existing Billy Bass conversion projects, and there are many of them! The most common deficiency that I observed was that many people would simply rip out the control board and try and control everything using commercial motor control boards (e.g. Arduino Shields or Raspi hats). I felt that this would be wasteful, and I may be able to control the motors using the existing transistor control circuitry. 

Here are a few notable works:

Animate a Billy Bass Mouth With Any Audio Source

I hacked a singing fish.

MBed Cookbook: Big Mouth Billy Bass This resource proved the most useful because it shows the pinout for the logic board (which I verified matched my specimen), and a useful software model.

Design

Being an audio-animatronics project, this design includes both hardware and software components.

Hardware

I selected a Raspberry Pi as the controller for several reasons:

  1. I had one handy, this would save money since I would not be buying any new hardware.
  2. It has a built-in card reader for storing audio files, and a built-in network stack to make it easier to add extra functionality later on.
  3. I could program it using Python. This would allow me to model the control software on my PC without needing to build the hardware first. I also wanted an excuse to practice Python :)
  4. It has sufficient processing power to play back high quality audio in real time, and allow for future feature expansion. In fact, it’s probably overkill.

I broke out the Billy Bass control board as described in the MBed article, and tested that the Python script on the raspberry pi could control the motors. This worked quite well. The audio on the other hand, took a little more doing. My original plan was to use the audio output from the Raspberry Pi to drive the same audio pin that the original Billy bass controller had driven. However, I discovered that the speaker driver in the Billy Bass enclosure expected a biased input signal, while the audio output from the raspberry pi produces a line-level differential signal. Therefore I decided to create a custom amplifier circuit from discrete components to drive the speaker using the line-level audio signal from the Raspberry Pi.

The Raspberry Pi audio signal cannot directly drive Billy's speaker


 

System Diagram

Software

Each song that Billy knows comes in two pieces:
  1. The audio file that is played: this is encoded as a wav file
  2. The set of motions that billy does along with the audio: this is encoded as a JSON file with a .mtn file extension.

The billy.py control script runs two threads: one plays back the audio file, and the second parses the .mtn file and schedules the motions to occur in time to the music. I also created a program to help author the motion files that Billy would process. This authoring program has been tested on a Windows PC, and includes an emulator to let the user make sure the motion files synchronize properly with the music.You can use the authoring program to generate different motion files for each of Billy's motors, then stitch them all together.

 

Authoring a motion file



billy.py

record-motion.py emulator.py

OS

Raspian OS on Raspberry Pi 1 (Armv6)

Any

Any

Purpose

Detect existing .mtn/.wav file pairs as they are added

When push-button is pressed, play back an audio file and animate Billy according to the matching .mtn file

Allow user to create .mtn files while a song plays back

Emulate the AP processor so the user can see if the timings for their AP file are correct

Playing the audio file was simple enough. Since I used a Raspberry Pi with Python, I thought that I could simply select a Python library for playing back audio files, and call it. This was easier said than done: I went through several audio libraries trying to find one that would work on both Windows and armv6 Linux. In the end, I wound up using different libraries for the emulator and the fish software (`playsound` on the Raspberry Pi and `playwav` on Windows). 

I presented the fish to my brother, and it was a big hit!

Look at him sing!

The software and appropriate instructions are available on Github.

 

 

 

 

 

 

 

 

 

 

 

 

 

Tuesday, September 30, 2014

ZombieLARP Nerf Gun

© Paul White 2016

See the Imgur album here.

This was a side project I did during the Summer of 2014. My friend and I were attending a Live-Action Roleplaying (LARP) event nearby. This time, the theme was 'Zombie Apocalypse.' As part of the game, people were encouraged to bring their own Nerf weapons. At the beginning of the game, referees would assign damage levels to each weapon based on how cool they thought it was. Since higher damage -> more dead zombies, my buddy and I decided to kit out our Nerf guns to make them more impressive. The mods included re-painting, and adding a digital display to indicate number of shots fired, and current battery voltage, to indicate when new batteries should be installed. This short video illustrates the functionality:


Let's dig into the guts of how this thing works. This dartgun is a modified Nerf N-Strike Stryfe. This gun was selected because it uses an electric motor to accelerate darts as opposed to air pressure. This means it is fully automatic and could (in theory) have its motors over-driven to accelerate the darts even more quickly. We didn't end up going down this road, but that could be a future project. The logic is implemented on an Arduino Pro Mini clone, as shown in the extremely high-end schematic below. If you want to build a project like this for yourself, the source code is available for you to play with. This microprocessor was chosen for 4 main reaons:
  1. It was cheap as borscht
  2. It had a built-in voltage regulator, so that was one less thing to worry about dead-bug wiring in.
  3. It was an Arduino, so it was super easy to program.
  4. it was nice and compact, and would be easy to cram somewhere on the Nerf gun's body.
Here are the schematics of the hardware we used. The voltage divider on pin A7 is used to sample the battery voltage, we divided it down so that it would be within the sampling range of the microprocessor's analog-digital converter.
ZombieLARP Nerf Gun Schematic
ZombieLARP Nerf Gun IR LED schematic

Here's a cross-section of the finished dart gun. Note how I painted the interior of the magazine bay: this was so the gun wouldn't look stupid with the magazine removed. Note the seven-segment displays and accompanying circuitry in the transparent compartment at the rear, and the additional wiring on the motor module:
ZombieLARP Nerf Gun Cross-Section
The darts are counted using a simple IR LED and wavelength-matched phototransistor. The LED is always on, and the phototransistor is blocked momentarily when a dart passes through the muzzle on its way to smoke a zombie. (Note that this required me to cut a small notch in the muzzle to allow the phototransistor to see the LED) This assembly is shown in eye-searing detail in this image:
ZombieLARP Nerf Gun IR Detail
My friend and I wanted to patch the sensing/control circuitry into the Nerf gun's original power circuitry, so we could mooch off the batteries. This was done by wiring the VCC/ground pins in parallel with the rest of the gun's circuitry. The Nerf gun is basically wired as a bunch of switches in series, and if all the switches are closed, the motor circuit will be completed and the two motors will spin and shoot darts. This actually ended up causing a problem for us, since the motors would draw so much current from the batteries that the voltage across the batteries would drop below the microprocessors operating voltage of 5V as they encountered resistance accelerating a dart. This bug was discovered days before ZombieLARP was supposed to start, so we resolved it by simply placing a bunch of capacitors hat I had on hand across the batteries, to smooth the voltage and maintain the necessary 5 V. (this is the 1mF capacitance in the first figure)

The sensor switches are located in the following locations:
  1. Magazine Detector
  2. Jam door
  3. Trigger (button underneath actual trigger. If the other sensors are depressed, pushing this button will cause the motors to spin up)
ZombieLARP Nerf Gun Motor Circuit Detail
Note that this is NOT the original order of operations, we modified it so that the magazine detector would come first, so that it could be sampled by the microcontroller to detect if a magazine was present.

I hope you enjoyed this expose!

Here are the libraries/datasheets for the parts we used:
Seven Segment display: http://www.lumex.com/specs/LDD-C514RI.pdf
SevenSeg Library: http://playground.arduino.cc/Main/SevenSeg

Wednesday, September 10, 2014

ArduIMU-based Home Automation System

© Paul White 2014
For our Final Year Design Project (Capstone project), my team and I designed and implemented a framework for remote automated environmental monitoring and control. We implemented our framework in a simple home automation system based off a wireless network of peripherals. The peripherals are based on early prototypes of the upcoming ArduIMU v4 (https://www.kickstarter.com/projects/494937902/arduimu-v4-an-arduino-based-integrated-measurement). It should be noted that we used stripped-down units with all of the sensors removed; this was done to keep the unit costs low and to make them less time-consuming to assemble.

The network is managed by a PC which acts as a server. The server can receive messages from paired peripherals and also send them commands to do things. From the user’s perspective, we abstracted these messages to triggers and actions.

Users can define Services using the UI. Services allow users to attach one or more actions to a collection of one or more triggers, much like how IFTTT works (https://ifttt.com/wtf). The difference is that we allow combinations (e.g. if the temperature is > 27 degrees Celsius on AND the front door is closed, THEN activate the air conditioner)
Our demonstration system consists of a number of different peripherals including:

1.      Mains relay: A PowerSwitchTail (http://www.powerswitchtail.com/Pages/default.aspx) is connected to a digital I/O pin of the ArduIMU v4 and can switch 120V A/C applicances on and off.

2.      Switch box: This box contains 3 binary toggle switches and a potentiometer. It demonstrates consuming both digital and analog inputs.

3.      Light Strip: This is an Adafruit light strip. It demonstrates more complicated software running on the ArduIMU v4 and communicating over an SPI bus.

4.      Light box: This light box contains 5 differently colored LEDs that can be turned on and off. One LED can be dimmed too to demonstrate the PWM capabilities of our system and the ArduIMU v4.

5.      Compound peripheral: This peripheral has both inputs and outputs. It attaches to up to 2 PowerSwitchTails, a magnetic reed switch and a piezo buzzer. The user can create an intruder alarm service that consumes the trigger caused by the reed switch opening, and starts the buzzer beeping.

The fully functioning system can be seen in this video:

For those of you with too much time on your hands, check out our final report here.

Friday, September 7, 2012

The Pink Fury

© Paul White 2016
The Pink Fury was featured on Hackaday when I first did it back in 2012!

The Pink Fury is what I have fondly named my VERY refurbished iMac G3 PC. I replaced the CRT ofthe strawberry-coloured computer with a 15" 1024x768 LCD panel, which left plenty of room for a microATX motherboard. A couple of other people have tried to do this before, but I wanted some table candy for LAN parties! My final build ended up using a quad-core AMD Athlon CPU, 4 GB DDR2 RAM, and an NVIDIA GTX430 GPU. Even with my cooling uprades (see the end) I needed to down-clock the CPU in order to keep it from overheating. One benefit of the low-resolution display is that the CPU and GPU do not need to draw nearly as many pixels as for a 1080p display, and in fact, since the display is so low-resolution, fancy visual effects and post-processing would not really be visible anyway, and can be disabled. This means that the Pink Fury was actually fairly competent for gaming, at the time of its construction.

Anyway, as with these other people, the first step was mounting the LCD panel. I used expanding foam insulation to seal the gap between the LCD and front bezel, and secured it by sandwiching it between the plastic bezel and original steel frame.

Pink Fury Display
The next step was to install the power supply. This was installed under the PCs body. Due to the space limitations, an SFX power supply was chosen. It was set up to pull air from the motherboard cavity and eject it out the back. Since the monitor had a separate power brick, two AC power cords were spliced together so the entire machine could be powered from a single outlet.
Pink Fury Power supply
The next step was to install the motherboard. Since I used a micro ATX motherboard, there was plenty of room, but the steel plate was not long enough to support the motherboard. To solve this issue, I fabricated a support bracket.
Pink Fury Motherboard Support Bracket
Once the motherboard was mounted and the power supply cables were routed, I devised a means of mounting a DVD drive and hard drive. This was done by modifying the original hard drive caddy to accept a 2.5" hard drive, and replacing the stock CD-ROM drive with a laptop DVD-ROM drive. The original eject button and drive cover plate needed to be transplanted, and were secured using crazy glue.
Pink Fury DVD-ROM/HDD Caddy
One area where I cut corners compared with other builders was the I/O panel. The Pink Fury provides 2 USB 2.0 ports, and an Ethernet jack, but the ports are free-floating. This ostensible provides some extra flexibility, but is ultimately the result of laziness. The control panel from the monitor is also made available here by splicing extra wire into the signal lines. This allows the monitor's contrast to be adjusted, and since the iMac speakers are driven by the speaker circuitry that was already in the monitor, the volume can be adjusted too. Driving the speakers using the amplifiers in the monitor also means that they can be louder than if they had simply been driven by headphone/speaker outputs on the motherboard.
Pink Fury I/O Panel
This brings us to the audio headers. Thankfully, Apple designed the front-panel headphone/microphone jacks against the AC'97 specification, so they could be directly attached to any motherboard with AC'97 headers (although another splice-job was needed since the apple connector followed a nonstandard pinout). The top jack operates as a headphone jack, and the bottom jack accepts a microphone. Additionally, the LEDs under the power button are attached to the motherboard, so the button glows green when the PC is turned on.
Pink Fury Front Panel Audio Board
The final step was to upgrade the cooling. The AMD CPU and NVIDIA GTX 430 GPU put off a lot of heat that could not be adequately exhausted through the top vent, even when the vent was augmented with fans. To resolve this, I cut a hole in the side using a cheap, old soldering iron to melt the plastic (rather than risk cracking it by cutting it with a saw or Dremel tool). Then, I attached another fan and a safety grille. This ensured that the system would not overheat.
Pink Fury Cooling Upgrade