Forgot your password?

Don't have an account?

Create an account


COMPONENTS NEEDED: can be purchased as a project specific set from the E-STORE HERE .

NOTE that the Microbit and Motorboard are sold separately or can be also purchased as SPARES.

The list of components is:
From K1: K1-M1(x2), K1-G10(x4), K1-G30(x2), K1-G60(x4), K1-S2(x4), K1-S3(x2), K1-TS(x4), K1-WB(x500mm), K1-WR(x500mm), K1-F8(x10), K1-F12(x16), K1-NT(x9), K1-WSR(x2)
From K2: K2-MB(x1), K2-56020(x1)
From K3: K3-PCON(x2), K3-NCON(x2), K3-DCON(x4)


  • Can be operated by either programming its movements (no mobile device required) or remotely through bluetooth and the use of an ANDROID device (4.4 or higher). Both codes CAN BE DOWNLOADED HERE.
  • It employs 6 x AA batteries
  • CODY weights 580g and travels at a speed of 150 mm/s (…not bad considering how heavy it is!).
  • Claws are sprung through the use of a 3D Printed spiral spring design


CODY has two toothed wheels moved each by a motor through a series of gears. Each motor makes its corresponding wheel spin forward or backward and is independently controlled from the other wheel. When straight motion is desired, both wheels are set to spin in the same direction. When turning is needed, one wheel spins in opposite direction to the other (also achieved if one wheel is stationary while the other turns). The Microbit acts as the controller of the motors (see DIAGRAM). It stores commands given by the user and then executes a sequence of orders that put CODY into motion. Alternatively, the user can remote-control CODY by using a mobile device in which case the Microbit receives and processes the commands to the motors in real time.


The overall procedure to program CODY is best described in this flow diagram. The user runs through a sequence in which values for: Forward (F), Backward (B), Right (R ) and Left (L) motion (in order) are input into the Microbit and stored in the form of units. These units are units of TIME. Input is done by using buttons A and B of the Microbit and the LED matrix. The user can go through as many cycles of F,B,R,L input as needed to reach any desired configuration of motion. At the end of each cycle, Microbit asks if the program is ready to go (flashing “G”) at which point the user can accept (“Y”) or start an additional cycle (“N”). Once “Go” is accepted, the Microbit begins a countdown of 5 seconds and then executes each direction by turning on the motors for a period of time equal to the units stored in each step. For Forward and Backward motion each time unit = 1s. For Right or Left turns each time unit = 150ms (millisecond) because the motors do not need to be on much time to change the direction of CODY (turns really fast!). A full 25 units (all LEDs on) will result in CODY doing a 360° turn. In the LEARN section you can see how to tweak these values and tune the control to your own preferences.


A – decreases the number of units to be stored for each direction (-). Once at the end of each cycle, brings the NO (“N”) option to refuse ending of inputs and therefore to begin a new input cycle.

B – Increases the number of units to be stored for each direction (+). Once at the end of each cycle, brings the YES (“Y”) option to accept ending of inputs and execute theprogram.

A + B (pressed at the same time) – is used as an “enter” button to confirm ending of each step. Use at the end of the cycle to confirm program execution (after “Y”) or to begin an additional input cycle (after “N”).


In order to make CODY follow this trajectory (FWD 7s, LEFT 70deg;, RIGHT 70°, FWD 2s) you need to go through 3 cycles (giving zero units to some directions). This is the SEQUENCE. You will need to:
1. Press A + B to start, you’ll see the “F” letter on the LED Matrix
2. Press B a number of times until 7 LEDS are lighted in the Microbit display. If you’ve gone too far, press A to decrease the units back to 7.
3. Press A + B to confirm
4. The Back “B” direction is next up. Press A+B to skip through with zero units input. Repeat for Right “R”.
5. At the “L” direction, press B 5x times to see 5 LEDS on in the LED Matrix. Confirm with A+B
6. The flashing “Go” question now appears. Use button A to flash the “N” option and confirm by pressing A+B. This will initiate a new cycle.
7. Repeat a procedure similar to steps 2 through 6 to input the units in the Right “R” direction and the Forward “F” direction (total of 3 cycles).
8. At the flashing G, use B to enter the “YES” option and confirm by pressing A + B
9. The countdown sequence begins. Place CODY over the surface where it will run (hurry you only have 5s!).
10. If you miss any of the inputs at any time (or you find a mixed-up sequence), press the RESET BUTTON at the back of the Microbit to start over.

NOTE: after use take the Microbit out of the Driver Board 5620, or else you will drain your batteries because of the “forever” loop (refer to the LEARN section).


If you don’t feel like programming CODY, you can control it using an android device (version 4.4 or higher) by using the Microbit Blue App  and the “Cody_remote_control.hex” file. Refer to this PICTURE to understand the controls on the PAD. (NOTE: this step assumes you’re familiar with the procedure to link via bluetooth the Microbit to your mobile device. See the Datasheet of Microbit)


CODY is formed by 4 different modules, each with a specific function:

POWER: the source that powers CODY consists of the parallel combination of two packs of 3 x AA batteries each supplying 4.5v (total of 6 x AA). Within each pack, the 3 batteries are connected in series to add up to 4.5v. Then, the two packs connect in parallel to supply double the current. This DIAGRAM illustrates how. In project WHEELER we learned that a lot of power is lost to friction due to irregularities from the 3D Printing of the components. In order to keep CODY moving, more current needed to be supplied to the motors. Note that power is distributed to both the motors and the Microbit through Driver Board 5620 (batteries connected directly to the board).

TRACTION: is done through large toothed wheels. These not only drive CODY, but are the supporting elements of the complete structure. The wheels need to be caged within two panels that have a set of built-in rollers to connect on to the wheels. The rest of the structure (Power Base) attaches to the panels. When the wheels move, they push CODY through the panels. The use of rubber O-Rings is to increase friction, hence traction. The wheel must be kept from wobbling to ensure continuous meshing with the gear that drives it. This is done by supporting it at three locations: two sets of rollers at the bottom, and the gears of the gearbox at the top acting as physical stops like shown in this PICTURE.

GEARBOX due to the heavy weight of CODY (batteries included) a large torque is required to break the inertia. This can only be achieved if the output of the motors is reduced through a series of gears (ratio: 1:12, torque = The output gear K1-G30 connects to the wheel. The gearboxes attach to the struts through a dovetail, a nut and a screw that pull the gearbox output gear against the teeth of the wheel. The screw can be adjusted to guarantee that no jump between teeth occurs (ratchet sound) and transmission isn’t lost. The gearbox shoulders have small leaf springs that compress against the strut and keep the screw/nut combination loaded (anti-vibration). See this PICTURE

ARMS: are formed by four links – a fork, two arm extensions and a clamp set. The arms connect to the Power Base by means of a spherical joint whose stiffness can be controlled by the tightening of a screw. The arm extensions have snap-type joints and the clamps are spring-closed by the provision of a helicoidal spring at the base of one of the clamp halves.


NOTE: To complete this project, you must be familiar with the Microbit K2-MB and Driver Board K2-5620 operation and procedures (including .hex file loading and Bluetooth pairing). Refer to the Product Datasheets under “Additional Information” HERE

1. Begin by DOWNLOADING HERE the codes for Microbit. If you want to program Microbit directly, load code CODY.hex into your Microbit. If you want to remote-control it, load CODY_REMOTE_CONTROL.hex.
2. Print the Drawing for this Project
3. Make the wires according to the DIAGRAM
4. Follow the video below (also available on LAYKANICS’ Youtube Channel):


Coming up with a programming sequence for a micro-controller like Microbit requires a few coding hints that we would like to share here. The advantage of coding a micro-controller (like Microbit, Arduino or Raspberry Pi) as opposed to running a linear code in a computer, is that microcontrollers are guided by “Events”. Also variables are global, which means that their value can be modified and used by the different routines triggered in every Event. For visual ease, all descriptions within this section imply the use of JavaScript Block Editor as the chosen programming language.

The CODY.hex code allows to collect external input, store it and then run a sequence of procedures based on such inputs. The program is therefore split into an INPUT block and an EXECUTION block. As shown by this DIAGRAM after all operations in the INPUT block are done, a countdown sequence is started just ahead of the EXECUTION block. The specific purpose of the input block is to gather a sequence of time units from the user and classify them into the correct direction variables in the correct order of execution. Most of the Events are invoked in here. The EXECUTION block simply repeats a loop of fixed instructions which parameters are read from the stored values in the previous block. As we will see, Events are dependent on the value of “switch variables”.

The variables used in CODY.hex are described below:

GO = is the switch to begin the execution of the Motors. Values are 1 (on) or 0 (off)
Cycle = serves as a counter of the number of input cycles chosen by the user.
Direction = a counter of the direction for which the user is inputting data .Values are 0,1,2,3 & 4. (F,B,R,L or GO)
TU = value of Time Units provided by the user. Value goes from 0 to 25.
timer1 = multiplier in ms (miliseconds) of time units for the FWD and BCK directions.
Timer2 = multiplier in ms (miliseconds) of time units for the RGT and LFT turns.

DIR = an array storing string values to indicate the direction at which units are being input.
FWD, BCK, RGT, LFT = arrays of numeric values storing the time units for the Forward, Backward, Right and Left corresponding directions.

DECISION = indicates whether the user has decided to end the input sequence (“Y”) or still wants to keep inputting Time Units (“N”). Values are “true” or “false”.
Banner = used to turn ON/OFF the flashing sequences at the end of each input cycle.

Because switch and cycle variables change their value along the execution of the code, it is important that at the start of the program, all variables are initialized to their default state. For that we use the block START

To make CODY.hex code, we need to understand 3 key elements: Arrays, Events and the “forever” Loop of Microbit.


Arrays in Microbit are one dimensional (1D). This means they are lists of stored values as opposed to matrices (2D). To either store or retrieve a value from an array, it’s important to know the name of the array (list) and the position (index) where the value is stored/retrieved. Indexes begin at 0 and not 1. In CODY.hex, 4 arrays are used for directions FWD, BCK, RGT and LFT. They are extremely useful because they allow the classification of the inputs from the user. Each position within the array corresponds to a cycle of user inputs. This FIGURE illustrates the concept. Notice how the value of the global variable “cycle” is used as an index to enter each array’s registry.

Arrays in Microbit are also dynamic, which means that the lists can get larger as we keep adding values to a new indexed position (so technically, the user can input an indefinite amount of command cycles). In other coding languages, arrays are fixed which means their size needs to be declared at the beginning of the program and never changed afterwards. To create an array, store a value and access a value off from it, THESE BLOCKS are used.


You can execute certain pieces of code after (and only after) an event triggers them. Examples of events are the pressing of an external button like A, B or both. Other events can be inputs from sensors connected to the pins of Microbit. Events can be made dependable on other events too i.e. certain actions within Event B are performed only if Event A happened right before. This is done by assigning values to variables shared between them. It is useful to think of these variables as “switches”: if Event A happens, turn a switch ON (give the variable a value = 1). If Event C happens, turn OFF such switch (variable value = 0). Then when Event B happens, check the status of the switch: if it’s ON, do certain tasks. If it’s OFF do certain others…

In this BLOCK of code, we take a look at the actions triggered after button B is pressed. The immediate action is to increase the value of TU (time units) by 1. Then depending on the value of “direction” the value of TU is stored in its corresponding direction array (FWD, BCK, RGT or LFT). If however, the value of direction is 4 (indicating the user is at the end of an input cycle) the function of B is different. It will display the letter “Y” and turn the “Decision” and the “banner” switch ON (Decision = “true”, banner = “true”).

NOTE: notice the difference between the input block “On Button B Pressed” with the block “Button B is Pressed”. The former runs a series of commands when B is pressed while the latter only checks if B is pressed (returning true if it is and false if not).

A similar case is that seen in the pressing of A+B. When this happens, 3 actions need to be completed: i) to increase “direction” (so that user navigates on to the next direction input) , ii) To flash the letter “G” on the Microbit display at the end of a cycle and iii) To trigger the EXECUTION block if “Y” is selected, or to increase to a new input cycle if “N” is selected.

THE “forever” LOOP

The forever loop is a useful instruction which requires careful understanding. This loop constantly runs in the back of Microbit, scanning for the fulfilment of any conditions specified inside it. It must be used carefully because any operations inside this loop not requiring a constant update will result in a waste of energy (and drainage of the batteries). In our case, the operations within are only executed if the “GO” variable is set to 1. This loop will run for the total number of input cycles, a sequence in which it will turn the motors of CODY ON for each direction by the amount of time units specified. Turning of the motors is done by the “digital write” block command. CODY’s left motor is connected to pins P16,P0 and the right motor to pins P12,P8. Assigning a value of 1 to a pin means connecting the positive terminal of the voltage source to it. Assigning a value of 0 means the negative. By inverting the polarity (assignation of 1 and 0’s) it is possible to reverse the rotation of the motor. Finally, notice how the duration of the ON time is controlled by pausing the program at the end of each cycle by either 1s (FWD, BCK motion) or 150 ms (RGT or LFT turns). When the loop completes for the total amount of cycles, the block command “RESET” is used to reset all variables to their original state and get the sequence ready for a new set of inputs.


You have partial access to this project. To get full access signup as a member