Arduino animated Nativity Scene: the woodcutter

Bethlehem Portal with Arduino

Christmas is approaching and with it comes the tradition of setting up the Nativity Scene. Something so traditional can be linked to new technologies, as we shall see: why not modernise the Nativity Scene and use Arduino to bring the figures to life? Imagine the Ferris wheel spinning, the character in the well pulling out the real bucket, the sawyer sawing his trunk, the blacksmith hitting his anvil, the woodcutter chopping with his axe (which will be the one we will deal with in this article), controlling the lights, creating artificial sounds, ... Well, stop imagining and get down to work with this Christmas project to "arduinize the Nativity Scene".

Note: Obviously everything can be controlled from the same Arduino board, using the different connections offered by the board and extending the code of our sketch, achieving a "living" Bethlehem with a single board.

What do we need?

  • Arduino UNO Rev3 board. (Buy it in our shop)
  • A servomotor.
  • Paper and printer to print the figure (if you are handy you can mould the figure in clay or use Fimo paste). But to make it cheaper and simpler, especially if you are not good at crafts, we will make it out of paper and cardboard.
  • A piece of cardboard, on which to glue the paper to make it more rigid.
  • Carpenter's glue or paper glue.
  • A stick of hot-melt silicone (you know, the kind that melts with heat). If you don't have a gun, don't worry, you can melt it with a lighter (it's a bit crappier, but it works...).
  • A small wooden tube or wooden tube, as the axis of the movable arm.

Steps for implementation

The first thing you should do is create your figure paper, printing an image of a lumberjack that you can find on the internet, or moulding it in Fimo paste or clay. If you opt for clay, the next step would be to wait for it to set, then start colouring it and wait for the paint to dry. Remember that the arm of the figure that holds the axe must be made separately. Whether it is made of paper/cardboard or modelling it, otherwise it would not be mobile.

The arm must have a shaft that we will introduce in the Fimo paste or in the clay when it is still soft to allow the movement later, while if you decide to do it in the Fimo paste or in the clay when it is still soft to allow the movement. paper or cardboardYou can drill holes for the shaft at any time. Remember to drill also the body where the shaft will be inserted to join the arm with the trunk of the doll and to pass to the servomotor.

Once the steps for creating and assembling the figure have been completed, which are quite simple and intuitive, we will now move on to the more technical part. The next step will be to work with the servomotor to attach it to the axis of the moving arm and make the relevant connections. A servomotor is a small electric motor with a low speed, but with a fairly high precision. The axis of the motor can be placed in any position within its range of rotation (normally 0º to 180º). As you will see, the servo motor you have purchased has three wires, a red one (5v), a black one (0v or GND) and a third one that can be white, orange or yellow depending on the model (control). The first two power the servo and the last one acts as a turn controller. So we can connect the red one to the 5v output of our Arduino board, the black one to ground or GND and the last one to the digital output number 13, in our case.

 Servo connection to Arduino

We will now join the servo shaft to the improvised axle that we have created to animate our Nativity Scene figure. I have chosen to use a lace of a thickness that fits perfectly in the hole of the shaft that incorporates the servo. This way I avoid having to use couplers or glue. Then what I have done is to pass the lace through the body of the figure (through the hole we made previously) and glue the tip of the lace to the movable arm with hot silicone or hot melt.

Shaft and servomotor

It's time to making the sketchwhich, as you will see, is very simple. To program servomotors, use the header <Servo.h> pointing to the bookshop Servowhere you can find the functions to operate this type of engine. Take a look at the code:

[cpp]
//Code to drive the servo attached to the lumberjack in Bethlehem

#include
Servo axe; //Declare "axe" which represents the arm of the figure.

void setup(){
ax.attach(13); //Pin 13 is the servo control pin.
}

void loop(){
ax.write(30); //Corresponds to the position of the axe touching the wood.
delay(1800); //Delay to hold 1.8s the axe in that position
for(int i=31;i<=120;i++){ //Loop to lift the axe slowly
hacha.write(i);
delay(85);
}
delay(1800); //Wait with the axe up before the new axe
axe.write(153); //Small recoil of the arm to gather momentum
delay(500); //That should last for half a second
}
[/cpp]

Like Final adviceMake sure that the shaft moves well and does not have too much friction to prevent it from moving properly. You should also think that the figure should cover the servo so that it is not visible and the Arduino board should be hidden in your Bethlehem. Make a good base support so that it stands upright or even place something that weighs it down, in the case of a moulded figure it will weigh more and will not have this problem, but the cardboard one will. And very important, in the previous sketch, notice that we have worked with angles between 31º and 120º (153º with the axe setback). Depending on your figure it may vary, so do a test and then calibrate these values according to the movement that your figure should have. So check the values in the following lines of code:

hacha.write(31)

for(int i=31;i<=120;i++)

hacha.write(153)

I hope you liked this original idea. Now think, invent and make with the rest of the figures of the Nativity Scene.

Buy - Arduino UNO rev.3

More information - More Arduino tutorials, Introduction to Arduino: an electronic universe on a single board

2 thoughts on “Portal de Belén animado con Arduino: el leñador”

    1. Exactly, it was a mistake. I missed typing the 3 in front of the 1. You're absolutely right, because it should start from the position where the axe is on the trunk and go up... I'm sorry, I'll correct it. And thanks for the warning. Greetings!!!

Leave a Comment

Your email address will not be published.

en_GBEnglish
Scroll to Top