Piu! Voice Assisted Gamepad
by zvizvi in Circuits > Assistive Tech
1759 Views, 7 Favorites, 0 Comments
Piu! Voice Assisted Gamepad
The voice assisted gamepad is a home automation project I made for my four year old girl Gilly, who has lately taken interest in playing space invaders on my retropi setup. I basically taped a servo motor to the fire button and connected it to an Arduino which kept monitoring a microphone, and coded some basic logic to trigger the servo just enough to press the button whenever a sound is heard. As you can see in the clip, we initially tried "piu" as the trigger keyword, but later found out that it was a bit too long and triggered the servo twice, but maybe that's a boon, I don't know. Anyway I will attach the code and you can play with the threshold, timing etc. as you like.
Throughout this short tutorial I will not get into the details of how to upload code to Arduino for the first time, if this is your first arduino project, there are plenty of good guides out there, here's one:
https://learn.adafruit.com/ladyadas-learn-arduino-...
Also, if you are a first timer, I would recommend using the Arduino Uno rather then the Nano due to driver related details. In the tools & supplies section I will describe the two options
Tools & Supplies
Tools:
Utility knife
Scissors
USB Power source (charger, usb battery, laptop etc.)
Rertopie with standard game pads
(or any kind of gaming platform that has a controller with a button/pad that can be triggered vertically)
Supplies:
Option 1 (nube-friendly, Uno based):
Arduino Uno
https://he.aliexpress.com/item/1005001621969027.ht...
Sensor Shield for Uno
https://he.aliexpress.com/item/32552605782.html
Option 2:(Nano based)
Arduino Nano
https://he.aliexpress.com/item/1005001711279154.ht...
Sensor Shield for Nano
https://he.aliexpress.com/item/1005001580331597.ht...
[From now on, shared for both]
A piece of the best double sided tape you can get
my brand is unknown, its inlined with this thread grid like thingie, making it stronger structurally I guess
(I've put an image with a shred of the original logo of a rhino, I think - if you recognize it do leave a comment, it's pretty great)
Micro Servo Motor:
https://he.aliexpress.com/item/32981311781.html
(any kind will do really - still I cannot recommend metal gear enough, they are so much better then 50c cheaper plastic gear)
30cm piece of stiff, single core copper wire, 1.5-2mm thick, insulated
https://he.aliexpress.com/item/4000602576909.html
Amplified Microphone Module
https://he.aliexpress.com/item/4000587195920.html
Dupont female-female headers
https://www.aliexpress.com/item/4000203371860.html
Dupont header shells for making cable pretty pretty (optional, that is)
https://he.aliexpress.com/item/32916674681.html
and a bunch of small zip ties, also for best looks & grooming
Hooking Up the Arduino
All components eventually get connected to one another via the sensor shield. The next section will describe these connections step by step.
Start by placing the Arduino into the Sensor shield, if using a Nano, or connecting the Sensor shield atop the Arduino, if using an Uno. From this point on, there will be no difference between the two setups.
Connect the Servo cable to digital pin nine, making sure the brown wire gets attached to the G avenue.
Take 3 Dupont wires and connect them to pin A0's triplet on the sensor shield. watch the colors, because you will need to connect the microphone to the other end. schema goes:
Microphone End | Sensor Shield End
A0 S
G G
+ V
I've attached a diagram to show this more graphically.
Do take your time and pay attention to the way you connect the two(microphone -> sensor shield). Here, a wiring mistake might cause the module to fry. And by the time you smell it, it will probably be too late :(
once all hardware is connected - ah, that was easy, wasn't it? I do love the sensor shield. but I am digressing - all you need to do is upload the Arduino code, piu.ino to your board.
(not sure how to do that? I've attached a link in the intro page for a nice tutorial. but there must be gazzilions of them out there, so feel free to find one you like)
now, before proceeding: test the thing! See if the servo takes you lead...
be silent.
make some noise.
be slient.
make some noise.
Does it give you those sweet crisp swooshes whenever you make a sound?
Great! you're ready for the next stage.
Started nice but now servo constantly working?
try pressing the reset button on the Arduino board, this will cause sensor recalibration that may solve the issue.
Not working?
make sure upload completed successfully. then, double check wiring. must be the wiring. always the wiring.
Downloads
Turbocharging the Gamepad
If you got this far, you pretty much nailed it.
Use the double sided tape to attach the servo to the gamepad so that its lever/arm/horn presses the right button (ours was the yellow, for space invaders fire) at its center. you will need to fiddle with the placement of the lever onto the servo's shaft to get it right, but it should be alignable. If not, go to the code and carefully change the numbers sent to the s.write() commands.
Next, attach the Arduino / sensor shield to the back of the gamepad using the double sided tape.
Finally, use the stiff copper wire to mount the microphone to the gamepad, as demonstrated in the photos. secure the microphone to the wiring using zip ties.
Sure, one could 3d model and print a combined mount for all peripherals, one that would be much fancier than that. not me. I'm a simple guy.
Now tidy 2 usb cables coming from the Arduino and the gamepad itself - by tying them together with a colorful zip tie, of course.
That is pretty mush it. all it takes now is plugging everything in.
Hooking It All Up
Connect the gamepad to your console and the arduino to power supply.
If using a retropi like me, do not connect the Arduino to the pi as it will probably draw too much current that will make it unstable. use a charger / battery / laptop instead.
Play!
Occasionally you will need to reset the Arduino by pressing the red reset button, to prevent continuous fire presses. I'm not sure why that is, but I've seen that touching the microphone's circuitry with bare hands, other than not in particular healthy, causes the sensor readings to shift slightly. Just an FYI.
If you've built it, tell me how it was!
My daughter seems to have enjoyed it a lot, but in the end preferred to keep playing together with her older brother, he's at the helms while she's on the fire button :) I think I would have made the same choice...