Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Adding speech, clock, motion to M4 Python project
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adding speech, clock, motion to M4 Python project

by pcmofo on Tue May 26, 2020 5:27 pm

Hi, I am building an animated head of everyones favorite robot Bender. So far my prototype uses 4x 16x8 LED matrix displays for the eyes and the M4 Feather as the brains. I wrote some Python to load animations for the eyes with varying delays between frames. It's starting to looks pretty good. I'd like to add the following features to my project so that I can sync them with the eye animation.

1) Audio clips of speech, "oh yeah do the Bender"
2) Pulsing lights tied to the speech output for the mouth. eg the mouth would be fabric with LEDs behind it that PWM dim or brighten based on audio being played
3) RTC module to get the current time
4) Simple motion/distance sensor to trigger events
5) Power considerations for this

1) I was looking at https://www.adafruit.com/product/2217
2) This seems like a simple transistor tied to the speech board and a series of LEDs? Is there some kind of PWM output on this board?
3) Which board would work best for this project, it will be AC powered always. https://www.adafruit.com/product/3028 ?
4) Would something like this work? https://www.adafruit.com/product/1031 I only need a simple sensor like a cheap halloween display might have. eg is someone standing within 1 foot of me? I would also prefer if it could work through a piece of transparent acrylic
5) Currently the M4 can power all 4 16x8 LED matrixes via 3.3v with a standard 500ma USB input on the M4. If I start adding in the speech board, RTC, LEDs etc I will most likely need a common power source. It is recommended to power the M4 from USB and it looks like the soundboard can also be powered from USB.

Any advice or suggestions would be helpful, Thanks!
Image

pcmofo
 
Posts: 21
Joined: Wed Sep 09, 2009 4:57 pm

Re: Adding speech, clock, motion to M4 Python project

by pcmofo on Mon Jun 01, 2020 10:08 am

I wrote more code to handle displaying expressions, animations, time, numbers etc.
Code repo is here https://github.com/brett-martin/BenderBot

Demo of what I have done so far
https://imgur.com/Ylm815h

Still looking for advice for speech, power, time, and motion sensing, thanks!

pcmofo
 
Posts: 21
Joined: Wed Sep 09, 2009 4:57 pm

Re: Adding speech, clock, motion to M4 Python project

by pcmofo on Thu Jun 04, 2020 7:55 am

Here is a list of parts I am using http://www.adafruit.com/wishlists/506269
I just ordered the Adafruit DS3231 Precision RTC Breakout and the Adafruit Audio FX Sound Board + 2x2W Amp boards from DigiKey as they were sold out in the store.

For the distance/motion sensor I was looking at this one. https://www.adafruit.com/product/3595 but it was sold out in both stores.

I added a piece of smoked acrylic over the displays which makes them look a lot more cohesive.

I created a simple circuit with a transistor and large capacitor so that when a pin goes high it fills the cap and lights several LEDs instantly, when it goes low they slowly fade out. Cycling this rapidly and randomly gives a cool effect to use for the mouth when speaking. I need to wire this to the Audio FX board somehow still.

For the Audio FX board, I need to connect that to the Feather M4 via serial so I can send it commands to adjust the volume and play a specific file without tying up many IO pins.

The RTC uses i2c so it should be strait forward to configure it with the correct time and pull correct time.

I'm also working on a schematic so that everything can be on a custom sized PCB that fits in the visor and can drop into place

I'm still looking for help with the following,

1) triggering LEDs based on Audio output from the sound FX board, eg voltage goes above x volts, light turns on, voltage goes below x light turns off
2) Multi-threading/ concurrent tasks. I need to sync audio with lights/animations, I think I can manually guess at the timing and because they are on separate boards it will work. For other things like User input via buttons, distance sensor etc I'm not sure there is an interrupt in CircuitPython.
3) Still not sure on the PSU, currently able to power everything but RTC and Audio FX boards are yet to be added. Considering using a 12v->5v switching regulator with 2x micro USB connectors attached to power the M4 and AudioFX boards so that you MUST unplug them from power to reprogram via USB.
4) I'm not sure that the above motion sensor will work for me. I have two locations I could mount sensors, Behind the smoked 1/8" acrylic and behind a fabric mouth area. I'm not sure that a sonar or reflected IR sensor will work correctly in either area.

pcmofo
 
Posts: 21
Joined: Wed Sep 09, 2009 4:57 pm

Re: Adding speech, clock, motion to M4 Python project

by hierophect on Fri Jun 05, 2020 2:30 pm

I would suggest the OpenMV (https://openmv.io/) for sensing faces, if you want to do direct eye tracking. The Circuitpython version of it doesn't do a lot (yet), but it works great with Micropython and has a built in Haar Cascade for face recognition. You could simply route data from it over to a Circuitpython board with UART or something. Audio I think is generally harder - you might need an SBC for that.

I've been working on a similar expressive eyes program - it's in C, not in Python, but you could check out the approach and see if anything interests you. I'd like to make a port for it in Circuitpython for the LED Matrixes so this is really neat to see. https://github.com/hierophect/ExpressionEngine

hierophect
 
Posts: 11
Joined: Fri Jul 13, 2018 10:24 pm

Re: Adding speech, clock, motion to M4 Python project

by adafruit_support_bill on Fri Jun 05, 2020 2:51 pm

Ultrasonic sensors will work behind fabric as long as it is fairly acoustically transparent (e.g. speaker cloth). They will not work behind acrylic
IR sensors will not work behind the fabric. They usually work behind acrylic, though can sometimes be confused by reflections.

adafruit_support_bill
 
Posts: 78733
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.