Overview

An automaton type of robot that can create anything from simple up and down movements of a character all the way through to incredibly intricate, complicated scenes with multiple animated characters, and even such incredible feats as figures that can draw illustrations or write words with an ink pen!

One of the primary mechanisms found in nearly all automata is the cam follower. In this project we'll build such a mechanism and motorize the drive wheel with a Crickit and Circuit Playground Express coded in MakeCode.

Parts

1 x Circuit Playground Express
Round, Awesome Microcontroller Board
1 x Adafruit CRICKIT
for Circuit Playground Express
1 x TT Motor DC Gearbox
200 RPM 3 to 6VDC
1 x Orange and Clear TT Motor Wheel
for TT DC gearbox motor
1 x Male DC Power adapter
2.1mm plug to screw terminal block

Materials and Tools

  • Small and medium corrugated cardboard boxes
  • Wooden dowels or pencils
  • Rubber bands
  • Ruler
  • Hobby knife or scissors
  • Hot melt glue and glue gun, or white glue
  • Compass or circular object to trace, e.g. coffee can
  • Pipe cleaner or string

Here's the original livestream that spawned this project:

Build the Mechanism

Cam Follower Basics

At the heart of this automaton is the cam follower mechanism. In the diagram below we have named the basic parts of the system. For a more in depth view, take a look at this excellent page by automata builder Dug North.

Here's how the mechanism works -- the axle or shaft rotates, as does the cam which is attached to it. Gravity keeps the follower in contact with the cam as it rotates, however the rod that is attached to the follower is constrained by the bearing, so it can only move up and down.

This has the end result of converting rotation to linear motion.

Oval Cam

In this animation we can see how an oval shaped cam will create a regularly repeating up and down motion for the follower and rod. The regular, smooth, symmetrical shape of this motion is similar to a sine wave if we to plot the motion on the y-axis over time.

Irregular Pear Cam

This cam has a somewhat irregular pear shape. Note how this produces a more abrupt rise and fall, with a longer period in the down position, more like a jump motion.

Construction

The basic construction of our automaton is fairly simple -- we'll use a small box as the frame, two dowels (or pencils!) poked through holes in the box for the cam's drive shaft and follower rod, and cardboard shapes for the cam and follower. A piece of drinking straw will act as our rod bearing.

Instead of cranking the drive axle by hand, we'll turn it with a DC motor driven by the Crickit and Circuit Playground Express. Since the DC motor spins too fast to connect to the cam shaft, we'll need to gear it down by building a large cardboard wheel which the motor will drive indirectly with a smaller wheel and rubber tire.

Frame Building

Start with a small cardboard box. From it, remove a long, rectangular section from the front of the box. This will be a guide for the follower so that the rod (and automaton) doesn't spin around on it's long axis.

Use a ruler to draw out and cut the rectangle from the front of the box. The exact measurements aren't important here, but note that the distance from the middle to the top of the rectangle is the maximum vertical distance the rod and automaton will be able to travel.

Cam Shaft Holes

Next, poke a hole through the centers of both sides of the box  -- this will hold the cam shaft as it rotates.

  • Measure the spot at the center of the sides so that the axle is level
  • One way to do this is by using a ruler to draw and 'x' from corner to diagonal corner -- the center of the 'x' is the center of the rectangle!
  • Use a sharp, round object to poke the holes through so the dowel will fit and turn without much friction

Rod Bearing

Now, poke a hole through the center of the top of the box for the rod dowel.

To help the rod move up and down, we'll add a short length of drinking straw to act as a bearing. The plastic is pretty low friction, and the length of the straw will prevent the rod from rotating.

  • Mark the center of the top of the box
  • Poke a hole for the bearing
  • Cut a short length of drinking straw -- make sure the straw's internal diameter is large enough to fit the dowel
  • Place the straw piece in the hole
  • Optionally, use a dab of hot glue to hold the straw in place

Follower Guide

Cut out an identical rectangle from the back of the box as you did for the front -- this will act as the other half of the guide for the follower to prevent it from rotating.

Cam Building

