Mechanical Popup Dinosaur

You’ll be familiar with a popup notification – our phones and laptops bombard us with them daily and it can be difficult to cut through the noise. To remedy this, I decided to build a physical popup dinosaur which you can use to draw attention to your most important digital happenings.

In the following video, I document the full design, build and assembly process of my popup dinosaur, as well as an explanation and some close-ups of the 3D printed mechanism.

I haven’t hooked it up to function as a notification yet – that can come later. First, I wanted to focus on making something truly attention-grabbing, a notification you don’t want to dismiss!

Bill of Materials

Here are the materials I used to create the popup dinosaur (excluding 3D prints).

1 x Pro Micro (Arduino Compatible)

2 x SG90 micro servo (9 gram)

2 x LEDs

1 x 1k Ohm resistor

1 x 100k ohm resistor

1 x 560 ohm resistor

2 x Female header strips

1 x Button with integrated LED

Lots of male – female hookup wires

30 x M2 bolts (a variety of 6mm lengths and 12mm lengths)

12 x M3 bolts (all 12mm long)

3D Prints

There are many, many, 3D prints for this project – too many to go through individually really, I mean, look at them all!

So, I’ll keep it short and sweet… if you want to have a look, it’s probably best just to directly open the Fusion 360 file. I only just found out you can share Fusion 360 designs, so if you access it, leave a comment. What a time to be alive! Here’s the link: https://a360.co/2zRFzP9

Circuit Diagram

The circuitry for this one is quite simple. It’s just a button, two LEDs and two servos. As the servos both turn in the same direction, I actually use only one signal pin to drive both of them.

The additional little circuit board I added on top of the Arduino makes the whole assembly a little trickier, but the connections themselves are fairly simple, as you’ll see in this diagram.

Everything is powered over USB so there is no voltage regulation to worry about. Just make sure that your USB power supply can handle up to 1A of current.

Code

The code for this one is fairly simple – the main loop waits for a button press and then calls either the mechUp() or mechDown() functions to move the dinosaur. That’s it! There’s really not much else going on. As mentioned above, both servos share the same signal pin as they’re doing the same thing. Also, you might notice in the code that I detach the servo pin between movements. The reasons for this are explained a little bit further down in ‘Lessons Learned’.

#include <Servo.h>

Servo servo;  // Create a servo object

const int downPos = 18;    // The servo position for down
const int upPos = 98;      // The servo position for up

int pos = downPos;  

boolean up = false;


void setup() 
{
  pinMode(10, OUTPUT);  // Pin 10 is positive attached to the eye LEDs
  digitalWrite(10, LOW);

  pinMode(A2, OUTPUT);  // Pin A2 is negative for the eye LEDs
  digitalWrite(A2, LOW);

  pinMode(16, OUTPUT);  // Pin 16 is positive for the button LED
  digitalWrite(16, LOW);

  delay(50);

}

void loop() 
{  
    int buttonState = digitalRead(9);  // Read the state of pin 9
  
    if(buttonState == HIGH)     
    {
      boolean result = debounce();  // Debounce the signal

      if(result)  // If the debounced value is True...
      {
        if(up)  // If the dino s currently up...
        {
          up = false;
          mechDown();     // Put the dino down
          digitalWrite(10, LOW);  // LEDs off
          digitalWrite(16, LOW);  // LEDs off
        }
        else
        {
          up = true;
          mechUp();     // Put the dino up
          digitalWrite(10, HIGH);   // LEDs on
          digitalWrite(16, HIGH);   // LEDs on
        }
      }
    }
}

// A routine to debounce the button
boolean debounce()
{
  boolean result = true;
  
  for(int i=0; i < 4; i++)
  {
    int pressval = digitalRead(9);
    
    if (pressval == LOW)
    {
      result = false;
    }
    
    delay(5);
  }
  return result;
}

// The routine which moves the dino up
void mechUp()
{
  servo.attach(5);    // Attach the servo to pin 5
  
  int pos = downPos;
  
  while(pos < upPos) // Move to the up position { servo.write(pos); pos++; delay(10); } servo.detach(); // Detach the servo } // The routine which moves the dino down void mechDown() { servo.attach(5); // Attach the servo to pin 5 int pos = upPos - 25; // Move to the down position while(pos > downPos)        
  {                           
    servo.write(pos); 
    pos--;                    
    delay(10);
  } 

  servo.detach();  // Detach the servo 
}

Lessons Learned

1) Rack and Pinions…One of the big lessons I learned in this project is how to create rack and pinion systems. I initially tried to design my own but found it to be way too much like hard work. So, I did what any slacker would do, and went on Thingiverse to download a rack and pinion which has already been designed by someone else.

The one I chose is here. Once I downloaded it, it was simply a matter of scaling the downloaded design to the correct size for my project.

2) Attaching and detaching servos… Another problem I encountered was when the servos were in the up position (dinosaur head lifted), they made a buzzing sound – as if they were still trying to turn. I guess the imperfections in the 3D print alignment/geometry was putting stress on the servos, even when they were stationary.

To prevent this, I called the detach() function on each of the servos once it had moved. This essentially turned the servo off. To move it again, you have to reattach the servos to the correct pin and then you’re good to go. You can see this included in the mechUp() and mechDown() functions in the code.

Notification Dismissed!

There you have it, a finished popup dinosaur. Well… It’s certainly not a properly scaled dinosaur and it only sort of resembles one… and it isn’t actually a notification yet because I’ve not coded that. However, it is very mechanical, and it does pop up so I will call this a success.

I hope you enjoyed this project and I’d be delighted to hear your thoughts and questions in the comments below.

See you next time, thanks for coming to visit my site.

Happy hacking,

Robin

Leave a Reply