Understanding the Number Crumb

How the Number Crumb Works

Number02

The Number Crumb is designed to provide a simple display output for your Crumble. At this time, there is no native display for the Crumble and you have to give indications via the 4 outputs on the Crumble – perhaps lighting LEDs or sounding a buzzer.

The Number Crumb, however, is very different. There is a microprocessor on the Crumb which interprets the speed (PWM) information that you send to the motor on the Crumble.

 

Purchase Number Crumb here

 

Connecting the Number Crumb

Number06

  • Connect power to the Number Crumb. The photo above shows Red for +ve and Black for -ve
  • Then connect the motor outputs (either Motor 1 or Motor 2, it doesn’t matter which). Ensure that you connect the positive terminals together and the negative terminals together
  • It doesn’t harm anything if you swap them over, but the Number Crumb with show negative numbers instead of positive, and vice versa

 

Programming the Number Crumb

To set a value on the Number Crumb, simply set the number you want into the “Motor Forward at nn %” block. Change nn to the number you want.

For example, the program above uses the variable x and starts at -30, then counts up to +100

The program below takes the input from an analog input (such as the Slider Crumb, Dial Crumb, or Light Sensor Crumb) and displays a value on the Number Crumb

 

Number Crumb Firmware

The Number Crumb has an ATMega328P on the PCB (under the display) which is configured as an Arduino Uno complete with bootloader. So you can reprogram the firmware to do whatever you want to do.

It has 2 digital I/O pins (D2 and D13) and then 10 pins are connected to the display via resistors.

There are 3 versions of the Number Crumb firmware in the field:

  1. Was released only for prototype Number Crumbs. This goes straight into number display mode when powered up
  2. Later prototypes and the first few production Number Crumbs had version 2. This displays “02” for a couple of seconds when powered up
  3. Currently shipping is version 3. This displays ” 3″ for a couple of seconds when powered up.

The changes between the versions are mostly to do with stability of number display

  1. The input signals from the Crumble, together with the resolution of the onboard counter leads to variations in the number displayed which was not always the same as the number input into the Crumble’s motor
  2. Version 2 made big changes to this accuracy, but still had some numbers that were difficult to display reliably. In addition, it was quite slow reacting to new numbers which meant that it was not able to keep up with the counting program above. There was also a lot of flicker for numbers -100, 0 and +100
  3. The algorithm for counting has been improved so the resolution is better and the averaging and display algorithms have been more tightly integrated so that the flashing/flickering disappears. Leading zeros have been suppressed, which allows a minus sign to be used for numbers -1 to -9 instead of the dots.

 

The software essentially times the edges of the motor drive signal. PWM (Pulse Width Modulation) sends a pulse at a fixed frequency and varies the width of the pulse to increase or decrease the speed of the motor. The Number Crumb accurately times the edges and can work out from that what number was set in the motor control block of the software. Version 1 or the firmware would work with most PWM drivers, but version 2 and 3 are increasingly tuned to work very closely with the Crumble PWM and would probably give inconsistent or nonsensical values with other PWM drivers.

 

Programming the Number Crumb

There are six header holes on the Number Crumb that allow you to directly plug in a suitable CP2102 and reprogram the Crumb using the Arduino IDE. Set your board type to Uno and ensure you select the CP2102 as your port/device.

If you have firmware version before 3 and want to upgrade it, you can either do it yourself (contact us for the program) or send it back to us and we will reprogram it for you.

 

 

Assembling Pi2Go

Assembling Pi2Go

pi2go_01a

Pi2Go is the pre-soldered big brother of the popular Pi2Go-Lite kit. Assembly is simply a matter of screwing together and plugging connectors.

Overview of Steps

  1. Fit the front caster and line following assembly
  2. Fit the mounting pillars for your chosen Raspberry Pi
  3. Attach the motors
  4. Fit the Raspberry Pi
  5. Fit the battery box

 

Step 1 – Fit the Front Caster and Line Follower Assembly

Step01

You will need the M3 screws, 27mm pillars, ball caster and 9-way extended header and the line follower PCBA

Step02

Fit the 2 pillars to the front of the Pi2Go using 2 of the M3 screws

Step03

Carefully push in the 9-way header, then attach the line follower PCBA

<photo missing>

Use the remaining 2 screws to attach the ball caster. If there is a bit of slack in its position, ensure that it doesn’t touch the pins of the connector

 

Step 2 – Fit the Mounting Pillars for Raspberry Pi

For the older Raspberry Pi models with a 26-pin GPIO connector, you will need to fit 2 pillars. For the A+, B+ and RPi 2B you should fit 4 pillars

