Merry Boxes & LEDs

Enter Your Project for a chance to win a Maker Tool Kit, an Oscilloscope Grand Prize for the project that brings the Most Joy to the Heart, and Gift to Gives!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

I decided to go for a second lever on the lid opening mechanism for the Jack in the Box Merry Boxes and LEDs event, rather than adding a bulge to the lid itself. This all went well until assembly when I realised that I had forgotten to subtract the height of the lid fixing hinge from the length of the second link. I did initially think I might just make and print a shorter version but then I thought 'Why not just cut the existing link down to size'. It was much quicker and cheaper, plus if it was still too long I could just cut another bit off. However, all I had to do was to remove the amount added by the hinge for the lid and it fitted, maybe not perfectly but it worked so I left it at that. All that was needed now was a programme for an Arduino Nano which just used the Servo.h library to cycle the servo backwards and forwards between the two extremes. Programme listing below.

{
int lidvalue;

  lidvalue = 0;
 
  for (lidvalue = start; lidvalue <= end; lidvalue++)
    {
      lidopen.write(lidvalue);                   
      delay(stepdelay);                      
    } /* for */
delay(1000);
  for (lidvalue = end; lidvalue >= start; lidvalue--)
    {
      lidopen.write(lidvalue);                   
      delay(stepdelay);                      
    } /* for */
delay(1000);
} /* loop */

 

I stuffed all the mechanism into the box, apart from the Nano, proto-board and batteries - which don't fit! Initially nothing seemed to happen and there was just a lot of servo buzzing. With the lid shut you cannot see what is happening. After a bit of testing of the servo outside the box I realised that I had accidentally used a continuous rotation servo which was just stalled. It got quite warm so I hope it still works. I then tried a proper micro servo but it made some crazt backwards and forwards movements when first turned on. There didn't seem to be any fault with the programme so I tried another servo that I need worked. It turns out that the new servos I purchased just before Christmas might all be duds. I tried two and then gave up with them. I might send them back or just keep them for small DC motors. Once that problem was solved the lid would then open and close. See below for the initial testing. It sort of works

 

 

 

 

It doesn't work properly as nothing happens for a while and then the lid shoots open halfway and then operates nicely to fully open and then close where-upon it waits a bit and then shoots open again. After carefully looking at what was happening, which wasn't easy as the lid wasn't open, I realised that the base holding the servo motor was lifting away from the bottom of the box until it jammed and then it would open the lid. I also realised that the hinge connecting the second link to the lid was too near the lid hinges which fixed it to the box, so that too much torque was required to start it moving. Rather than fix the servo base permanently into the box (who knows what problems I might encounter in the future which might require its removal again) I just used tow lumps of Bluetac on top of the base and pushed them in hard to hold the servo base down. I also moved the hinge as far away from the lid hinges as possible. The result was that it now quite smoothly opens and closes the lid.

 

 

 

Next step is to start adding the decoration and LEDs.


Dubbie