Now, we're ready to make a cam. You can experiment with different sizes and shapes of cams for your automata. For this one, we'll make a type of jumping motion by using an irregular pear shaped cam.

  • Measure the distance from the center to the top of your follower guide rectangle you cut from the front face of the box. This is the maximum radius our cam can be before it would get stuck during rotation
  • Draw a circle of that measured radius on a piece of cardboard using a compass. Alternatively, you can use an appropriately sized lid or can to measure and draw the circle
  • Draw a smaller circle centered on the same spot as the first. This will be the lowest point the follower can drop
  • Connect the shapes as shown to create the irregular cam -- this doesn't need to be exactly the same as shown here
  • Cut out the cam using a knife or scissors
  • Transfer the shape to create two more cam pieces, then poke their center holes out to the same diameter as your dowels
  • Glue the cam pieces together

Make the Follower

Now, we'll make a simple rectangular follower that will be able to ride the edge of the cam and transfer the motion to the rod and automaton above.

  • Measure a piece of cardboard that will protrude from the front and back of the box and is a bit more narrow than the rectangular follower guides you cut from the front and back of the box
  • Cut four identical rectangles
  • Poke holes in the centers of three of the rectangles for the rod to fit
  • Glue the pieces together in a stack with the piece that has not hole at the bottom -- this will contact the cam so we want it to be smooth

Insert Rod and Follower

Slide the rod into the bearing and then attach it to the follower by pressing it into the hole. You can add a bit of hot glue for a secure fit.

Add the Cam and Shaft

We'll add the cam shaft, cam and a couple of rubber bands to prevent the shaft from moving left or right.

  • Push the cam shaft through one side of the box
  • Wind a rubber band around it. This will help prevent the shaft from moving around
  • Slide on the cam
  • Add the second rubber band
  • Push the shaft through the other side of the box
  • Add hot glue to secure the cam to the cam shaft -- these two parts need to move as one

Test the Motion

Close the box lid and try rotating the cam shaft -- you'll see the follower has no choice but to move up and down!

Cam Shaft Wheel

Since the DC motor we're using spins faster than we want, we will gear it down. To do this, we'll use a small wheel on the DC motor shaft that will spin multiple revolutions to turn a much larger wheel it is "riding on". This is similar to using toothed gears to accomplish the same task, but we'll be able to get away with just the friction of the rubber tire to do the turning.

We'll make a wheel of the exact size we need out of cardboard! The wheel needs to have a diameter a bit smaller than the height of the box so that it won't touch the surface upon which the automaton is resting.

Wheel Discs

Draw out a circle on a piece of cardboard that is a bit smaller than the box height. You can use a compass, or find a large can or lid to trace.

  • Cut out two circular discs for the wheel's sides
  • Mark the centers of the discs, so we can poke holes for the cam shaft later

Wheel Tread