Step04

Fitting the pillars is a 2 step process: 1) fit the small 5mm pillars, 2) screw in the 16mm pillars.

Step05

The photo above shows the 5mm pillars in the mounting positions for A+, B+ and RPi 2B models

Use the very small 4mm screws to attach all the pillars. Note that the holes under the motors have been countersunk to allow the motors to sit flat onto the PCBA

Step06

The photo above shows the 16mm pillars added for the correct height (A+, B+, RPi 2B)

Step06a

The photo above shows the 2 pillars in place ready for the Model A or Model B

 

Step 3 – Attach the Motors

Step07

For this you will need 25mm screws, nuts and the motor mounts

Step08

Push the screws through the outer motor mount, then the motor, then the inner motor mount and attach to the nuts

Step09

 

Step 4 – Fit the Raspberry Pi

Step10

Using the extended header (in the bag with the battery box), connect the Pi onto the Pi2Go PCBA.

NB. Ensure that the mounting holes line up with the pillars! If they don’t then the Pi is not fitted correctly and may be damaged.

The above photo shows the RPi 2B in place. The A+ and B+ fit the same way.

Step10a

This photo (above) shows a Model B

 

Step 5 – Fit the Battery Holder

Step11

Use the 5mm pillars to attach the Raspberry Pi firmly to the mounting pillars. Use 2 or 4 pillars depending on your model of Pi (RPi 2B shown above)

For the Model A and Model B, you can now screw the battery holder directly to the 2 supporting 5mm pillars

Step12

For the A+, B+ and RPi 2B you will need to fix the support plates in place first

Step13

Ensure the one at the front has the threaded insert on the left of the Pi2Go and the one at the rear on the right. Also ensure that the wide parts of the mounting holes are at the top so that they can accept the heads of the screws.

Step15

Finally, screw in the battery holder using 2 of the very small 4mm screws

pi2go_01a

Now you can add batteries, software and enjoy!

Crumbs for Crumble Controller

Crumbs – Addon Components for your Crumble Controller

AllCrumbs01a

Purchase the Crumbs Here

Also check out our Crumble Starter Guide

Download a PDF of this guide complete with Code examples from here.

 Style of Crumb

  • Analog input: These Crumbs are coloured Yellow and provide a continuously varying input for the Crumble which can be read and used with the A. B, C and D connections
    • Slider
    • Dial
    • Light Sensor
    • Motion Sensor
  • Digital input: Blue. These Crumbs provide a simple On/Off input to the Crumble controller. Again would be used with the A, B, C and D connections
    • Button
    • Magnetic Hall Effect Switch (previously Reed Switch)
    • Proximity Sensor
    • Dual Capacitive Touch Sensor
    • PIR sensor
  • Analog output: Red. These Crumbs allow the Crumble to continuously vary the device: speed of the motor, brightness of the Sparkles, Number shown on the display, position of the servo
    • Motor
    • Number Display
    • Servo
  • Digital output: Black. These Crumbs can be set either On or Off by the Crumble
    • Traffic Lights
    • Buzzer

 

Using Crumbs

Most Crumbs require a 5V Power and Ground connection to be made before they work fully. Sometimes this is to power the on-board electronics and sometimes, simply to ensure that the indicator LED works as expected.

The Crumbs are designed so that the Power and Ground (5V and 0V) can be applied to either the left or the right side. It doesn’t matter which you use. You can then use the opposite side to take the power to any other Crumb that you are using, as shown in the picture below:

ServoSlider03

 

We recommend using short crocodile clips to join the Crumbs together as it reduces the amount of wiring considerably and the whole experiment becomes clearer to understand

Although the Crumbs are generally protected against connecting power on the wrong way round, or onto the wrong pin, it is recommended that you use some sort of colour coding so that the children can see how the positive power flows (using Red wires) or the negative with Black wires. You can use Green as an alternative to Black if you run out, but Yellow, White and Green are good colours to use for the general purpose inputs/outputs or motor outputs.

Where there are 2 crocodile lead connection pads next to each other on a Crumb (or indeed the Crumble) the two small holes that form part of the pads are designed to be exactly 5mm apart so that a standard 2-pin 5mm screw terminal can be soldered on. This allows you to use standard wires of exactly the correct length that are simply screwed into the terminal blocks as shown below:

termBlock02

 

Analog Input Crumbs (Yellow)

SLIDER

Slider05a

This requires Power and Ground to be connected and the output connected to A, B, C or D. The analog value read will be in the range 0 to 255, though in practice the power is not at 5V so the top end number will be lower

