Recently, capacitive touch HATs designed specifically for Raspberry Pi have become available that make it much easier to create an interactive sound box with the Raspberry Pi. One of the challenges of putting together TalkBoxes was to connect all the wires from the MPR121 breakout board to the Raspberry Pi. In the past, we connected an MPR121 Capacitive touch sensor to a Raspberry Pi to create TalkBox, a DIY communication board for non-verbal users. Some examples of how to do this easily is using a Makey Makey board or a Bare Conductive touch board. Using Pi to create an interactive sound boxĪ really fun activity is playing music using fruit and other conductive things (even humans)! You can do this by connecting the fruit to a computer using a touch sensor that in effect treats them as a key on the keyboard, making it possible to activate sounds when they are touched. See my previous post or the official Raspberry Pi website on how to setup your Pi. This post assumes that you have a Raspberry Pi B+ setup and connected (either to a monitor or running in headless mode). In this post, I will describe my experience using Raspberry Pi with a touch sensor to create an interactive sound box. You have to make sure that your script has execution privileges (set them with chmod) and you are set! In this file, you specify your icon, path, …: Depending on your needs you might or might not need to call from a terminal.Ī final bonus tip (thanks to the information here)! If you would like to make a desktop shortcut with an icon that you can double click to start your program, you need to create a file in the Desktop directory: The last command specifies that I want my script to be called from a terminal. So it will look something like this: -profile -desktop -profile -e /home/pi/Foad/myProgramLaunch.sh In this file you have to add your particular program path to the end of the list. In Raspbian Jessie, you want to change the autostart file in the. There are many forum posts about where and how to change files to make this happen but it is important that you locate and change the right file for your particular setup. If you want your script to run at the beginning (with no graphical support), please see my previous post here. I particularly wanted the program to run once the GUI is loaded. The next interesting challenge was to run my custom python code (or the shell script running it) on startup. In case your RPi Zero cannot use the display, comment out the added lines above and also copy the nf file form the HDMI folder to the X11 folder and everything should work on startup. Note: This might cause a problem if you plan to use a Raspberry Pi Zero. Sudo cp /home/pi/displays/TFT/nf /etc/X11/ Sudo cp /home/pi.displays/HDMI/nf /etc/X11/ Then add these lines to the script: if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI) then The solution I came up with involves modifying (or creating if it doesn’t exist) the rc.local file in the /etc/ folder: cd etc One thing to note is to the best of my knowledge, you can’t run the GUI simultaneously on the touch screen and the HDMI TV because the system can’t handle input from two sources. If an HDMI cable was not detected then I wanted the GUI to run on the touchscreen. In any case, the first issue I had to figure out was how to automatically detect if the Pi was connected to the HDMI screen and then run the GUI from there. For implementing my particular GUI (which I will discuss in a future post) I used pygame to interact both with the touch screen and the GPIO pins. I will have more application focused posts in the future (once I actually figure out the rest of my issues!).įor my implementation, I am using a Raspbian Jessie installation. Please note that this is a fairly technical post that is aimed to help others who are running into similar challenges. So for my particular setup, where I wanted to use a large HDMI screen to write my program and then use the Touch Screen to test it, I needed to figure out a bunch of things that I will explain in this post.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |