Close
0%
0%

Bilexa Bass

Alexa-Enabling the Billy the Bass

Similar projects worth following
Yes, it has been done before, but nobody else has embeded Alexa INSIDE the Billy for a seamless solution. This project uses an ATTiny to perform all the logic, which includes a photoresistor for detecting when the light ring is illuminated, and audio input for detecting the audio, running a DFT (Discrete Fourier Transform), and controlling the mouth and body motors.

Enclosure

The enclosure is just a Billy the Bass recovered from St. Vincent De Paul's for $2.30. Surprisingly, it worked perfectly. After removing the screws to get inside, there wasn't much to change. While it's easy to remove the main electronics, it's not necessary. Really, only a little bit of shaving was necessary to get the Echo to fit inside. I also removed the brass plate and repainted it. It's easy to remove with a couple screws, and can be modified however you like.

Electronics

The electronics are fairly simple. I tried at first to do a purely analog solution, but the behavior logic and the audio processing made it impossible pretty quick, so I opted for an ATTiny on a small PCB I had used for a previous project (LED Icicles). There are 3 sets of wires that go into the fish; one pair for each motor to control the mouth, body, and tail. I put the tail and body wires together so they'd be controlled at the same time, and wired them through an N-Channel MOSFET to the ATTiny. I wired the mouth motor through a second N-Channel MOSFET to the ATTiny.

To connect to the Echo Dot, I tried a variety of sensing methods, but ultimately settled on a photoresistor placed up against the LED ring, wired like a voltage divider, and brought as an analog input into the ATTiny. Finally, I used the speaker out from the Echo Dot as the audio source. This speaker out went to the Billy The Bass speaker, which had great sound. I also piped the output to a cheap audio amplifier. While not necessary, it did make things slightly easier.

The Echo Dot will not fit into the enclosure complete, so I had to take the bottom off of it. This contains the speaker element, but since we're using the Billy the Bass speaker, this doesn't matter. It also allowed me to access a couple of pins which let me draw 5V from the Echo Dot and pipe it to the ATTiny and audio amplifier. This way everything is powered from the single cable coming in to the enclosure.

Code

The code is written in the Arduino IDE and is as simplified as I could get. I relied heavily on an example of a Discrete Fourier Transform from here: http://blog.podkalicki.com/attiny13-dance-lights-with-fft/. I am sad to admit that I don't entirely understand what's happening in the code, specifically with respect to the W(N) array, but after fiddling with some of the thresholds I managed to get everything to work and look pretty decent, so I considered it a good stopping point.

Assembly

Assembly had the usual frustrating hangups and mistakes. To first insert the Echo Dot into the enclosure, I had to trim some plastic. Most parts are held down with hot glue, and airwired as necessary, since this is only a one-off.

When I buttoned everything up, Alexa couldn't hear me. I had covered up the mic ports! I solved the problem by drilling some holes in a semicircle. I could have done better, and ended up with some extra holes in the wrong place. Please pardon the ugly.

firmware-alexa-bass-dft.ino

The ATTiny84 firmware to run everything

x-arduino - 5.42 kB - 04/08/2018 at 01:14

Download