Sliding the slider to the left will give a value of 0, to the right will give the maximum number (probably 200 to 255)

The program below reads the value from the Slider Crumb connected to Input A, into the variable X. You can see the value being displayed on the left: x = 226

 

DIAL

Dial03a

This requires Power and Ground to be connected and the output connected to A, B, C or D. The analog value read will be in the range 0 to 255, though in practice the power is not at 5V so the top end number will be lower

Turning the Dial anti-clockwise will give a value of 0, turning it clockwise will give the maximum number (probably 200 to 255)

The program below uses the value read from the Dial Crumb connected to Input A to set the speed of Motor 1. Note that the maximum value for motor speed is 100, so we divide the value from the Dial Crumb by 3 to be sure it fits into this range.

 

LUX/LIGHT

lux01

This requires Power and Ground to be connected and the output connected to A, B, C or D. The analog value read will be in the range 0 to 255, with 0 being total darkness and 255 being extremely bright.

Covering the light sensor completely will reduce to the minimum value and shining a bright light on it will achieve the maximum

The program below uses the value from the Light Sensor Crumb to set the brightness of the Red element of Sparkle 0. So in a dark room, the Sparkle won’t be as bright as in a bright room.

 

MOTION

Motion01a

This requires Power and Ground to be connected and the outputs connected to A, B, C or D. The analog values read will be in the range 0 to approximately 125

You can tilt the board in X, Y or Z axis and the appropriate output will change its value. Maybe you can use this to steer a robot?

The program below extends the program for the Light Sensor Crumb by using all three axes of the Motion Sensor to set the three colour elements (Red, Green and Blue) of the Sparkle. So twisting and turning the Motion Crumb will change the brightness and colour of the Sparkle.

 

Digital Input Crumbs (Blue)

BUTTON

Button02

This requires the Power to be connected in order for the button to operate. In addition, you should connect the Ground so that the indicator LED operates.

When the button is not pressed, the output is 0 (Low) and the indicator is Off

When the button is pressed, the output is 1 (High) and the indicator is On

The program below starts Motor 1 running when the button is pressed and stops it when the button is released:

 

MAGNETIC HALL EFFECT SWITCH

Hall02a

This requires the Power to be connected in order for the Hall Effect switch to operate. In addition, you should connect the Ground so that the indicator LED operates.

When a magnet is not present, the output is Low)and the indicator is Off

When a magnet (eg. a fridge magnet) is brought towards the sensor, the output is High and the indicator is On

The program below counts the number of pulses received from the Magnetic Switch Crumb. Maybe the magnet is on a wheel spinning round past the Crumb and this is counting the revolutions of the wheel?

 

PROXIMITY SWITCH

Prox05

This requires the Power and Ground to be connected in order to operate.

When there is no object near the sensor, the output is 0 (Low) and the indicator is Off

When an object (eg. a hand) is brought above the sensor, the output is 1 (High) and the indicator is On

The sensitivity is set such that a finger or hand would trigger it within about 2 to 3 cm. A reflective white card would be about 10cm

The following program waits for the trigger from the Proximity Crumb connected to input A then switches on the Buzzer connected to output B for 1 second

 

CAPACITIVE TOUCH SWITCH

Touch06

This requires the Power and Ground to be connected in order to operate.

When nothing is touching the sensor pads, the outputs are 0 (Low) and the indicator is Off

When a finger touches the sensor, the output is 1 (High) and the indicator is On

You can attach other objects such as pieces of fruit to the external inputs – give the system a minute or so to settle down (or remove and replace the power to reset it) after you change the connections

The program below uses the 2 outputs from the Touch Sensor Crumb connected to Inputs A and B to control 2 motors and steer a robot left or right

 

PIR (PASSIVE INFRARED) SENSOR

PIR03

This requires the Power and Ground to be connected in order to operate.

When nothing moving is detected, the outputs are 0 (Low) and the indicator is Off

When movement is detected , the output is 1 (High) and the indicator is On

The program below flashes lights (on Output B) and Sounds a Buzzer (on Output C) when movement is detected

 

Digital Output Crumbs (Black)

TRAFFIC LIGHTS

traffic01a

This requires the Ground to be connected and the Red, Amber and Green connections made to your choice of A, B, C or D on the Crumble

Setting the appropriate output on the Crumble to Hi will light the LED on the Crumb as well as the related LED on the Pi-Stop if one is plugged in

The following program runs a basic traffic light sequence with Red connected to A, Amber to B and Green to C