element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Valentines Musical Box
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 18 Feb 2021 1:24 PM Date Created
  • Views 469 views
  • Likes 9 likes
  • Comments 6 comments
  • musical box
  • nano
  • valentines day gifts
  • 3d printed
Related
Recommended

Valentines Musical Box

dubbie
dubbie
18 Feb 2021

Rather than just a card , flowers or chocolates this Valentine Day I decided to construct something appropriate using electronics - to share the fun. I have had a go at automating a musical box mechanism in the past (with no success - it was going to be for my Christmas Holiday contribution) and I recently became aware that you could buy the musical box mechanism without a spring needing winding up, you just turn a small hand crank - giving the ability to play at different speeds.

 

After some searching I found one that played a suitable tune (which Elvis Presley had recorded in the past) in a small wooden box (oreforde Engraved Music Box - Wooden Engraved Hand Crank Music Boxes -Can't help falling in love - Gift for Wife Girlfriend.: Amazon.co.uk: Kitchen & Home). I like the tune and my wife should like the tune.

 

I was originally going to 'remove' the crank in some way and directly drive the musical box cylinder but after some examination and considering of how to actually remove the handle (it looked difficult) I decided it would be better to leave the crank handle in place and just use a micro servo motor with an arm to turn it instead.  For the controller I could have used almost anything as it only needs one digital output but I had some Arduino Nanos without headers so I used one of those. I wanted it to be battery powered but AA and AAA batteries take up considerable room and I wanted to keep the whole product as small as possible, so I used a LiPo battery. I had some 1000 mA hour batteries so I used one of those. As the Nano and the servo motor needed 5V or 6V really, I decided to use a small booster board to increase the 3.7V from the battery to 6.0V. I would have preferred a booster charger but the only ones I could find were far too expensive so when the battery goes flat I'll just unplug it and use the LiPo battery charger PCB I have. There are no other LEDs or sensors as there wasn't enough time to write the programme so the circuit is very simple and is illustrated below. Sorry the image is a bit dark, I'm not entirely sure why as there seemed plenty of light when I took the photograph.

 

image

 

I wanted to make a complete product this time so decided to design a 3D printed add-on box which just fitted to the right of the existing wooden box and was the same size. The crank handle is inserted through a large hole  and a continuous rotation micro servo motor is just pushed into the slot designed for it to fit exactly, and is held perfectly by friction. I had to do a great deal of tinkering with the box to get the horn from the servo motor into the correct place and the micro servo motor into the correct place, so some hand fettling had to be done. For this reason I have not included the STL file because basically it isn't correct and there wasn't time to fix all the mistakes. The TinkerCAD view of the box is shown below.

 

image

 

The hole in the box at the back is because the crank handle just protrudes slightly so it was either a hole or a slightly bigger box. I went for the hole and then covered it over with a piece of white paper - it is at the back to so doesn't show. Not a great solution but the remaining time was being measured in minutes rather than hours. I would like to be able to claim that the compartment next to the servo motor was specially designed to hold the battery, Nano and booster PCB, but it wasn't. It is pure serendipity that I could manage to squeeze everything in - just. Sadly, because of a slight mistake with the positioning of the hole for the on/off switch (which I also forgot to add to the  circuit diagram) there was no room inside the box for it's connections so I had to hot glue it to the front. Not a good finish but it works. I must get some better on/off switches.

 

The programme is also very simple, just being a for loop to output the required number of pulses needed to keep turning the musical box crank handle at the required speed and required duration, as listed below. Both the speed and duration were found by trial and error. It plays the tune and then stops. It has to be turned off then on again to make it play again.

 

/*  Dubbie Dubbie

*  Servo Musical Box

* 

*  13th Feb'21

*  Just for Fun

*/

 

#define testservo 2

 

void setup(void)

{

  pinMode(LED_BUILTIN, OUTPUT);

  pinMode(testservo, OUTPUT);

  digitalWrite(LED_BUILTIN, LOW);  

  digitalWrite(testservo, LOW); 

  delay(100);        

  Serial.begin(19200);

} /* setup */

 

void loop(void)

{

 

int width;

int count;

 

width = 0;

count = 0;

 

Serial.println("Servo Musical Box " );

Serial.println("Dubbie Dubbie : Just for Fun " );

Serial.println(" 13th Feb'21 ");

Serial.println();

delay(500);

 

  digitalWrite(LED_BUILTIN, HIGH);   // Shows it's working

  delay(500);

  digitalWrite(LED_BUILTIN, LOW);  

 

width = 1500;

for (count = 0; count < 1050; count++)

  {

    digitalWrite(testservo, HIGH);

    delayMicroseconds(200);       // Makes up the 1 ms pulse

    delayMicroseconds(width);     // Makes up the rest of the pulse

    digitalWrite(testservo, LOW);

    delay(18);                    // The rest of the pulse

  } /* for */

 

  while(1)

    {

      /* Do nothing */

    } /* while */

     

} /* loop */

 

The final complete and working product is shown in the video below.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

It worked! There are problems. The micro servo is very noisy which I should have expected. When I was testing the servo I was only make small movements and it was very quiet. Once the servo was cranked up to the desired speed it was pretty noisy. I tried stuffing damping into the box and adding a lid but it was still intrusive. Fortunately the recipient didn't seem to notice. Afterwards I realised that it might have been much simpler to unscrew the mechanism from the supplied wooden box and just make a complete brand new box. Maybe next time, along with a much quieter motor.

 

Sadly(?), it is so well liked that I might not be getting the electronic parts back. Ah well, I'll just have to buy some more.

 

Dubbie

  • Sign in to reply

Top Comments

  • Fred27
    Fred27 over 2 years ago +3
    I'm glad she liked it. Personally, I find that whilst these sort of projects might be appreciated by fellow E14 community members, they are dismissed as "pointlessly geeky" by the lady in my life. You…
  • Jan Cumps
    Jan Cumps over 2 years ago +3
    I sent flowers. It worked . Because Corona, my girl and I have not seen each other for a year now. It's harder to do than to type it.
  • neilk
    neilk over 2 years ago +3
    Nice project, Dubbie. So glad she liked it . I would be happy NOT to get the parts back! Like Fred27 my wife dismisses any project work I do as unnecessary and that I ought to have better things to do…
  • dubbie
    dubbie over 2 years ago in reply to Jan Cumps

    Jan,

     

    I have given flowers in the past along with special designer vases to put them in, but there's only so many times you can do that before it gets a bit 'samey'. I prefer to try and surprise her - sometimes it even works.

     

    Dubbie

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 2 years ago in reply to Fred27

    Fred,

     

    I think she is resigned to it now. She quite likes some of the 3D printed cards and stuff I have made, not so much the electronics ones, although this musical box does seem to have gone down very well.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • neilk
    neilk over 2 years ago

    Nice project, Dubbie. So glad she liked it image. I would be happy NOT to get the parts back!

     

    Like Fred27 my wife dismisses any project work I do as unnecessary and that I ought to have better things to do with my time! Fortunately, she is addicted to trashy reality TV and Soaps, so......................

     

    Neil

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago

    I sent flowers. It worked image.

    Because Corona, my girl and I have not seen each other for a year now. It's harder to do than to type it.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Fred27
    Fred27 over 2 years ago

    I'm glad she liked it. Personally, I find that whilst these sort of projects might be appreciated by fellow E14 community members, they are dismissed as "pointlessly geeky" by the lady in my life. image You wife obviously appreciates your skills.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube