Self-playing Ukulele Robot Using Arduino
by zeroshot in Circuits > Robots
34115 Views, 161 Favorites, 0 Comments
Self-playing Ukulele Robot Using Arduino
In this project, I design and build a self-playing ukulele robot that can autonomously play music!
Supplies
Based on the Arduino Uno microcontroller!
Disclaimer - Supplies list may include affiliate/paid links.
Parts
- Ukulele (any cheap model will do) Amazon
- Arduino Uno Amazon
- L293D Motor Driver Shield Amazon
- 8× 12V Solenoid Amazon
- Nema 17 stepper Amazon
- TMC2208 stepper driver Amazon
- Mini breadboard Amazon
- 150mm MGN9B linear rail w/ block Amazon
- GT2 6mm timing belt Amazon
- Pulley and idler Amazon
- Micro servo Amazon
- 12V 10A power supply Amazon
- Solid core wire (22 AWG) Amazon
- M3 nuts and bolts Amazon
Tools
- 3D Printer
- Soldering Iron
- Screwdriver
- Multimeter
Watch the Video!
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:
- rail_mount.stl (×2)
- idler_holder.stl
- 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
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
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
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
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
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
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.
- First, connect the driver to a 12V power source.
- Turn on the power and set your multimeter to measure DC voltage.
- Place the black probe on the GND pin and the red probe on the tiny potentiometer.
- 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
For the rest of the connections to the Arduino:
- M1A, M1B, M2A, M2B connect to the stepper motor
- VIO is soldered to the 5V output on the motor shield
- DIR, STEP, and ENABLE connect to Arduino digital pins of your choice and are used to send signals to the driver
- Grounds should be connected
Stepper and Servo Code
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
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
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
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
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
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:
- Plug in the 12V power source.
- Connect the Arduino.
- Move the slider to the home position.
Downloads
Songs to Play
I've put a few different songs in the ukulele.ino sketch so be sure to try them all out!
Finished!
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.