Skip to main content

1.0

Major VersionM

by Pete Prodoehl

Introduction

Using our Bit Board with a micro:bit you can build an automated xylophone that can play songs by activating a servo with a mallet mounted onto it.

Video Overview

Featured Document

  1. You'll need a xylophone for this project. We found a toy xylophone that was small enough to ensure our servo could swing the mallet into position above each bar. To test the angle and reach we loaded a photo of the xylophone and mallet into our image editing software and rotated the mallet to check things out. (You could also print it and cut it out from paper to test things.)
    • You'll need a xylophone for this project. We found a toy xylophone that was small enough to ensure our servo could swing the mallet into position above each bar.

    • To test the angle and reach we loaded a photo of the xylophone and mallet into our image editing software and rotated the mallet to check things out. (You could also print it and cut it out from paper to test things.)

  2. To get our mallet to swing left and right as well as up and down, we'll be putting one servo on top of another. Since we're using LEGO compatible servos the easiest way to mount them is with... LEGO! Here are the LEGO parts we used to hold our arm servo down to a LEGO baseplate:
  3. Once we get our arm servo mounted to our LEGO baseplate we'll need to attach our mallet servo onto it. To attach our mallet servo onto our arm servo  we use three more parts: 1 x LEGO Beam Bent 53 Degrees, 4 and 6 Holes (6629 / 42149)
  4. We attached our mallet to a small LEGO beam with some tape. We found this worked well because it wasn't too rigid, and allowed the mallet mechanism to flex a bit when it hits the bars. If you're connection is too rigid and you don't calibrate your mallet servo properly it may stress the servo by overworking it. We've also compensated for this with a somewhat "loose" connection point between the two servos.
    • We attached our mallet to a small LEGO beam with some tape. We found this worked well because it wasn't too rigid, and allowed the mallet mechanism to flex a bit when it hits the bars.

    • If you're connection is too rigid and you don't calibrate your mallet servo properly it may stress the servo by overworking it. We've also compensated for this with a somewhat "loose" connection point between the two servos.

    • Once you've got the mallet and beam put together you can attach the mechanism to the arm servo.

  5. After you get your Bit Board onto a LEGO baseplate you can use 1/8" Maker Tape to layout the connections to the buttons. We're going to add 8 pushbuttons to our circuit, each of which will trigger the mallet to strike a different note. We will also add an additional button to Pin 15 which will allow us to play our secret song at the push of a button.
    • After you get your Bit Board onto a LEGO baseplate you can use 1/8" Maker Tape to layout the connections to the buttons.

    • We're going to add 8 pushbuttons to our circuit, each of which will trigger the mallet to strike a different note.

    • We will also add an additional button to Pin 15 which will allow us to play our secret song at the push of a button.

  6. The servos have three wires connected to them that terminate in a black connector plug. This connector is what we will plug into the Bit Board header pins. Connect the arm servo to Pin 14 on the Bit Board, then connect the mallet servo to Pin 13 on the Bit Board. Make sure the brown wire of the servo connector is plugged into the - (negative) row and the red wire of the servo is plugged into the + (positive) row. The orange wire will be closest to the 14 or 13 numbering on the board.
    • The servos have three wires connected to them that terminate in a black connector plug. This connector is what we will plug into the Bit Board header pins.

    • Connect the arm servo to Pin 14 on the Bit Board, then connect the mallet servo to Pin 13 on the Bit Board.

    • Make sure the brown wire of the servo connector is plugged into the - (negative) row and the red wire of the servo is plugged into the + (positive) row. The orange wire will be closest to the 14 or 13 numbering on the board.

  7. Connect a USB cable to the micro:bit and then plug it into your computer. We'll be using makecode.microbit.org to program our board. It uses a simple drag and drop block interface.
    • Connect a USB cable to the micro:bit and then plug it into your computer.

    • We'll be using makecode.microbit.org to program our board. It uses a simple drag and drop block interface.

    • We're going to load the following code for our Xylophone program: https://makecode.microbit.org/_LxxCDwUyC...

    • While you do the servo calibration in the following steps you'll need to have a battery pack plugged in so the servos have power to move.

    • Keep the USB cabled plugged in as well so you can easily upload new code to the micro:bit as you do the calibration.

  8. Once you have the code loaded you can start testing things to determine what angles you'll need to set for the mallet to do its job. You will need to determine the up and down angles of the mallet for the mallet servo, and the angles left and right that are needed to position the mallet over each bar. You will need to determine the up and down angles of the mallet for the mallet servo, and the angles left and right that are needed to position the mallet over each bar.
    • Once you have the code loaded you can start testing things to determine what angles you'll need to set for the mallet to do its job.

    • You will need to determine the up and down angles of the mallet for the mallet servo, and the angles left and right that are needed to position the mallet over each bar.

  9. Once you've got your xylophone circuit built, all the LEGO pieces, and your code is loaded... try it out! We taped out xylophone down to the LEGO baseplate once we found the optimal position for it. If things don't quite work, you may have to adjust some of the numbers in the code.
    • Once you've got your xylophone circuit built, all the LEGO pieces, and your code is loaded... try it out!

    • We taped out xylophone down to the LEGO baseplate once we found the optimal position for it.

    • If things don't quite work, you may have to adjust some of the numbers in the code.

  10. We've got a special function in our code called songFunkyTown which will play the notes to the popular 1980's hit by Lipps Inc. when you press the button connected to Pin 15. You can add more functions to your code and then change it so Pin 15 triggers the song you want. (Or add more buttons to have a larger song selection.) You can add more functions to your code and then change it so Pin 15 triggers the song you want. (Or add more buttons to have a larger song selection.)
    • We've got a special function in our code called songFunkyTown which will play the notes to the popular 1980's hit by Lipps Inc. when you press the button connected to Pin 15.

    • You can add more functions to your code and then change it so Pin 15 triggers the song you want. (Or add more buttons to have a larger song selection.)

Finish Line

Attached Documents

Pete Prodoehl

Member since: 03/04/2020

1 Reputation

58 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 1

Past 7 Days: 5

Past 30 Days: 40

All Time: 40