Use a keyboard to launch sounds with TimeSquAir !

Step 1: Get a Wireless Keyboard

In this tutorial it's a Logitech K360

Step 2: Plug Your Keyboard on the TimeSquAir

Step 3: Go on Node-RED

On Node-RED, take the node "Serial" in the input section. Create a new Serial Port and set it as shown on the picture.

The hidraw1 is the active port on this example. It might be different in some other cases, depending on the other connected devices.

Step 4: Transform a Buffer Code Into a String

The output of the "serial" node is a buffer. You can't use it directly, you need to convert it into a string with a function. This function will return the key you've pressed.

Step 5: An Example: Launch a Sound With a Keyboard

Connect a little speaker on the TimeSquAir.

Step 6: Download Some Sounds

Here you can find minions sounds: http://fr.ringtones.mob.org/mp3/banana-63575/ ,
In this case we convert the medias into .wav (you can do it here http://audio.online-convert.com/fr/convertir-en-wav ).

I advise you to rename your sounds (like a.wav, b.wav ...) in order to simply link a key to the appropriate file (the "d" key to the d.wav file for example).

Step 7: Transfer the Sounds on the TimeSquAir

You'll need a File Transfer Protocol (FTP) like FileZilla who's using here. Open FileZilla and fulfill the parameters (Host, id, password and port). On the right panel you arrived on the root repository of the TimeSquAir. Reach back into the repository by clicking on the “double dots”. Then go in the media repository.

On the left panel go in the repository where your sounds are. Then right click on the sound and click on “send”.

Step 8: Launch the Sound From Node-RED

Add another node “function” and set it like on the first picture.

Add a node “exec” and set it like the on second picture. We use here the "aplay" command. The "Append msg.paylod" parameter needs to be checked, in order to add the full path of the sound (calculated in the previous function) after the aplay command. Activate all the nodes.

You can now use your keyboard to execute your sounds.

If the volume is too low you can add another node “exec” and write into the command section “amixer set PCM – 100%”, activate then click on “Go” (third picture).

About This Instructable




More by ArthurD27:Connect a light to the weather forecast Make a connected dice with TimeSquAir Hack a wireless keyboard into a remote sound box, thanks to TimeSquAir ! 
Add instructable to: