Lesson | Inch Worm | Micro:Bit

Overview

Inchworms are so simple in their movement which makes it a fun challenge to build and animate their movement. The inchworm shifts its weight during its "pinching/folding" to push the front and pull the back.

Skills + Goals

Construction

Build the project following assembly instructions

Carpentry

Basic carpentry principals and hardware

Animation

Learn how to animate a single cycle of movement to create continuous movement.

Age 10+

Time 45 min

Materials

  • A 1 x Screw Driver
  • B 1 x Wrench 8mm or 5/16"
  • C 1 x Servo Sock with Positionable Servo
  • D 5 x Sticks
  • E 1 x Servo Extension Cable
  • F 12 x #6 x 1/2" Screws
  • G 2 x 6-32 3/4" Machine Screws
  • H 2 x Washers
  • I 2 x 6-32 Lock Nuts
  • J 1 x Elastic Band (from Servo Sock)
  • K 2" x 1.5" x 0.75" Pine Block

Build Steps

Step 1

Wrap an elastic band [A] around the wood block [b]

Then attached the sticks [C] to both sides of the wood block 15mm from the end of the block using 2 #6 x 1/2" screws.

Step 2

Attach 2 sticks [A] to the Servo Sock discs [C] using 2 #6 x 1/2" screws

Step 3

join the front end [A] with the back end [B] using the 6-32 x 3/4" machine screws, washers and 6-32 locknuts [C & D]. The locks nuts will be harder to turn. Use the screwdriver with the #1 Robertson (square) bit an 8mm wrench. Only tighten the nuts until the joint still moves freely.

Step 4

Attache a stick [A] to the bottom of the Servo Sock using 2 #6 1/2" screws The rear portion should overhang by approximately 20mm

Step 5

Add 2 #6 x 1/2" screws [A] to the bottom of the stick at the front [B]. Leave the screws down so that they do not poke through the top of the stick.

Step 6

Connect the control board to a USB power source and connect the servo to the 13 connection on the board

Step 7

Note - You may need to adjust the position of the servo horn on the servo inside the Servo Sock to move (sweep) in the range required

If using the animate breakout code, Move the inchworm using the first knob. To create an animation loop, click the record "A" button, move the inch for one cycle (in/out) then click record again. To playback the animation click the play "B" button

The Code

The Code below shows how to move the inch worm in a cycle. You may need to adjust the 2 servo positions to different numbers to get the ideal movement.

https://makecode.microbit.org/S42308-02238-15804-13710

Code Breakdown

  1. On Start, we do a small move to test that it moves.
  2. In the Forever loop, we move between 2 positions with a 1-second delay (1000ms)
  3. Try changing the pause and servo positions to see how it changes the worm’s movement