Introduction: PI Powered Busy Board
When the the little one has all the toys in world but insists in playing with thing that they shouldn't be playing with just make a busy board.
All the things on this board are mostly things that the family and I had laying around except the Raspberry Pi 3, the Adafruit Capacitive Touch HAT, and the conductive paint.
What it does
It has things that spin turn and flick but using the capacitive touch you can customize the sounds it can make by uploading .wav files to the Pi and directing the script to use the files. So when the any part of the stencil or drawing is touched it makes a sound.
Step 1: Supplies and Setup
Supplies
- Raspberry Pi 3 (I tried to set this up on a Raspberry zero but had issues with outputting Python audio over a USB sound card)
- Knobs / mirrors / door stoppers / buttons / fans / ect... Just make sure its not sharp or can harm your little one
- Bare Conductive Paint or Pen
- Paint brush
- Single strand solid wire
- Adafruit Capacitive Touch HAT for Raspberry Pi - Mini Kit - MPR121
- Wood boards I used Medium Density Fiberboard 1/4 in. x 2 ft. x 4 ft for the front and back and extra 1/2x1/2 wood scraps to make spacing between them.
- short wood screws
- Copper plated nails
- wood glue
- Tape
- Stencils because I am not much of a painter.
- USB rechargable battery and usb powered speaker
Tools
- Drill
- Hammer
- Saw
Assembling the front
- Cut your board in half to get 2 equal 2 foot boards and cut your 1/2 in boards to place between the front and back boards
- Lay out your board to get an estimate of placement leaving enough room around the outer edge for the 1/2 inch spacers
- Using the wood glue and a couple wood screws to mount the front board and 1/2 inch wood around the outer edge clamp it down and let dry.
- Mount your Items to the board just to make sure that its not going to protrude through the back board and not so short that it can be torn off.
- lay out stencils, use tape to help keep them on there and prevent paint from going where you don't want it.
- After letting it dry. Remove stencils then make sure to touch it up and connect spaces between them with a line . This is done to let the whole image become compacitive instead just a small part.
- Take your copper plated nails and lightly tape them into spots of each image giving you a connection from the front of the board to the back end of the front.
Step 2: Raspberry Pi Setup
Enable I2C:
- sudo apt-get install -y python-smbus
- sudo apt-get install -y i2c-tools
Go to raspi-config by:
- sudo raspi-config
Go to Advanced Options
than I2c
and Enable by selecting Yes
now go to
- sudo nano /boot/config.txt
scroll to the bottom and add
- dtparam=i2c1=on
- dtparam=i2c_arm=on
now reboot by entering:
- sudo reboot
The code is going to be done in python, so we need to install everything necessary so that python can use the I2C port, we do not really need to know how to connect the I2C to the chips, this is what saves us the Adafruit hat.
We execute the following commands in the console:
- Sudo apt-get update
- Sudo apt-get install build-essential python-dev python-smbus python-pip git
You will see something like this:
After this operation, 25.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
- Y
- cd ~
- git clone https://github.com/tejonbiker/Adafruit_Python_MPR1...
- cd Adafruit_Python_MPR121
- Adafruit_Python_MPR121
sudo python setup.py install
Sudo reboot
Now to see if the sensor is working by navigating to:
- cd Adafruit_python_MP121
- cd examples
and run this example python program:
- sudo python simpletest.py
You will know touch the sensors on the hat and see something like:
- 1 touched!
- 1 released!
- 2 touched!
- 2 released!
Now that we see that we are on the right track and can now end the program with Ctrl+z
If my instructions are a little vague here are some links that will help from Adafruit.
Step 3: Set Up to Output Audio Files
- Start by navigating to:
- cd Adafruit_python_MP121
- cd examples
- We are going to have to edit this file because the audio files are now .flac and not wave files anymore.
- Sudo nano playtest.py
Scroll down till you see
Sound_mapping = {
- Delete 0: through 11: and paste
0: '/usr/share/scratch/Media/Sounds/Animal/Bird.wav',
1: '/usr/share/scratch/Media/Sounds/Animal/Cricket.wav',
2: '/usr/share/scratch/Media/Sounds/Animal/Dog1.wav',
3: '/usr/share/scratch/Media/Sounds/Animal/Dog2.wav',
4: '/usr/share/scratch/Media/Sounds/Animal/Duck.wav',
5: '/usr/share/scratch/Media/Sounds/Animal/Goose.wav',
6: '/usr/share/scratch/Media/Sounds/Animal/Horse.wav',
7: '/usr/share/scratch/Media/Sounds/Animal/Kitten.wav',
8: '/usr/share/scratch/Media/Sounds/Animal/Meow.wav',
9: '/usr/share/scratch/Media/Sounds/Animal/Owl.wav',
10: '/usr/share/scratch/Media/Sounds/Animal/Rooster.wav',
11: '/usr/share/scratch/Media/Sounds/Animal/WolfHowl.wav',
- The files I am using are on the install of the Noobs linux and are used testing they can be replaced later to different .wav files
Auto start at boot
- sudo crontab -e
- sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
@ reboot python /home/pi/Adafruit_python_MP121/examples/playtest.py &
Reboot and test
Step 4: Wiring
- Now that the front is done we need to run wire to the protruding copper plated nails.
- I soldered my wire to the nails but curling it around the nail and gluing can work also
- On the back of the board I drilled a hole and ran the wire through it.
- Connect that wire to the Adafruit Capacitive Touch HAT that is connected to my Raspberry pi 3
- hook the usb battery to Pi and AUX cable to speaker.