Fluttering Butterfly

by aguileram in Circuits > Arduino

320 Views, 0 Favorites, 0 Comments

Fluttering Butterfly

IMG_6787.jpg

"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)"

This project is meant to have the butterfly wings flutter before a song is played to symbolize the loading of the song. The system is activated by a controller, and depending on the button pressed a different song plays after the wings flutter.

Supplies

For Butterfly Portion:

For Music Portion:

Tools Required:

Other:

3D Print the Enclosure

Screenshot 2022-04-18 150355.png

Measurements were taken of the speaker used to 3D print the bottom portion of the enclosure accordingly. A hole was left so that the speaker fit snuggly. For the lid, a small hole was left to ensure the IR sensor could work properly and stands were added to hide the copper wire that the butterfly sat on.

These parts were designed in Autodesk Inventor and their files can be found here:

Downloads

Creating the Butterfly

Butterfly_Setup.png

(Soldering Required)

The butterfly was created from dead soft copper. The body was made from rolling the dead soft copper together. It is suggested that a picture of the desire butterfly shape is printed out so it could be traced with the dead soft copper. It is important to leave extra copper in the middle to create the linkages, which will allow for the servo to flap the wings. Loose ends may need to be soldered as shown in the diagram. To move the linkages, 2 paperclips were soldered together to create the shape shown in the diagram. The bottom portion inserts into one of the holes in the servo and the top hooks go thru the linkages created on the wings. It is recommended for the wings to be covered with tissue paper before hooking the paper clips. For support, the butterfly rests on thicker copper wire, but you can create a stand out of any material you'd like.

Prepare the Micro SD Card

Micro_SD_Setup.png

(May skip if the SD card is either less than or equal to 32GB)

Once you obtain the SD Card, you'll want to format it to FAT32 if it is larger than 32GB. Go to: https://rufus.ie/en/

and download the program. Once the program is fully installed, load the SD card to the computer. Then, open Rufus. Make sure the correct micro SD Card is selected under "Device". Under "Boot Selection", select "Non bootable". For "File System", select "Large FAT32 (Default)". Lastly, select "Start".

Load .wav Files to SD Card

wav file photos.png

In order for music to play, we need to load .wav files to a micro SD Card. Using the following website, any YouTube video can be converted to an mp3 file: https://ytmp3.cc/en3c9decqp/. Once you have the mp3 file, it can be converted to .wav file using the following site: https://audio.online-convert.com/convert-to-wav. Refer to the picture for the settings required when converting to .wav files or refer below.

Change Bit Resolution: 8 Bit

Change Audio Frequency: 16000 Hz

Change Audio Channels: Mono

Change PCM Format U8

Creating the Circuit

Circuit_Setup.png

The diagram above displays all the connections for the circuit. For this project, a solder-able breadboard was used, but you can use a regular bread board. The music is being read from an SD card. This method does not have a built in amplifier; therefore, it is important to create a amplifier using a BC337 NPN transistor to make the music audible.


Connecting the SD Card Reader to the Arduino:

  • CS to D4
  • SCK to D13
  • MOSI to ~D11
  • MISO to D12
  • VCC to VCC
  • Ground to Ground


Creating an Amplifier and Volume:

  1. Connect the emitter of the BC337 to Ground.
  2. Connect the Base of the BC337 to the Potentiometer
  3. The output pin of the potiometer needs to be connected to ~D9 of the Arduino Uno


Speaker Connections:

  • VCC of the speaker connects to VCC
  • Ground of the speaker connects to the collector of the BC337 transistor


Connecting the Servo to the Arduino:

  • Ground to Ground
  • VCC to VCC
  • Signal to ~D10


Connecting the IR Sensor:

  • Ground of IR sensor needs to be grounded
  • 5V pin of IR sensor connects to VCC
  • The output pin connects to a 1k Ohm resistor that is in series with VCC

Uploading the Code

Code1.png
Code2.png
code3.png
code4.png
code5.png
code6.png

In the code, there are different buttons that are defined according to the controller used. Each button has its designated song with the exception of the Pause/Play button as it is meant to stop the current song. No matter which of the four buttons are chosen, the servo module will activate 5 times to simulate the flapping of the butterfly wings. Once the wings have finished, the song assigned to the button pressed will begin playing.

The code attached heavily utilizes if/else statements to determine the input of the controller. It is thoroughly commented to help figure out its parts and if anything needs to be adjusted based off the project or any variation of it.

It is suggested that changes are made to the servo_move module as the movement of the servo is influenced by the wings and its linkages.

Assembly

InsideBot.jpg
UnderLid.jpg

Velcro was used to keep the battery holder in place as well as the breadboard. Super glue was used to keep the butterfly stand, servo, and IR sensor in place. The speaker fit snuggly within the enclosure. As previously discussed, the butterfly was made out of dead soft copper and tissue paper.

Short Video of Project Operation and Control System

Fluttering Butterfly Deliverable7