Self-playing Ukulele Robot Using Arduino

by zeroshot in Circuits > Robots

34478 Views, 162 Favorites, 0 Comments

Self-playing Ukulele Robot Using Arduino

IMG_7398.JPEG
IMG_7457.jpg
IMG_7427.JPEG

In this project, I design and build a self-playing ukulele robot that can autonomously play music!

Supplies

shield.jpg

Based on the Arduino Uno microcontroller!

Disclaimer - Supplies list may include affiliate/paid links.

Parts

  1. Ukulele (any cheap model will do) Amazon
  2. Arduino Uno Amazon
  3. L293D Motor Driver Shield Amazon
  4. 8× 12V Solenoid Amazon
  5. Nema 17 stepper Amazon
  6. TMC2208 stepper driver Amazon
  7. Mini breadboard Amazon
  8. 150mm MGN9B linear rail w/ block Amazon
  9. GT2 6mm timing belt Amazon
  10. Pulley and idler Amazon
  11. Micro servo Amazon
  12. 12V 10A power supply Amazon
  13. Solid core wire (22 AWG) Amazon
  14. M3 nuts and bolts Amazon

Tools

  1. 3D Printer
  2. Soldering Iron
  3. Screwdriver
  4. Multimeter

Watch the Video!

I built a robot ukulele (it plays itself)

If you want to see the robot in action playing some songs and a bit more of the design/build process check out the video.

3D Printing

The first step is to 3D print the required parts. I would recommend first printing shell_bottom.stl and shell_top.stl as they serve as the base that the following mounting components connect to:

  1. rail_mount.stl (×2)
  2. idler_holder.stl
  3. stepper_mount.stl

Then the parts for the picking mechanism can be printed (servo_mount.stl, pick.stl).

The other side of the robot is based around solenoid_cage.stl. This is attached to the ukulele via 2× neck_mount.stl. Then you will need 4× plunger_center.stl and 4× plunger_side.stl, but this may change depending on the number of solenoids used and their layout.


3D Printing 2

print.jpg
rail mount.jpg
top half.jpg

Important thing to note while printing the parts:

⚠️ Most soprano ukuleles should have a similar enough design for the shell pieces to fit correctly but this may not always be the case, so these parts may need to be modified slightly to fit your instrument.

Top Half Assembly

rail mount 2.jpg
rail mount 3.jpg
stepper mount.jpg

Start by placing the linear rail mount on the top half and secure it with M3 screws. The underside of the shell has a slot designed to allow the M3 nuts to be tightened.

Repeat this process to attach the stepper mount on the side, and then slide the stepper into position facing upwards.

Bottom Half Assembly

mounts.jpg
arduino location.jpg
bases.jpg

For the bottom half, begin by installing the idler holder, followed by another rail mount. Next, attach the Arduino with the motor shield to the side.

The finished result should be similar to the pictures shown above.

Mounting the Rail

placing rail.jpg
servo mount.jpg
belt.jpg

Now the linear rail can be put into place across the body of the ukulele. Once it's in the correct position, the rail mounts should be tightened all the way.

Next, take the 3D-printed servo mount and connect it to the timing belt. The servo mount has specific slots for securing the belt, so it should easily push into place.

Double check that the sliding block moves freely up and down the linear rail, and then screw the servo mount onto it, making sure that it's in the correct orientation.

Belt and Pulley System

pulley.jpg
belt attached.jpg

Place the idler pulley onto its mount, then loop the belt around it and the stepper shaft. Cut the belt to the appropriate length and insert it into the other slot on the stepper mount. This will allow the stepper to move the sliding block up and down.

Electronics 1

driver.jpg
current limit.jpg
solder.jpg

Place the mini breadboard next to the stepper motor and insert the TMC2208 stepper driver in the center. Now, to limit the current supplied to the stepper motor, we need to set the voltage reference on the driver module.

  1. First, connect the driver to a 12V power source.
  2. Turn on the power and set your multimeter to measure DC voltage.
  3. Place the black probe on the GND pin and the red probe on the tiny potentiometer.
  4. Adjust the potentiometer while monitoring the multimeter reading to set the reference voltage (VREF)
⚠️ I ended up setting the reference voltage to around 1V.

Electronics 2

breadboard connections.jpg
shield connections.jpg

For the rest of the connections to the Arduino:

  1. M1A, M1B, M2A, M2B connect to the stepper motor
  2. VIO is soldered to the 5V output on the motor shield
  3. DIR, STEP, and ENABLE connect to Arduino digital pins of your choice and are used to send signals to the driver
  4. Grounds should be connected

Stepper and Servo Code

moving.gif
pick.gif

Now it's time to get the mechanisms moving!

Reset the slider's position by moving it as close to the stepper as possible. Then upload the stepper.ino code, which uses the Accelstepper library, to test its movement (you may need to adjust the limits to ensure the slider has its full range of movement).

Once complete connect the micro servo to the Arduino and run the servo.ino code to verify its operation.

Slider Calibration

clearance.gif

If both sections work properly, you can now combine them by mounting the servo onto the slider and incorporate both pieces of code from earlier

⚠️You may need to adjust and determine the correct angles for the servo motor once it is in place.

Position Calibration

position.gif

This part is slightly more difficult and may require some trial and error.

In order to get the robot to pluck the strings, find the position of each string and put it into the code so that the pick gently rests on the side of each of the four strings. The code in the later sections may assist with this (remove the uneccessary parts).

Solenoid Assembly 1

mounted solenoids.jpg
cage cad.jpg
solenoid.jpg

With that done, print the solenoid cage if you haven’t already, and insert the solenoids (thread the wires through first) in the pattern shown in the image above. For each solenoid, connect one wire to to ground, and the other to one of the motor inputs on the arduino shield.

Solenoid Assembly 2

plunger.gif
string height.jpg

Screw the plungers into the solenoid ends, and then attach the cage to the neck of the ukulele using the cage mounts. Verify that the plungers press the strings correctly, and realign if necessary.

Putting Everything Together

home position.jpg
plug in power.jpg
plug in arduino.jpg

Depending on your setup, getting everything to work may require several attempts. I’ve included a few scripts that could assist with this process in this section.

Testing process to remember each time:

  1. Plug in the 12V power source.
  2. Connect the Arduino.
  3. Move the slider to the home position.


Downloads

Songs to Play

tabs.png

I've put a few different songs in the ukulele.ino sketch so be sure to try them all out!

Finished!

done.gif

The build should now be finished.

If you would like to see more footage of the ukulele and other robotics projects check me out here.

Thank you for reading.