Introduction: Twin Ultrasonic Guitar

About: Spreads the joy of science!

You might have already heard that coding is an extremely important “language” to learn in this day and age. Coding is not just a means of communicating with a computer but also a way of programming unique visual artworks and even Artificial Intelligence artists or writers!


In this Instructable, we will code an ultrasonic guitar using the Twin Coding Kit and craft our guitar with our wonderful DIY skills. It’s easy to make since I used common materials that can be found in every home. Let’s start creating!

Supplies

Electronics

(Twin Coding Kit includes everything except the power bank.)

Additional Materials

Tools

Step 1: Make the Guitar

  • I drew a guitar outline on a cardboard. (I used my dream guitar Gibson Les Paul as an inspiration)
  • I cut the outlines of the guitar with a utility knife.

Step 2: Ultrasonic Barrier

  • First, I made a 3 inch high barrier.
  • Next, I made a paper band and tied it to the neck. I made a paper ring that my fingers could fit into.
  • I attached them with a stapler and a glue stick. My favorite tool is a stapler for cardboard projects.

And my guitar structure is ready. Let’s Code.

Step 3: Electronics Connection

Twin Modules have a magnetic connection between them.


  1. I connected a Buzzer Module on the D6 output pin.
  2. I attached the Buzzer to the Coding Module with a 3x2 LEGO ® block. All Twin Modules are compatible with LEGO® and if I want to make something static, I can reinforce the connection with a LEGO® block.
  3. I inserted the Ultrasonic Sensor’s male headers to the Codding Module’s female headers.
  4. I connected a power bank with a micro-USB cable to power the module and system.
  5. I made four holes to fasten the Twin Coding Module to the guitar with zip ties. I added a hole for the USB cable to hide the power bank on the back of the guitar.
  6. Fasten the Twin Coding Module to the guitar with zip ties.

Step 4: Let’s Code an Ultrasonic Guitar

  • I used the Twinner Mobile application to code this project. It is an easy-to-use block coding mobile app for the Twin Coding Module. Also, you can code your Twin Module with Twin Code Lab on a desktop with any browser (we recommend Google Chrome).
  • For a project like this, which outputs different things for different values of the same input, the conditional control statement Switch Case is the most convenient choice. However, there aren’t any switch-case tool in block code platforms. That is why I used an If-Else structure for coding this project.
  • I want the program to work until I turn off the Twin Coding Module. To do this, I use a “While-True” loop, which is equal to an endless loop. The “while loop” is in the Loop Tab (pink), “True” block is in the Logic Tab (Blue).
  • I added an If-Else structure into an endless loop. I used 7 “else-if cases” and 1 “else case” to code the tones. We should use a logical operation for separate notes depending on the ultrasonic sensor outputs. I measured 2 cm of space between every note. An example for "re note" I added an "and" block and connected "bigger than" and "smaller than or equal" logical blocks to it. Also, I added an ultrasonic measurement detection block and a number math block into them.
  • I added note blocks from Light and Sound blocks (orange). I added LED coloring code in every case to control the accuracy of the code.

Step 5: Adding Frets

  • I drew the lines with 2 cm of space between them.
  • I started the program and controlled and fixed some lines.

Step 6: Let's Play

Our guitar is done! Let’s move the barrier and hear the notes!