Thymio Musical Instrument

Activity:

By connecting the front distance sensors and the sound, one can make a little musical instrument like this:

music-thymio-image-700

There can be five notes, or more if one uses the rear or lateral sensors or the tilt of the robot to choose a range of notes. The major limitation comes from the fact that only 10 sounds can be stored on the SD card.

This is a video of what that gives:

How to:

  1. Simplest way is to program Thymio as shown in the Aseba VPL program
  2. Here is the VPL code to download: https://drive.google.com/open?id=0B3Y9J_7JFb2kal8ta3d1U1dmMlU
    1. To use, open Aseba Studio first and find and open the downloaded code.
  3. Or you can copy and paste the code used in the video into Aseba Studio:
onevent prox
  if acc[1]>0 then
    if prox.horizontal[0]>4000 then
      call sound.play(1)
      call leds.top(32, 32, 32)
    end
    if prox.horizontal[1]>4000 then
      call sound.play(2)
      call leds.top(32, 0, 0)
    end
    if prox.horizontal[2]>4000 then
      call sound.play(3)
      call leds.top(0, 32, 0)
    end
    if prox.horizontal[3]>4000 then
      call sound.play(4)
      call leds.top(0, 0, 32)
    end
  else
    if prox.horizontal[0]>4000 then
      call sound.play(6)
      call leds.top(32, 32, 32)
    end
    if prox.horizontal[1]>4000 then
      call sound.play(7)
      call leds.top(32, 0, 0)
    end
    if prox.horizontal[2]>4000 then
      call sound.play(8)
      call leds.top(0, 32, 0)
    end
    if prox.horizontal[3]>4000 then
      call sound.play(9)
      call leds.top(0, 0, 32)
    end

  end

In order for this to work an SD card is needed containing the sound files. You can download the files here.

This idea can be developed or used in different ways:

  • How to get the 5th sensor to play a sound
  • How to make it more interactive? (colours, other sounds, interaction)
  • How to optimise the code? (a loop instead of the list of if)
  • Construct an instrument around the Thymio II? With several Thymio II?

Project credit: Thymio.org