Wednesday, 19 April 2017
Are practical jokes your forte ? Then this will be right up your street and can be built for around £20 of which probably be a lot less as you will no doubt have these bits already lying around.
So lets get started this is what you need:
Usb powerbank to power it.
After following the instructions on Pimoroni the makers of speakerphat and the installation of the phat to the pi you will need to do a few things. First is to log on to wifi, there is enough tutorials should you need to ask how to do that. Next is to search for "annoying .wav" you should find quite a few sites and from here download the files. I found that renaming the files to something shorter like buzz.wav or scream.wav will make things easier later on.
Next open a command line and go to raspi-config and enable ssh. It will also be a good time to change any default password so no one else can ssh into your pi.
Once done shutdown the pi, attach battery pack to pi and hide somewhere like under the bed or even back of a cupboard.
Now fire up another pi or computer and start up terminal.
Here we can use nmap to search for all connected devices on our network and get the ip address of the annoying pi or if before you shutdown the pi you do an ifconfig and write down the ip address on the wlan0 line.
Next we need to ssh in and the command will be like this:
sudo ssh email@example.com
Pi will be the user name and 192.168.1.5 (will be whatever your device has allocated to it) the ip address.
Next it will ask for password and if correct will go on to ask you further questions of which just reply yes.
Now we are logged in to the pi we can have some fun. Start by logging into the folder the .Wav files are stored in and most likely be Downloads with cd Downloads command. Here with the ls command we can see all the files. Next is to launch the files, you could write a random playing script with python but i dont think you will get the element of surprise to what we want.
The next task is to start the sounds, this will be done with the following command with my scream.wav file.
Sudo aplay scream.wav
Now if all has gone well you should be hearing the file being played. When you have done this with a few files you will be able to choose the files quicker at the command line by pressing the up arrow to go through previous commands and choose the file if previously played quicker.
Have fun and feel free to post any extra tips below.