For the center tread of the wheel, we'll cut a long strip of cardboard from an unfolded shipping box.

  • Flatten the box and cut of the flaps
  • Cut one edge of the rectangle to create a single, long strip
  • To determine the length needed, mark a start point on the strip and a disc and then roll it along the tread strip one revolution until the wheel mark hits the strip again-- this circumference is the length needed so mark the strip for cutting
  • Cut the strip a bit longer than measured to account for material thickness (I didn't do this very well so you can see in some pictures where I added a bit of cardboard to fix it!)

Pre-Bend the Tread

You can roll the tread tightly around a cylindrical object a bit smaller than the discs in order to form the tread before attempting to glue it to the discs. This will give the tread a bit of a 'memory' of the shape, making things easier.

Here a roll of tape is used to form the tread into a cylinder.

Glue the Wheel

 

  • Using hot glue or white glue, form the tread around one of the discs as shown
  • Leave a bit of the end of the tread unglued to make it easier to add the second disc
  • Hold the tread in place while the glue sets
  • Glue the interior of the tread and add the second disc
  • Push the shaft through the ensure a the discs are aligned
  • Glue the end flap in place

Attach the Wheel

Now we'll slide the large wheel onto the cam axle.

  • Slide the wheel onto the cam axle dowel
  • Push it close to the box, but not touching
  • Add a bit of hot glue to fix it to the axle

Your basic automaton mechanism is complete! Give the wheel a spin (be careful to note which directly allows the follower to smoothly glide over the edge of the cam, it may get stuck going the other way due to the flat side of the cam) and watch the rod go up and down.

Next we'll program the Crickit and Circuit Playground Express in MakeCode to run the DC motor, which we'll later connect to the mechanism.

Code with MakeCode

You can code your Crickit and Circuit Playground Express using MakeCode! If you aren't already familiar with MakeCode, check out this guide to get started, then return here when you're ready.

Crickit Extension

The good folks at Microsoft's MakeCode team have been busily adding Crickit functionality to MakeCode! Currently, this works with the beta version of MakeCode, so click this link to get started. Then, create a new project.

To enable Crickit functionality in MakeCode, click on the Advanced category, then click on Extensions.

Then, type 'crickit' in the text field and press enter. The Crickit package will appear. Click on it and it'll be added to MakeCode!

Now that the package has been added, you'll see a new block category appear named Crickit

Click on the Crickit category to see all of the things you'll be able to do.

Crickit Run Motor

We'll start with the fundamental block for our program -- crickit run motor

Add one of these blocks to the Forever block. This will cause Motor 1 to run at half speed, forever!

Name and download the program, saving the .uf2 file to a directory you can easily find.

Then, plug the Circuit Playground Express (CPX) into you computer over USB (make sure to plug into the CPX USB port, not the one on the Crickit, which is used for occasional firmware updates) click the reset button on the CPX once to enter bootloader mode. Copy the .uf2 file to the CPX by dragging it to the CPLAYBOOT drive that appears.

Make sure the battery pack is plugged into the Crickit, and that the Crickit's power switch is in the 'on' position.

When the Circuit Playground Express restarts, it will tell the Crickit to run the motor. It's alive!!

Button Activation

It's convenient to set up start and stop buttons for the motor. We can use the two that are built onto the Circuit Playground Express.

From the Input category, add an on button A click block. Since we won't have the motor run forever anymore, drag the crickit run motor block out of the forever block and into the new button block. You can delete the forever block.

Stop Button

Add another button block, this time changing the dropdown menu to button B.

From the Crickit category, add a crickit stop motor block to the button B block.

Speed Control

What if we want to have a couple of different speeds to run the automaton? One way is to use the slide switch on the CPX to change the crickit run motor speed percentage between to preset values.

To do this we'll create a variable called speed. Then, we'll us this variable in place of the current fixed value of 50% that is in the crickit run motor block.

Our slide switch will change the value of the speed variable depending upon its position.

Click on the Variables category and Make a Variable... named speed.

Drag the speed variable to the crickit run motor block.

Startup Speed

When the program starts, we need to specify the value of speed in case the button A is pressed before the slide switch it moved. From the Loops category, add an on start block. Then, drag from the Variables category a set speed to block and set the value to 40.

Switch Control

Now, from the Input category, add an on switch moved left block. Duplicate the set speed to 40 block by right clicking on it and choosing Duplicate. Drag this copy to the switch block.

Duplicate the left swtich block, and change the dropdown menu item to right. Change the set speed to value to 80.

And there we have it! Download this .uf2 file and copy it to your Circuit Playground Express and now you'll be able to start and stop the automaton and run it at two different speeds. Note, you'll need to press the A button to activate the speed change after flipping the switch. Can you think of a way to adjust the program so this happens automatically when the switch is changed?

NeoPixel Speed Indicator

Here's the program with a few blocks added from the NeoPixel category to show low and high speed colored indicators.

You can download this copy below if needed.

Next, we'll connect the brains to the machine!

Power the Automaton

Indirect Drive Wheel

We'll couple the high-RPM DC motor and orange wheel to the cam shaft indirectly by resting the assembly on the large cardboard cam shaft wheel. To allow for irregularities in the surface, we'll have a single pivot, made from a toothpick, that holds the motor in place while still allowing it to pivot in compliance.

  • Place the toothpick into the motor's mounting hole as shown
  • Mark the position on the box that will allow it to rest on the large wheel
  • Cut a small hole
  • Push in the toothpick
  • Slide the motor into place

That's all there is to it -- gravity will do the rest of the work!

Mount the Crickit

To counterbalance the weight of the motor and wheels, we'll mount the Crickit, Circuit Playground Express, and batteries on the opposite side.

  • Hold the Crickit in place and mark holes to mount it to the box's side
  • Use pipe cleaners or string to secure it in place
  • Mark and affix the battery box underneath the Crickit

Plug the motor's wires into the Crickit's Motor 1 port as we did during programming.

Add Character

You can now choose what to move with your cam follower mechanism! A simple approach is to draw or print a character to affix to the rod.

Or, you can get a bit fancier and create a jointed character so that just and arm moves, or perhaps the stance of a cat made from pipe cleaners and googly eyes!

This guide was first published on Jun 04, 2018. It was last updated on Jun 04, 2018.