when you hit the piñata, trump says something stupid. So you hit him again. This continues...
a nodeMcu sent data to data.sparkfun.com where it's graphed on their partner site analog.io.. http://analog.io/sADI
Portable Network Graphics (PNG) - 164.86 kB - 09/26/2016 at 05:33
Adafruit's 200G accelerometer (ADXL377) can measure hits up to 200g's. I'm totaling the analog inputs from x, y, and z. You supply 3volts from the teens to the VIN pin on the accelerometer.
JPEG Image - 2.45 MB - 09/26/2016 at 05:23
the teensy audio shield accepts an SD card with stereo, cd quality, 44khz, 16bit audio files.
JPEG Image - 1.97 MB - 09/26/2016 at 05:23
JPEG Image - 1.68 MB - 09/26/2016 at 05:23
JPEG Image - 2.15 MB - 09/26/2016 at 05:23
1st Grab yourself a Pinata. It seems every mexican pinata shop carries trump pinatas right now.
2nd: Assemble your hardware... see components section above.
The teensy continuously reads the accelerometer and trigger audio output random WAV files on the SD card. The nodeMcu posts the 'hits' on the pinata to data.sparkfun.com and graphs it at http://analog.io/sADI
**I started this project with the PJRC's prop_shield. It fits on the teensy uController. The prop shield is great for broadcasting in a small quite place through a small speaker. During the party we opted to run a 1/8" jack from the teensy audio shield to an amplifier to make it terribly loud.... If you go that route, you don't need the prop_shield... It's kind of fun to cut a hole in trump though..
Solder your components....
Use the longest headers you can find or an assortment of male headers and female headers (safer/easier for troubleshooting) to sandwich the teensy between the prop_shield and the audio shield....
Above is shown the prop shield on the bottom of a teensy uController.
Above is shown the Audio shield on top of the teensy.
Above is essentially the same thing accept with female and male headers. The advantage to this setup is you can easily take it apart for troubleshooting. The disadvantage is it is quite a bit more bulky but you'll have plenty of space in the pinata.
Finally the accelerometer needs to be soldered or connected to the uController analog inputs. I used three analog inputs for a big 200G accelerometer. If you are not interested in measuring exact magnitude of 'hits' you may use a cheaper accelerometer and read it over i2C or something similar.
Although it's hard to tell in this picture, I connected the accelerometer as follows:
teensy => accelerometer
3.3 pad to Vin (accelerometer)
gnd pad to gnd
A15 pad to zAxis accelerometer
A16 pad to yAxis
A17 pad to zAxis
To connect the nodeMcu, simply connect the teensy Serial1 TX1 (pin 1) to the RX pin on the nodeMcu. You also need to connect ground and may also want to share power by matching the Vin pins or 3.3 pin (don't mix them!)...
There are three files on github trump-pinata: https://github.com/hydronics2/trump-pinata
The teensy.ino code needs to be uploaded onto a teensy using teensyduino, ad add onto the Arduino IDE. It's here https://www.pjrc.com/teensy/teensyduino.html
The ESP file is for the nodeMcu. There's a separate github repo that describes how to move data from an arduino/teensy uController to an ESP. It's here: https://github.com/hydronics2/esp8266-serial-receive-and-send
The 3rd file is a handy simple wav player for teensy to test your files and settings.