View all 7 components

  • Putting it all together

    Bob Baddeley04/08/2018 at 03:59 0 comments

    There were a lot of struggles here.

    • The Echo Dot didn't quite fit in the enclosure. I had to remove the back to make it a little slimmer. This was ok as I was using the headphone out and the back contains the unused speaker. I also had to trim some plastic to get the circle to fit flush with the inside of the front.
    • When I closed it up at first, I discovered that the microphones were blocked entirely and Alexa couldn't hear me. I had to drill some holes, but I didn't do a great job and ended up drilling some poorly placed holes.
    • I was disappointed with the movement of the mouth, which is far too little even from off to max. I tried cutting the plastic a little to remove some of the resistance, but it still wouldn't open as wide as I wanted.
    • It took a bit of probing to find the 5V test point on the Echo from which I could draw power to supply the ATTiny and motors.
    • The firmware, and specifically the audio processing, was just a pain. It took way too long to find an algorithm that would work.
    • Similarly, I went from most difficult to least difficult option for sensing the awake-ness of the Echo. If I had started with the photoresistor I would have saved myself an evening.

    Nonetheless, It all came together, and it works. I'm having fun finding the best songs to demonstrate the awesomeness of this mashup, and I'm happy with how clean it looks and works.

  • Sensing the Audio

    Bob Baddeley04/08/2018 at 03:52 0 comments

    The mouth needed to move appropriately.  This was a minimum viable feature. It just had to look good. My initial thought was to treat the audio like a VU meter and dump that to the motor. It didn't work to just pipe the audio signal into the motor (though surprisingly you could hear the music playing through the motor). Adding an amplifier didn't make a difference. Then I thought I'd put in a capacitor to smooth out the waveform and give me more of a smooth volume level. This did not work. I looked for some analog circuits, but didn't find anything suitably simple, so I decided to go the route of everyone else; throw an Arduino on it!

    Now this actually makes sense. I already needed some logic to handle the photoresistor and waking of Alexa, so I had need for an Arduino, and this would allow me to integrate the two sensors, AND do some DSP on the audio signal. It was perfect!

    I had an ATTiny from a previous project, my LED icicles, so I decided to just use that PCB and its programming cable and skip ahead.

    One thing I REALLY wish I had was some debug output. I had nothing; no indication of what values were or what I was doing. It was all a shot in the dark, and I hoped that it my changes would work slightly better than the previous attempt.

    The first algorithm was based on sum of squares. Take a bunch of readings, square them to get absolute value, and see if they're above a threshold. This worked ok, but not great. On loud music the mouth would just be open the whole time.

    The next step was to do a FFT. I found the fix_fft library and tried that out. It was a pain to get it working, but the results never looked good enough. I couldn't get it to look any better than random for the body motion, and for the mouth I couldn't bin things appropriately so that both men and women voices worked. It was just too unreliable.

    Then I found someone else who used an ATTiny for audio processing. I used their code, tweaked it for my application, and things looked a lot better. It took quite a bit of tweaking, and I don't quite understand how it works, but I finally have something I'm happy to show off to people.

  • Sensing the wake

    Bob Baddeley04/08/2018 at 03:38 0 comments

    I wanted to have the body move when Alexa woke. This would be easiest if I used the lights on the Alexa. I tried taking it apart and attaching a MOSFET to the LED signal, but that was super tricky. First, soldering to the pad was very difficult. Second, it turned out the LEDs weren't driven relative to ground. They were multiplexed somehow and driven with special drivers, so the MOSFET wouldn't work.

    Next I tried optoisolating it and piping an LED signal to an optoisolator. That way I could isolate my MOSFET circuit from the Echo circuit. This sorta worked, but only when Alexa was booting. It turned out that the LED brightness when booting is way brighter than the LED brightness when awake, so the LED on the optoisolator wasn't being driven enough to turn on the transistor part. Grrr!

    Finally, I realized that the easiest solution was probably the best; hook up a photoresistor and tape it to the outside, then watch the visible light level. In the dark enclosure, any light  at all would be detectable, so taping the photoresistor right next to the LED worked out perfectly!

    I thought at first that I'd use this signal to drive the MOSFET for the body motors directly, but then I noticed that when playing music the lights go off but it keeps making sounds. This logic complicated things, so I decided to pipe the signal into an ATTiny to control the body motor.

  • Overview - Getting started

    Bob Baddeley03/17/2018 at 17:07 0 comments

    There are other people who have done this, but none have embedded the echo inside the enclosure. I think two reasons this might be a bad idea is that the echo microphones 1) shouldn't be vertically against the wall and 2) might be affected by the noise of the motors and being inside another enclosure.

    We found a Billy the Bass at a thrift store for just under $3. At first I considered using a Raspberry Pi instead of an Echo, but it presented other problems that I didn't want to have to deal with, such as setting it up, amplifying the audio, and just detecting when the wake word was spoken and stopped (the debug output on the commandline wasn't sufficient). So I took an Echo Dot and tried to shove it in the enclosure, and it looked like it would work. Then I hooked a power supply up to the various motors and made sure I could drive them, and I could. The project was feasible!

View all 4 project logs

Enjoy this project?

Share

Discussions

Mike Szczys wrote 04/14/2018 at 17:37 point

It's awesome that you were able to fit the Dot inside the case on this one. I'm glad you went with just a few holes in the microphone area as it keeps it looking stock and doesn't really give away Alexa's secret ;-)

Great hack Bob!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates