This dancing ballerina was created for my granddaughter.
The idea was so create a ballerina that rotated slowly while an RGB LED ring flashed and a waltz was played.
The video animation attached gives an idea (less the LEDs) for what I was trying to achieve.
- ATtiny85 (initially I wanted to use a ATtiny13 but it could not handle the music)
- ATtiny socket adaptor
- Piezo Passive Buzzer
- Turbine Worm Gear Motor (5-12V, 5-12rpm)
- RGB LED Ring (12bit WS2812)
- DC Socket
- RDP30N06LE Mosfet
- 1N4001 Diode
- Self-locking/latching push button
- PCB Stripboard
- Two self-tapping screws
- Resistor: 300-500Ω & 10kΩ
- Capacitor: 1000 µF, 6.3V or higher
- Heat shrink tubing
- Epoxy Glue
- Super Glue
- 5V power supply
- 3D Printer
- Soldering Iron & Solder
- Wire strippers
- ATtiny shield for Arduino
This project cost me under $10 (USD) to build.
Step 1: Original Concept
I include this merely to detail some of my learning. The original design was as shown in the photos i.e. the motor was to be mounted from below with the LED holder being glued into position. This however did not give a good finish with respect to how the LED holder lay and also did not allow enough space for me to secure the circuitry.
Also initially the part for securing the ballerina to the turning shaft was all one piece but unfortunately the structure was not strong enough and the model broke at the ankle as well as the point of the attaching section. I was able to glue the foot back on but try as I may I could not reattach the bottom part.
I could have redesigned and reprinted the entire ballerina but in the end decided on different approach which I feel worked out even better in the end.
Step 2: Printing the Parts
Using Blender I edited Maitan's dancer, removing the base and adding the small pedestal that would be used to attach the motor. Here I found a design flaw (or maybe it was as a result of my limited knowledge in the area of 3D printing). As you will see from my photos, while cleaning up the printed dancer both the foot and pedestal broke off. Using epoxy I managed to successfully stick the foot back but I could not re-secure the pedestal part. I therefore printed a separate cylinder that would attach tightly to the motor's shaft and into which the ballerinas foot could be glued. Before fixing the cylinder to the shaft, a dome was printed and placed over and around the shaft to finish it all off.
The Base, Ballerina and connecting dome parts where done in contrasting colours which helped add to the overall effect.
Initially the motor mount was round but I then discovered that once the switches where attached to the main cone that this design did not give me enough room to insert the motor mount into position. I therefore made it square by slicing the round edges off (see comments on the pictures to get a better idea as to what I mean).
Except for the ballerina, FreeCAD was used to create the 3D printed parts (the FreeCAD files, together with the exported SLT file, are attached).
Note: The Ballerina is not the correct size therefore it needs to be scaled in the 3D printing software so that the span between the tips of her hands is approximately 140mm wide.
Step 3: Preparing the Music
Disclaimer: I am no musician and so do not know the names of the notes or part of music scores hence please bear with my poor description below.
Load the MIDI file into MuseScore (or a program that will allow you to edit MIDI files) and then edit the music as follows:
- Whenever there are notes in the same column, keep only the top note, remove all notes beneath it.
- Remove the bottom set of notes. In this way you would have reduced the music to single notes.
- Export the new music score to a new MIDI file.
This file will now needed to be converted to the appropriate Arduino code. This can be achieved using: https://extramaster.net/tools/midiToArduino/
The resulting code can then incorporated into your final code.
I have attached both audio files so that you can compare them (in MuseScore). This will hopefully help explain my above steps better.
- Waltz_No._2_by_Shostakovich.mid (original file)
Because the ATtiny85 has only limitted memory, I had to also truncate the music so that all my desired code would fit on the chip.
Step 4: Uploading the Code
Using an Arduino Uno and a ATtiny shield, upload the attached code to your ATtiny13.
The library that I used for the ATtiny85 was http://drazzy.com/package_drazzy.com_index.json. Add this to you additional boards (under file, preferences) and then install ATTinyCore by Spence Konde.
The basic points are as follows:
- The LEDs were driven from pin 3.
- The piezo speaker was driven from pin 1.
- The motor was driven from pin 0 and set up this way so that I could slow it down to the desired speed. I used the following tutorial to learn how to use a mosfet to achieve this.
Once done the chip can be inserted into the ATtiny socket on the stripboard.
The ATtiny85 pinout can be found here.
Step 5: Assembling the Project
Solder your wires into the LED ring. I used black wire so that they would not be noticeable (make sure the wires are long enough to run under the LED holder, down the inside of the Cone and then around the inside of the bottom of the base). Because they were all the same colour, I wrapped the ends with different coloured insulation tape so that I would know which points they connected to. Thread the wires through this hole and then glue the LED ring in place using epoxy.
To date this is the most complex circuit that I have put together and so I am sure that there is probably a much better and tidier way to have done this. I cut two pieces of stripboard as per the diagram. One to hold the ATtiny85 and one the mosfet and associated components.
The steps that I followed were as below:
- Attach the wires to the LED ring
- Using epoxy glue, glue the LED wring into the LED holder.
- Secure the motor by screwing it into the holder
- Glue the piezo speaker to the base-plate (this, including all other glued fixtures where done using superglue)
- Insert the switches and power socket into the main cone and solder connecting wires to them. The contact on the switches need to be bent in order to make room for the motor mount to be inserted (take care when doing this as I landed up breaking a number of switches when doing this). It is very important to check that you have wired up your power socket correctly. It is therefore worth plugging your power supply into the plug and then using a multimeter to check that you have the polarity correct before connecting this to your circuit board.
- Assemble the ATtiny85 board
- Assemble the Mosfet board
- Glue the two stripboards to the baseplate
Before the motor and baseplate can be inserted into position, the ATtiny85 needs to be programmed (see the previous step). Once done the following steps can be completed:
- Insert the programmed ATtiny85
- Insert the motor and baseplate. This is a very tight fit but can be achieved without breaking anything if one takes care.
- Using super glue, the base is then glued in place
- Before attaching the finishing dome on top of the LED holder, us a hacksaw to cut the motor's shaft down to the right size so that the cylinder used to attach the ballerina will be sitting at the correct height i.e. more or less level with the top of the finishing dome.
- Glue the the dome in place
- Glue the ballerinas foot into the connecting cylinder
- Push the connecting cylinder into place on the motor's shaft.
- When needed, a small drill bit can be used to break the required sections on the stripboards. Simply hold the bit between your figures, rotating it so that the copper is removed from the board
- Whenever necessary, heat shrink tubing was used to protect connections from accidental shorting
Step 6: Final Notes
As a prototype, I am very happy with the final product. This said, if I were to do this again, I would make the following changes:
- Do better FreeCAD drawings (for me, CAD is still a very real work in progress and I still have much to learn).
- Look at a way to better hide the wiring and components. While not obvious it is possible to look into the top of the cone and see some of the wires, switches and motor screws (which detracts from the overall effect). A quick fix would have been to spray-paint the internal parts black before final assembly. A better solution would have been to spend more time on the internal layout.
- I used the FastLED library together with part of the DemoReel example to achieve the LED effect. I am sure that there are more efficient ways to have achieved my final result but in this instance this worked for me. If I were to do this again I would probably spend more time trying to improve this section.
- I can't decide if the ballerina is still moving too fast. I am inclined to want to slow it down still a little further but alas it is too hard to get to the ATtiny85 to reprogram it.
- The switch used to turn the sound off is very close to the power socket. Its position makes it hard to turn it on again while the power is plugged in. This switch should probably be changed to one that is similar to the on/off button used in this project.
- I should have changed the startup sequence so that the lights start-up, then the music and then the ballerina starts moving. Right now the the movement starts first.
Last but not least I wish to thank the Unleash Space (and their amazing team) for opening the world of 3D printers, laser cutters, electronics etc to me and setting my creative juices abuzz with endless possibilities (to date virtually all of my projects are as a result of me being able to work in this space). I also wish to thank Instructables for making it possible for me to share my journey into the amazing Makerspace world.
This is an entry in the
Arduino Contest 2019