Like most people, I saw the Billy Bass Alexa integration video and I was instantly infatuated. I think most 90's kids remember that annoying Billy Bass wall toy that sang "Don't Worry Be Happy" anytime someone walked by it. Hearing Alexa's voice come out of its mouth and having her syllables synced with the fish's mouth was priceless. First off let me say awesome idea. The original project was the brainchild of Brian Kane of Cambridge, an IoT hacker and digital artists.
I have decided to try and replicate it on my own as I am a part of a gift exchange with my family for Christmas and I think a Billy Bass Amazon Echo would probably take the cake!
So how did Brian do it?
There are likely three different sub-components in Brain's hack - the Billy Bass, a microcontroller, and a Raspberry Pi with the Alexa API.
Amazon has released the Alexa API in its developers program (which is free to join), and this is most likely how Amazon's assistant was integrated into this project. Several people have implemented Alexa successfully into a Raspberry Pi using a usb microphone and auxiliary speakers. Amazon recently (in the last six months) introduced the always listening function into their public API, which makes this a far easier undertaking. This is where the Alexa "brain" lives.
The Billy Bass is an obvious component; it contains the motors for the mouth and head/tail. There is also a speaker here which could possibly be used in the hack.
The microcontroller is what holds the codes that tell the motors of the Billy Bass what to do (OUTPUT) when the Raspberry Pi Alexa "speaks" (INPUT). The easiest solution here would be to use an arduino.
Exisiting Base of Knowledge
There is no need to reinvent the wheel when taking on a project like this, and so I intend to utilize the works of others to guide this project.
Since I began planning this project, the creator of the Maker Project Lab, Donald Bell, beat me to the basic constructs of the Alexa Pi Billy Bass, and wrote a really nice instructable (including code!) for his project. Although Donald's project runs off of an Echo Dot (instead of a Raspberry Pi), he has laid out a clear set of instructions for interfacing the arduino with audio inputs, and motor output.
This project is to be divided into two sub-projects, which will then be integrated together.
Part 1: Raspberry Pi Alexa API
Part 2: Billy Bass Arduino Assembly
Part 3: Final Assembly
The specific objectives of this project, and their current progress, are as follows:
Current Project Status:
The fish is assembled in its housing and connected to an AlexaPi with trigger word "Raspberry Pi Billy Bass" with headless boot. There is some noise in the motors that needs to be addressed.
Part 1: Building the Alexa API on to a Raspberry Pi
This really is not that difficult, even if you are new to the Raspberry Pi. I followed the step-by-step instructions from Lifehacker.com. I have written a detailed post which outlines my steps creating the computer-mind behind the Bass!
This part does require one to be a bit more tech savvy. That being said, if you have a basic understanding of code, and a basic understanding of electronics, you should be able to follow these steps and get through the more slightly more complex steps. As mentioned before, Donald Bell wrote a great instructable on which these instructions are based. I recommend heading over to his instructions to set eyes on a few more images of the process if you'd like.
The biggest difference between Donald's version and my own is that I have both the head/tail movement and the mouth movement. As a part of this work-around, there are actually two microcontrollers used in the project instead of just one. This is to address the conflict I had attempting to use just one, as the power draw at any one time would result in a conflict between the two motors.
The objectives are as follows:
1. Expose the fish wiring
2. Solder the audio jacks and leads
3. Solder the boards and shields together
4. Hookup wiring of fish to arduino
5. Write and install code
6. Reassemble the fish with the mcirocontrollers
Below are the components needed and links to the parts I used:
I am not sure if it matters, but I had the 15th Anniversary Big Mouth Billy Bass, so the number of screws and placement of electronics may be slightly different in other models (namely the OG Billy Bass has three DC motors vs two, but this code and project can be easily adapted to the three motor configuration). This step is fairly straightforward.
First, remove the batteries. Then, using a small screwdriver, remove the six screws on the back of the housing and gently open it up. It may help to have fingernails here, but gently pull up on the plastic wire harnesses. Next, use a screwdriver to remove the light brown circuit board of the Billy Bass; this will make room we will need later.
Set the back of the housing (with the speaker) and the Billy Bass circuit board aside for now.
As Donald explained, what you are left with are four wires and two motors. One motor controls the mouth and is connected by the black and orange wire running into the fish's body. The other motor controls the head/tail; when the motor turns on way the head moves, and when the motor turns the other way the tail moves. The mouth motor is located in the housing and is connected with red and white wires.
Cut four wires of equal length and strip the ends. Insert these wires into the 4-wire harness. These will later be connected to the arduino motor shield.
In case you want to get more involved with the internal mechanics of the fish, you can disconnect the 3-motor-mount screws, and four fish mount screws to remove Billy Bass from his mount. You can then carefully peel his rubber skin off, and you can get a good sense of what you're actually working with. Keep in mind that the motor settings in the code account for the added resistance of the rubber skin, so you may experience unexpected movement when the fish is skinned and/or removed from its housing.
Step 2: Solder the audio jacks and leads
There really isn't too much soldering involved; that being said, as a novice solderer it was still the most stressful step in the project. Don't worry, deep breath, you can do this!
I provided the link to the panel mount audio jack that I used above. Similar to the one Donald used in his Instructable, mine was a stereo jack which had three pins (left, right, and ground). We only need two of the pins because our sound is mono, not stereo, so we just ignore the third! On this particular audio jack, the longer pin in the middle is the ground (Pin 1) and Pin 2 is Left and Pin 3 is Right.
Cut two small lengths of wire, strip the ends, and solder to the ground and one of the other pins. If you aren't very confident in your soldering abilities (like me!) you can get a great refresher from Collin's Lab over at Adafruit.
Next, solder the ground wire to the GND on the motor shield, and the other to ANALOG 0. Be sure to use the inputs that are one set away from the edge of the board, the inputs on the periphery are going to be used to connect the motor shield to the arduino.
That's it! Simply repeat for the second audio jack. But don't put your soldering iron away yet, we still need to connect the motor shields to the arduino in the next step.
Step 3: Solder the board and shield together
This was one step that was not immediately clear to me, but I was able to figure out from Donald Bell's photos. I'm a mechanical engineer, so I am somewhat of an electronics noob. The Adafruit motor shield comes with a plain header (looks like the nose of a sword fish) and a jumper (little black plastic piece that looks like trash). The plain header is to be broken into pieces and fitted in all of the inputs in the arduino shield. The motor shield is then placed on top of it.
Once you have the motor shield fitted in place on the header pins, solder each header pin, total of 31. Now your motor shield is connected to your arduino.
Very important, as pointed out by Donald, the jumper sleeve (little black plastic piece that looks like trash) must be placed on the pins labeled VIN jumper, or the motor shield will not power on.
Step 4: Hookup Wiring of Fish to Arduino
This is the last set of connections we need to make, for now. Use small screwdriver to seat the wires from the motor into the terminal blocks - mouth motor to M1 and head/tail motor to M2. It does not matter which wire is seated as long as it is for the right motor; swapping the motor around will only make the motor turn the other direction and it can easily be adjusted for later on.
Step 5: Write and install code
My code is based on Donald Bells's which he provided in his instructable with additions for head/tail movement and some noise filtering. Additionally, it is based on "Blink without Delay" which was last updated by Scott Fitzgerald and can be found here. Download the code file below and save it to your computer. I used the Arduino IDE, which is free, and can be downloaded here.
Download my code for this project from Github here. The code is a work in progress and is updated regularly. Additionally, it is in the public domain and contributions are welcome. Presently there is head/tail motor functionality with mouth motor functionality, each is a separate file intended for a separate microcontroller.
Also, head to Adafruit and download the library for the motor shield. Adafruit also has a very detailed tutorial on installing libraries which you can find here. You will need these libraries saved before you can compile the arduino code.
If you need a refresher on coding in the Arduino IDE I found the accompanying tutorial under Help > Get Started very helpful.
Minimal mouth or head/tail movement
This problem bugged me all night after I first got Donald's original code up and running. The issue I was having was too little current into the board. You can power the board with anywhere from 5-12V, but the voltage regulator on the board brings down anything above 6.8V and the remaining voltage is emitted as heat. I reached out to Donald and he said he was using a 9V 1A power supply and it was working well. I ordered a 9V 2A power supply but in the interim I used a 12V 1A power supply (with a heat sink on the voltage regulator chip) and blew off the electrolytic capacitor on the head/tail motor, so I would stick to 9V max.
I realized when I had set the settings for the motor and transitioned from a lower-power to higher-power source that it was a little too much for the motor to handle, and I exploded a capacitor on the head/tail motor. Thankfully a fellow maker and author of the original instructable, Donald Bell, was able to let me know that the capacitor I blew up was a 10V 100uF electrolytic capacitor. I went to RadioShack and was able to replace it with a 35V 100uF electrolytic capacitor and soldered it back on to the motor where the original one was. Remember that these are polarized and you have to make sure you put the capacitor on in the proper direction, so just double check with a multimeter.
Using an echo dot to test
While I wrote the code I found it easier to just use a spare echo dot to test the fish motor responses. This is perfectly fine, just keep in mind that the audio output on the echo dot will be modified by the echo dot itself, in addition to the speakers (if they have audio control). When I programmed this fish, the code was optimized for 100% Echo volume. If you bump the volume up too high you can blow a motor, if it's too low you won't get a good response from the fish, so in order to protect the motor the motor and PWM settings are optimized for maximum volume input. If at all possible just adjust your volume at the speakers.
Insufficient motor braking
So your mouth motor is working, awesome! But the head lifts and then slowly drops down throughout the Alexa commands. This is likely because there is not enough current to the device. Remember, you can send up to 2 A into the Adafruit Motor Shield V2 and the Arduino. If you are using a different power supply (i.e. USB A-B cable) or different motor shield or Arduino, this may be why. Additionally, the code is designed to use enough motor movement to counteract the spring-effect from the rubber, If this motor movement is not sufficient, you can try increasing the motor speed for this step in the code.
Part 3: Final Assembly
You're almost there! Once the fish is operational with the Echo dot, you can package the fish and its new inner contents back into the fish housing and wire up the fish!
First the fish has to be wired. You will see a schematic below.
To seat the boards you will need to snip off some plastic posts in the housing, see the images below. This was the arrangement that worked for me, but maybe you will find a different one, as long as the wiring is not too stressed however the boards fit is fine!
Now, if you have any metal parts exposed that may touch the boards, you need to cover them with electrical tape.
I chose to drill three smaller holes versus one larger hole in order to maintain integrity of the housing. To avoid cracking, don't forget to drill a pilot hole.
And that's it! Now your Billy Bass is up-and-running with the Amazon Echo!
- Adjust PWM on motors to reduce high-pitched noise
- Use Adafruit Feather boards instead of Adafruit Metro/ Arduino to save space