-
Putting it all together
04/08/2018 at 03:59 • 0 commentsThere 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
04/08/2018 at 03:52 • 0 commentsThe 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
04/08/2018 at 03:38 • 0 commentsI 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
03/17/2018 at 17:07 • 0 commentsThere 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!