Lego Guitar

A musical instrument for Lego Mindstorms EV3.

You can play simple songs like Jingle Bells, Smoke on the Water, and a Blues bass line with it. Demonstrated in the following video.

The guitar is built using only Lego parts. You need a Lego EV3 Ultrasonic distance sensor (part id 95652) and a Lego Mindstorms EV3 Brick (part id 95646c01).

Download parts list:
BrickLink wanted list XML file
CSV file

Download EV3 programs:

Download other stuff (guitar 3D model, Guitar Pro tabs, sound sample pack)


Building instructions are found at the end of the demo video.


Sound comes from the bottom of the guitar where EV3 internal speaker is located.

When you press a button, the speaker will play a sound. The buttons are programmed differently for each EV3 program. Here are the button assignments:

  • solo guitar – all five buttons represent five strings of a guitar. C-tuning: C-F-A#-D#-G
  • rock guitar – buttons 2 and 3 play power chords. E-tuning: E-A
  • bass guitar – buttons 2, 3, 4, 5 play strings. E-tuning: E-A-D-G

Slider behavior also differs between the programs:

  • solo guitar – notes will change when you move slider while pressing button. This makes it possible to do hammer-ons and pull-offs.
  • rock guitar – notes won’t change while you move slider. Makes it possible to play faster when you pre-move to the next fret.
  • bass guitar – notes won’t change while you move slider. Also, notes keep playing after you release button. That makes the bass lines sound continuous. You can mute the sound with button 1.

The fretboard contains 12 colored markings. Each mark represents a semitone. 12 semitones makes the fretboard span over one octave. The frets are numbered 0-11 as in real guitars, where fret 0 is an open string and frets 3, 5 and 7 are highlighted.

The Lego guitar is quite reliable, but you cannot play fast melodies with it. It will produce a wrong note if you move the slider too quickly and press a button. For example the walking blues bass line (demo video) is very close to being too fast. It required several attempts from me to play it without errors.

To upload EV3 programs to the guitar, you can use USB, Bluetooth or Wi-Fi. More information in this manual, page 18. You also need a software called LEGO Mindstorms EV3 Home Edition. With that software you can upload programs to the EV3 Brick, and also edit the programs to change tuning or whatever.

The rock and bass guitar programs use sound samples. The samples are inside the EV3 programs, ready to go. In case you need the samples for your own projects, you can download the wav files in a zip packet here. The origin of the samples is from two sources. The rock guitar samples were taken from NXTPrograms Lego guitar, only edited to sustain longer. The bass guitar samples were generated with FL Studio using a free plugin called Strat-A-Various, with preset Bass guitar.

Building considerations

If you cannot get a Lego EV3 Ultrasonic sensor 95652, consider these options.

  • Lego NXT Ultrasonic sensor 53792. The accuracy seems to be a little bit worse than the EV3 version (based on this study) but not much. I haven’t tested it. It should be compatible with the EV3 control unit. Here is an example guitar that uses the NXT sensor.
  • Lego EV3 Infrared distance sensor 95654. It is cheaper and readily available, but very inaccurate. You get maybe only 6 frets on the fretboard. Here is an example Infrared Lego guitar.
  • Lego SPIKE Prime distance sensor 37316c01. This one is an ultrasonic sensor, probably as good as the EV3 version. I haven’t tested it. You need a SPIKE Prime hub to use it, and different programs.
  • TOF laser distance sensor for EV3, link here. I tested this one. The accuracy is very good, but it is very slow. It waits about 0.3 sec to get a measurement. You can play only very slow melodies with it. Internally it uses VL53L0X that should be able to go as low as 8 ms timing budget, so perhaps you can hack it somehow to increase speed.

For the cable there are several options. For example, you can use a 20 cm NXT cable 55804. Or you can order a more thin and flexible cable from

The sliding plate size and position are important. The plate is carefully chosen to be a Lego Plate 4×6 3032. Larger plate will make the ultrasonic sensor lose accuracy in close distance and smaller plate makes it lose accuracy in large distance. The position of the plate is in the middle of the fretboard, while the ultrasonic sensor is 0.5 studs offside. If you make any changes to the guitar, you may need to change the sliding plate.

Remember to choose a Tile 2×4 with decoration of your liking. I used a Harley-Davidson Logo 87079pb0650L.

Rock on!

5 thoughts on “Lego Guitar

  1. Pingback: Lego Guitar (3 simple songs demonstrated) - Brickhubs

  2. Pingback: 1% Lego Guitar Skills 99% Editing Skills - Brickhubs

  3. Pingback: 현은 없지만…레고로 만든 일렉트릭 기타 - 테크레시피

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s