CrumbleBot Mk2

CrumbleBot2 – Assembling and Coding

crumbot2_02

Purchase CrumbleBot Mk2 here

 

CrumbleBot Mk1

If you are looking for information on the previous versions, please check the older blog entry here

 

Updated Features

  • 8 Addressable RGB LEDs (‘Sparkles’)
  • Easy to use buzzer
  • 2 push button switches
  • Jumpers with handles, instead of crocodile/alligator clips
  • “Wire-free”, low-profile battery holder (no USB connectors or wires to get broken)
  • Modified motor mounting positions to reduce dust ingress into the gearbox
  • Improved, smooth-running, front caster
  • Powered front accessory connector
  • Additional mounting holes near rear to allow fitting of a “second deck”

 

Assembling CrumbleBot Mk2

Click any photo to enlarge

Step 1 – Check you have the correct Parts

Step00

You should have the following items in the box:

  • CrumbleBot Mk2 main circuit board
  • 2 x Black Wheels
  • Battery Holder PCB
  • 10 x small 7mm pillars to mount Crumble (not required for version 2.1 as pillars are pre-fitted)
  • 2 x larger 12mm pillars to mount battery holder
  • Caster ball and housing
  • 2 x M2, 6mm screws to attach caster
  • 2 x M2 nuts for caster
  • 10 x 4mm M3 screws (v2.0 has 20 x 5mm) to attach Crumble
  • 4 x 8mm countersink head screws to fit battery holder
  • 4 x Yellow (colour may vary) jumpers with “handle” to select function of each connection
  • 4 x coloured 12cm jumper leads for when the little yellow jumpers can’t reach

 

Step 2 – Fit the Caster

Step01

 

 

Step02

Use the 2 small M2, 6mm screws to pass through the caster underneath the CrumbleBot and fit the nuts on the top of the CrumbleBot mainboard

 

Step 3 – Fit the Crumble mounting Pillars (v2.0 Only)

Step03

NB. V2.1 Has these pillars ready-fitted – skip this step

V2.0: Use 10 of the small 5mm screws to fit the 10 small pillars on the top of the CrumbleBot.

 

Step 4 – Fit the Crumble

Step04

Use the 10 M3, 4mm (for v2.0 use the remaining 10 small 5mm) screws to attach the Crumble to the 10 pillars fitted in Step 3.

 

Step 5 – Fit the Battery Holder Pillars

Step05

Use the 8mm screws to fit the 2 longer 11mm pillars into the holes marked “GND” and “PWR”

 

Step 6 – Fit the Battery Holder

Step06

User the remaining 2 longer 8mm screws to fit the battery holder to the 11mm pillars.

NB. Ensure  the switch and LED are at the rear of the robot

 

Step 7 – Add the batteries and Jumpers

Step07

A good starting point for the jumpers is in the middle two positions on the left side, and the outer two positions on the right side.  This allows use of the line sensors, sparkles and buzzer without changing anything.

 

Step 8 Optional – Add the Ultrasonic Distance Sensor

IMG_1368a

Using the four 6mm screws, screw the two 20mm pillars into the front accessory connectors. Then screw the sensor module onto the top of the the two pillars as shown above.

To connect the sensor to the Crumble, you must use one of the 12cm jumper wires to connect to a GPIO pin. All our examples use GPIO A so wire it as shown in the photo above. Remember to remove the Yellow jumper attached to GPIO A. Now you can use the distance block in the Crumble software, setting both T (Trigger) and E (Echo) to the same pin. A in this case.

 

Your CrumbleBot Mk2 is Finished and ready for Coding!

 

 

 

Coding Your CrumbleBot Mk2

 1. Understanding the Jumpers

The Crumble has 4 general purpose IO (GPIO) connections, labelled A, B, C, D. These are all interchangeable for everything except driving Sparkles, which can only be done using GPIO D.

CrumbleBot Mk2 brings each GPIO connection to 2 positions on a jumper block. The other side of each position is connected to one of the functions of the CrumbleBot. Thus, you can use the little Yellow jumpers to connect from a GPIO to one of the functions on the CrumbleBot2. For instance the top row on the left-side connector block is connected to to GPIO A (on the right of the connector block) and to the left side Light sensor (on the left of the connector block). Fitting a Yellow jumper across the top row will therefore connect the light sensor to GPIO A. If instead you connect the yellow jumper to the next row down, you would be connecting GPIO A to the line sensor. (As an aside, it is possible to connect each GPIO to 2 different signals at the same time – this won’t damage anything but will give unexpected results).

So the default settings for the yellow jumpers will connect the GPIO as follows:

  • A to the left Line sensor
  • B to the Buzzer
  • C to the right Line sensor
  • D to the 8 on-board sparkles

 

2. Driving the Motors

The Crumble has its own motor drivers which are connected directly to the motors on the CrumbleBot. You do not need to make any special connections to make these work. Each Motor is driven independently and you can select the speed (0 to 100) and direction (Forward or Reverse) in your code.

To drive the CrumbleBot2 forward, you would set each motor to the same speed Forward:

And to drive the CrumbleBot in reverse, you could set each motor to the same speed Reverse:

If both motors are going the same speed, but opposite directions, then the CrumbleBot2 will turn on the spot:

If the motors are turning different speeds, then the CrumbleBot2 will drive in an arc

 

3. Flashing the LEDs

The LEDs on the CrumbleBot2 are called “Sparkles” in Crumble-speak. You can easily code them to flash different colours using the colour-picker, or by setting different Red-Green-Blue (RGB) values.

First of all, make sure that GPIO D is connected via a jumper to  “LEDs” – this is the default setting of the yellow jumpers.

This bit of code continuously makes all the LEDs flash Green on and off:

Of course, you can set each Sparkle to different colours and brightnesses – they do not have to be all the same. The following code implements a “Larson Scanner” famous from the KITT car in the Knight Rider show. It’s a bit complicated, but bear with it.

 

4. Following a Line

The CrumbleBot2 has built-in, digital, line following sensors. Make sure that the jumpers are set to connect GPIO A to the left line sensor and GPIO C to the right line sensor. This is the default setting. The following code drives forward until one of the sensors detects a line, then it turns toward the line until the line is not detected any more. This is a very inefficient “way to do it” (algorithm). Can you find a better algorithm for following lines?

You should make the black line out of something that doesn’t reflect light, with the background being a good reflector. Black electrical tape is good and so is printing black lines on a laser printer – here is a good resource for printing line-following tracks.

 

5. Making a Buzz

The CrumbleBot2 contains a little buzzer (small, round and black, underneath the battery holder). This buzzes loudly (quieter if the sticker is left on the top!) when the input is set to Hi.

The default jumper settings have the buzzer connected to GPIO B, so the following code makes an annoying beep every second:

 

6. Acting on Switches

There are 2 switches on CrumbleBot2 SW1 (A) on the left side and SW2 (B) on the right side. You will need to move the jumpers from their default positions to use them. The following code modifies the buzzer code in 5. “Making a Buzz” so that it waits for SW1 (A) to go HI (pressed) then starts the buzzer until SW2 (B) is pressed. You will have to use a 12cm jumper wire to connect GPIO A to the SW1 (A) – not forgetting to remove the yellow jumper. So this should have:

  • 12cm Jumper wire from GPIO A to SW1 (A)
  • Yellow Jumper from GPIO B to BUZZ
  • Yellow Jumper from GPIO D to SW1 (B)

 

7. Following the Light

CrumbleBot2 has 2 light sensitive transistors which produce an analog value from 0 (very dark) to 255 (very bright).

We can use a similar program to the line follower. What we want to do is turn the robot to the side that has the most light. Because the light sensors can vary a lot, we must be careful that we don’t turn the robot every time there is a very slight difference in light levels, otherwise it would spend all its time turning and never move forward much. So we create a guard band in the software and make sure the light levels are sufficiently different before we decide to turn the robot. This is why we compare the X and Y variables and make sure there is a difference of at least 10, before turning.

Connect the yellow jumpers for GPIO A and GPIO C to Light

 

8. Use the Distance Sensor to Follow You around

Using the optional ultrasonic distance sensor, we can make the CrumbleBot2 follow us and stay the same distance away. The following code measures the distance to an object (eg. your feet). If it is too far away then the CrumbleBot2 moves Forward. If it is too close, then it moves in Reverse. This is a simple way to make a robot “friend”

Bit:2:Pi Control Raspberry Pi Addon Boards with your Micro:Bit

Bit:2:Pi Control Raspberry Pi Addon Boards with your Micro:Bit

IMG_1053a

[Click on any image to enlarge]

Purchase >HERE<

Overview

Bit:2:Pi (Pronounced Bit – to – Pie) is a connector and power management system that allows you to plug in a Micro:Bit at one end and a Raspberry Pi addon board (26-pin or 40-pin, HAT, pHAT or other) at the other end.

In between there are some breakout and connection headers that enable you to customise how the two boards are connected.

The power on the board is managed so that:

  1. Any or all power sources can be connected safely at the same time
  2. The Micro:Bit is never used to power the Raspberry Pi HAT (this is true for Bit:2:Pi v1.0 or later)
  3. Power for the HAT is provided either by the micro-USB connector at the HAT end, or by an attached battery holder
  4. The On/Off power switch controls the power to the HAT as well as to the Micro:Bit
  5. The “5V” signal on the HAT connector is actually from the battery or the micro-USB. If using the battery, this is likely to be around 4.5 to 4.8V using alkaline batteries, or 3.6 to 4.0V using rechargeable batteries. Not all HATs will work at these voltages.

To control the Raspberry Pi addon board (shortened to “HAT” from now on), you must write some code for the BBC Micro:Bit:

  • Many HATs are simply setting GPIO pins High or Low and for these you can use any available language easily. Simply set the Micro:Bit pin corresponding to the HAT GPIO pin (as determined by the various jumpers)
  • Some HATs use neopixels (eg. PlayHAT or Unicorn HAT). These require the neopixels to be driven by GPIO18 (physical Pin 12). By default, this is Pin 2 on the Micro:Bit
  • Some HATs require I2C commands (eg. Picon Zero). You can use the standard I2C commands within Micro:Bit to send and receive the necessary data. The default configuration connects the I2C pins
  • Some HATs require SPI connections (eg. various Analog boards using the MCP3008 or similar). Again the SPI pins are connected by default

 

Configuration

The male header block closest to the Micro:Bit (labelled MBit/RPi in v1.0) is where most of the configuration is done.

The MBit side of the header is labelled with the Micro:Bit pin numbers and the RPi side of the jumper is numbered with the GPIO names (Broadcom names)

The Bit:2:Pi is supplied with 13 little black jumpers that connect across from the MBit side to the RPi side. This gives the default settings as follow:

Micro:Bit Pin

GPIO Pin

Physical Pin

0

04

7

1

17

11

2

18

12

8

27

13

12

22

15

16

23

16

5

24

18

11

25

22

13

SCL

5

14

MISO

21

15

MOSI

19

19

SCLK

23

20

SDA

3

If you need to connect something differently, then simply remove the appropriate black jumper(s) and use a short Female-Female dupont wire to connect theMicro:Bit pin(s) to the appropriate Raspberry Pi pins.

 

Example Boards

[this section requires tested boards with example code – contributions welcome]

Some tested working boards are:

 

External Contributors

Several people have written some software for the Micro:Bit to work with Raspberry Pi addon boards using the Bit:2:Pi adaptor. Many thanks go out to these contributors!

 

Michael Rimicans (Twitter @heeedt)

 

Neil Avery (Twitter @veryalien)

 

Les Pounder (Twitter @biglesp)

 

 Mark Atkinson (www.multiwingspan.co.uk)

 

 

Robo:Bit Mk2 Robotics Controller and Buggy for Micro:Bit

Robo:Bit Mk2 Robotics Controller and Buggy for Micro:Bit

IMG_0904a

Looking for Robobit Mk3 ? Then Visit this Page

Robo:Bit Mk2 is a general purpose robotics controller for the BBC Micro:Bit, that also converts easily into a self-contained little buggy.

Purchase Robo:Bit here

Purchase the Robo:Bit Buggy here

Overview

The Robo:Bit controller has the following features

  • Ready assembled (NB. headers for the underside are not fitted unless the complete buggy is purchased, but they are included in case you want to add these)
  • Edge connector for easy attachment of your BBC Micro:Bit
  • Dual motor driver with full control of each motor for both direction and speed (uses DRV8833)
  • 3.3V Regulator to power the BBC Micro:Bit
  • Power On/Off switch with LED indicator
  • Mounting holes for either 3-cell or 4-cell AA battery holder
  • Front interface for ultrasonic distance sensor (simply push-fit an HC-SR04, or solder for added security) [NB. You can also plug the McRoboFace into here directly and it will work as required!]
  • 7 of the Micro:Bit pins are broken out to a header with GVS connections (Ground, Volts, Signal) for ease of connecting external devices and sensors
  • I2C signals broken out in case you want to add more complex peripherals

Warning: The line follower sensors share the same pins as the buttons. Depending what language you are using, when the Micro:Bit is started or reset it will check the 2 buttons and start pairing if they are both pressed. With the Robobit, this translates to both line follower sensors getting reflections. You can stop it happening by lifting it off the surface before switching on, or of course disconnecting one or both of the sensors

Software & Programming

Robo:Bit uses the same connections for the motors as Bit:Bot, so most of the software will continue to work.

{{OLD INFO:  In particular, the BitBot package for Microsoft PXT works fine (but you cannot use the sonar or neopixel blocks from this package as they use the wrong pins for RoboBit). To use this package, load up microsoft PXT for Micro:Bit from here, then go to Advanced or Tools and select Add package. Then search for “BitBot”.}}

Please use the currently Beta Robobit package. for Microsoft Makecode (aka PXT). Select Advanced, then “Add Package”. Into the search bar, put this URL: https://github.com/4tronix/Robobit and the Package will show as an Orange Taxi icon on the left.

The Pins are used as follows:

  • Left Motor: Pin 0 (PWM) and Pin 8 (Direction)
  • Right Motor: Pin 1 (PWM) and Pin 12 (Direction)
  • Ultrasonic detector: Pin 13 (alternatively neopixel output pin)
  • Left line sensor: Pin 11 (bottom 3×2 header)
  • Right Line sensor: Pin 5 (bottom 3×2 header)

For each motor there is a 2-pin screw terminal and a 2-pin male header. If fitted, there is also a 2-pin JST header underneath the board (used in the buggy). All three connectors for each motor are connected together.

Some sample PXT programs. Click on them to download the compressed HEX files. You can install them into your Makecode environment by selecting Projects and “Import File” and browsing to the HEX file on your PC

 

Motor Test

Simply moves forward and backwards to check the motors are connected OK

 

Sonar test with the Ultrasonic

Simply displays the distance measurement on the MicroBit

 

FollowMe Sonar Test

The Robot will move to within 15-20cms of an obstacle and then move forwards or backwards to stay within this range

 

Control your Robobit Buggy from another Microbit

The same code can be loaded into each microbit. The one on the buggy will receive the commands from the second one – in your hand. To load this code, copy the compressed HEX file from here onto your PC, and uncompress it. Then, from Makecode, select Project and browse to find where you put the HEX file. Install this onto both the controller and the buggy. Here is the complete code visually:

Assembling the Robo:Bit Buggy

STOP: Before continuing, please check which version of RoboBit you have as the assembly instructions differ. The version number is written on the underside of the PCB as v1.0 or v1.1 or v2.0

Note that this buggy can be purchased in modular form. You can use your own motors and wheels if you already have them – the little yellow motors are pretty ubiquitous, so many schools and hobbyists will already have them. This guide to assembly assumes you have purchased the complete kit, including the ready-soldered wires on the motors – if not you would have to connect the wires to the motors and use the screw terminals on the top of the board.

Click on the image below for a quick assembly GIF

IMG_0898a

 

Step 1. Check you have all the Parts

NB. These are different for each Version. Check the PCB version (written on the underside of the PCB) before continuing

IMG_1474a

Version 2.0

  • Robo:Bit v2.0
  • Battery Holder with no wires, mounted on a PCB
  • Yellow gear motors x 2 with JST connectors
  • 1 caster (plastic ball plus plastic housing)
  • 25mm brass female-female pillars x 2
  • 11mm brass female-female pillars x 2
  • 20mm brass female-female pillar (M2.5) x 2
  • 30mm brass female-female pillar (M3) with holes x 2
  • 6mm M3 screws x 2
  • 30mm M2.5 screws x 4
  • 6mm M2.5 screws (pan head) x 6
  • 8mm M2.5 screws (CSK) x 2

 

step01

Version 1.1

  • Robo:Bit v1.1
  • Battery Holder
  • Yellow gear motors x 2
  • 1 caster (plastic ball plus plastic housing)
  • 10mm black nylon male-female pillars x 2
  • 15mm black nylon female-female pillars x 2
  • 20mm brass female-female pillar (M2.5) x 2
  • 30mm brass female-female pillar (M3) with fitted attachments x 2
  • 11mm brass female-female pillars x 2
  • 25mm M3 screws x 4
  • 6mm M2.5 screws (pan head) x 6
  • 8mm M2.5 screws (CSK) x 2
  • 4-cell AA battery holder

 

Version 1.0

  • Robo:Bit v1.0
  • Battery Holder
  • Yellow gear motors x 2
  • 1 caster (metal ball plus plastic housing)
  • 10mm black nylon male-female pillars x 2
  • 15mm black nylon female-female pillars x 2
  • 25mm black nylon female-female pillar (M3)
  • 25mm brass female-female pillar (M3) with fitted attachments
  • 11mm brass female-female pillars x 2
  • 25mm M3 screws x 4
  • 6mm M2.5 screws (pan head) x 8 (or x10 – see step 6)
  • 8mm M2.5 screws (CSK) x 6 (or x4 – see step 6)
  • M2.5 nuts x 4
  • 4-cell AA battery holder

 

For v1.0 assembly, go to Step 2A

For v1.1 assembly, go to Step 2B

Step 2 (v2) Make the Motor Assembly v2

IMG_1475a

You will need the two 30mm brass pillars with holes, two 20mm brass pillars and 4 long (30mm) M2.5 screws

IMG_1476a

Push two of the screws through the holes in one of the motors and through the holes in the 30mm pillar as shown. Take care that the axle of the motor is on the outside and the pillar is on the inside. Also ensure that the motor wires do not get trapped under the pillar.

IMG_1477a

Screw the 20mm pillars on tightly as shown above.

IMG_1478a

Then fit the remaining 2 long screws through the second motor, ensuring the orientation is correct as shown above

IMG_1479a

Finally, screw the second motor firmly to the 20mm pillars. You have now completed the motor mount assembly. Now skip to Step 3

Step 2B (v1.1). Make the Motor Assembly v1.1

STP51

You will need the 2 brass bracket assemblies, 20mm female-female pillars (x2) and 30mm M2.5 screws (x4)

STP52

Push the 30mm screws through the motors as shown, with the screw threads protruding through the side with wires

STP53

Slide the bracket assemblies onto the ends of the 30mm screws as shown above. Ensure that:
1. The vertical 30mm pillar is away from where the wires exit the front of the motor
2. The wires go over the vertical pillars, not under them
3. The short spacers stick out on one side – this is the side that fits against the motor – do not try to fit them the other way around

STP54

Screw the two 20mm female-female brass pillars onto one motor as shown above

STP55

Finally, add the second motor and screw tightly together

 

Step 3. Prepare the Robo:Bit for Fitting

STP56

You will need the Robo:Bot circuit board, 6mm M2.5 screws (x2) and 11mm pillars (x2)

STP57

Fit the pillars in the positions shown above and screw tightly together

 

Step 4: Fit the Robo:Bit to the Motor Assembly

STP58

You will need the motor assembly from Step2, the Robo:Bit assembly from Step3 and M3 6mm screws (x2)

STP59

Pass the M3 6mm screws through the Robo:Bit board and into the top of the pillars in the brass bracket assemblies as shown above

STP60

Plug the two cables in making sure the left motor is plugged into the left socket and the right motor is plugged into the right socket

STP61

The photo above shows the gap between the motors and the Robo:Bit board

Now skip to Step 5

 

 

Step 2A. Make the Motor Assembly v1.0

step03

Place the motors into position as shown above, with the axles facing outwards

Use 2 of the 25mm screws to fit the M3 black nylon 25mm female-female spacer to the bottom holes in the motor

Use the other 2 of the 25mm screws to fit the brass bracket assembly to the top holes, making sure that the connector parts point upwards as shown above

 

Step 3A. Prepare the Robo:Bit for Fitting

step04

Fit 4 of the 8mm M2.5 CSK screws and the 4 nuts to the Robo:Bit as shown above. Pass each screw from the top of the board into a nut on the bottom. Tighten securely.

step06

Using 2 of the 6mm M2.5 pan head screws, fit the 11mm brass pillars in place for the 4-cell battery holder – the outermost two holes – as shown above. Tighten securely

 

Step 4A: Fit the Robo:Bit to the Motor Assembly

step07

Use 2 of the 6mm M2.5 pan-head screws to attach the Robo:Bit to the upwards-facing connectors on the brass bracket assembly as shown above. Tighten securely.

Push the JST plugs from the motors into the sockets underneath the Robo:Bit controller. The wires are short enough to stay tidy.

 

Step 5. Fit the Front Caster

step09

For v1.0 and v1.1, Screw each 10mm black nylon male-female pillar into a 15mm making it into a 25mm female-female pillar.

For v2, use the 25mm brass female-female pillars

Use a 6mm M2.5 pan-head screw to fit each pillar to the front holes on the Robo:Bit

step10

Then use two more 6mm M2.5 pan-head screws to fit the caster housing to the pillars (you will have to remove the metal ball while you do this)

 

Move to Step 6A for v1.0 and v1.1

Step 6 (v2): Fit the Battery Holder

IMG_1492a

You will need the battery holder assembly and the two 8mm countersunk screws

IMG_1493a

Screw the battery holder assembly tightly to the upright pillars, ensuring that the labelling is at the rear of the Robo:Bit as shown above. There is no need for wires as the battery power passes directly through the upright pillars.

 

Step 6A (v1.0 and v1.1): Fit the Battery Holder

step11

Screw the wires into the power terminal. Red to 5V and Black to GND. Wrap the wires tidily out of the way under the battery holder

step12

Use the remaining 2 of the 8mm M2.5 CSK (or 6mm pan head) screws to screw the battery holder to the brass mounting pillars. With some battery holders, the wide countersunk screws don’t fit, so swap them with the 2 smaller pan-head screws used to hold the mounting pillars for the front caster

 

Step 7. Finish off and Go!

step17v1.0 or v1.1 Ultrasonic

Push on the wheels. Be careful to hold the motor as the wheels can be quite stiff to fit, especially the first time

Push in or bolt on the Ultrasonic Sensor (if you have one)

IMG_1498av2 Ultrasonic

Push the BBC Micro:Bit into the edge connector (LED display and buttons upwards)

Program -> Switch On -> Go!

 

Fitting the Line Sensors

Step 8. Check you Have the Parts

step22

  • 30mm black nylon M3 pillars
  • 6mm M3 screws x 4
  • Line follower sensors x 2
  • 10cm GVS cables x 2

 

Step 9. Fit the pillars to the Robo:Bit

step24

Use 2 of the 6mm M3 screws to fit a 30mm black nylon pillar to each front corner of the Robo:Bit board

 

Step 10. Fit the Sensors

step26

Push one of the GVS leads onto each line follower sensor. Make sure you use the colour coding: Brown for Ground (G), Red for volts (V+) and Orange for Signal (S)

Then use the remaining 2 of the 6mm M3 screws to to fit the line sensors to the bottom of each pillar. Use the hole near the centre of the sensor, not the one at the front. The wires should be at the back, as shown above

 

Step 11. Plug the GVS leads into the Connector

step28

Pass the wires around the motor supports and then into the 3×2 male header underneath the Robo:Bit board. Make sure brown goes to Ground (GND), Red to power (3V) and Orange to Signal (SIG)

Also make sure you connect the left one to the left set of pins, and the right one to the right set of pins. It is VERY confusing when writing programs with these reversed (trust me, I know this)

 

Step 12. Trim the Sensors

Each sensor has a little preset potentiometer (pot) which can be turned to define the position at which it detects a line.

Turn the pot until the red LED on the sensor _just_ turns off. It is then at its most sensitive.

When using 3V, these sensors are not as sensitive. With a little ingenuity (and a different cable) you can connect the power line to VCC (the bottom 3 pins on the 8×3 header on the top of the board). This will make the sensors more sensitive.

 

 

Bit:Bot Robot for BBC Micro:Bit

Bit:Bot – The Integrated Robot for BBC Micro:Bit

bb01

Purchase BitBot here

 

A great way to engage young and old kids alike with the BBC micro:bit and all the languages available. Both block-based and text-based languages can support the Bit:Bot

You can also use the Radio or Bluetooth functionality of the Micro:Bit to send and receive commands and date. See a Bluetooth tutorial here

Warning: On versions before v1.2, the line follower sensors share the same pins as the buttons. Depending what language you are using, when the Micro:Bit is started or reset it will check the 2 buttons and start pairing if they are both pressed. With the Bit:Bot, this translates to both line follower sensors getting reflections. You can stop it happening by lifting it off the surface before switching on. On v1.2 the line sensors are disabled for 2 seconds after power on so that the MicroBit doesn’t detect the pairing situation. In addition there is a small switch that allows you to disable the line follower sensors completely, allowing the use of the MicroBit buttons.

 

Features

The Bit:Bot gives you all these features:

  • 2 micro-metal gear motors. Both fully controllable in software, for both speed (0 to 100%) and direction (forward or reverse)
  • Wheels with rubber tyres for maximum grip
  • 12 mini neopixels in 2 sets of 6 along the arms either side. Select any colour for any pixel, produce stunning lighting effects as your Bit:Bot moves around
  • 2 digital line following sensors. Code your own line-following robots and race them to see whose code produces the fastest lap time!
  • 2 analog light sensors (front left and front right) so your Bit:Bot can be programmed to follow a light source such as a torch, or you could code it to go and hide in the darkest place it can find
  • Buzzer, so you can make beeping sounds whenever you want
  • Powered from integrated 3xAA battery holder with on/off switch and blue indicator LED
  • Easily plug your BBC micro:bit in and out using the edge connector
  • Extension port for additional neopixels (such as McRoboFace)
  • Expansion connections at the front for additional sensors (eg. ultrasonic distance sensor, Talon grabber)

 

Assembling

Step 0 – Check you have all the correct parts:

  • 1 caster assembly (either metal ball or plastic ball)
  • 2 x 6mm M2 pan head screws (now already fitted)
  • 2 x M2 nuts (now already fitted)
  • 2 x 12mm brass pillars
  • 4 x 8mm M2.5 countersunk screws
  1. Use the M2 6mm (panhead) screws and nuts to attach the front caster housing, then push the caster ball into the housing
  2. Use the M2.5 6mm panhead and 8mm countersunk screws to fit the battery pack onto the 2 metal pillars: ENSURE the on/off switch is at the rear of the Bit:Bot
  3. Push the wheels on with the smooth side outwards. The axle should come flush with the outside of the wheel and not protrude (or the inside can catch on the motor housing)
  4. Push your BBC micro:bit into the edge connector with the LEDs and switches on the top

Click on any image to enlarge

Step 1 – Fit the Front Caster (already fitted to current models)

Step1

Step2

Step3

Step4

Step5

 

Step 2 – Fit the Battery Holder

At this point you should have 4 screws left. Either 4 x 8mm countersink, or 2 x 6mm panhead and 2 x 8mm countersink.

If you have the 6mm panhead screws, use these to fit the 12mm brass pillars to the Bit:Bot main PCB.

Always use 8mm countersink screws to fit the battery holder to the brass pillars.

Step6

Use either 6mm panhead or 8mm countersink to fit the 12mm brass pillars to the main board (above)

 

Step7

Use the 8mm countersink screws to fit the battery holder to the brass pillars.

 

Step 3 – Fit the Wheels

Step8

Push the wheels on, so that the axle is flush with the outside of the wheel

 

Step 4 – Attach your BBC micro:bit

Step9

 

Know Your Bit:Bot

Above

bb17a

This shows the neopixels (6 on each arm), the 2 light sensors, on/off switch and indicator LED

The buzzer is below the on/off switch and the edge-connector is below the front of the battery holder

 

Below

bb15a

Now you can see the 2 line sensors and the port for neopixel extensions and general purpose expansion connector. Connection labelling is on the underside

 

Programming in Microsoft Makecode

For Makecode block programming, you can use the official BitBot extension. Go to the Advanced tab (or press the cog icon) and select Extensions. Then search for BitBot and select the official package. This will give you a BitBot tab in the toolbar with 4 sub-categories for the Motors, Sensors, LEDs and advanced (…more).

For text-based programming there is micro-python, and I prefer to use this offline using the Mu editor.  It provides a very neat and easy way of interfacing to the micro:bit without all the fuss of dragging and dropping. NOTE: At the time of writing (December 2016), there are problems with Mu when using PWM with neopixels and other things, so it best to use the online micropython editor for now.

The following examples use both of these languages to show code fragments.

Note on examples: We want to show people how the various features can be used. We don’t want to do the coding for you – that is the learning experience you should be taking away from using it. In the following examples, we will give you the tools to use all the features of Bit:Bot but it is up to you to combine them together in your code to make it do something useful. We do give a complete example of line-following – but it is a very basic algorithm and will get confused at T-junctions  and crossings; and it doesn’t use the neopixels.

Download Python examples at the bottom of this page.

Some great tutorials/examples by Mark Atkinson here

Motors

Under the Motors tab there are 5 blocks available as shown:

The first one “drive at speed 600” simply turns both motors at the speed selected between 1023 and -1023. 1023 is full speed forwards and -1023 is full speed backwards. Setting the speed to 0 will stop both motors.

The second one will do the same, but then stop both motors after the time selected.

The next two “spin <left> at speed 600” will spin the BitBot on the spot by turning one wheel at the selected speed forwards and the other at the selected speed backwards.

The final block allows you to control the individual motors. Either the left motor or the right motor (or both). This is so that you can make a long sweeping turn instead of spinning on the spot, by making one motor go slower than the other.

LEDs

A great feature of the Bit:Bot is the set of neopixel LEDs, 6 down each arm.

The Makeblock extension supports these easily

The LEDs category has the basic blocks as shown above, but there are additional advanced blocks in the “…more” category

Normally, the process to update LEDs is a 2-stage process:
1. Make the changes to the LED colours (eg. “set all LEDs to Red”)
2. Send all the changes to the LEDs (“show LED changes”)

However, we have made it so that the default is “automatic updates”, so any changes made to the LED values will automatically result in the LEDs changing. This is a slower way to do things, but much easier to understand. If you want the normal, manual, update method then this can be selected from the “…more” category.

You can get a simple rainbow pattern on all the LEDs with just the “set led rainbow” block

And by using the forever block you can get the LEDs to animate using “rotate LEDs” and a pause to slow them down.

Sensors

The Sensors category provides access to both the integrated features (buzzer, line follower sensors, light sensors) and the optional addons (ultrasonic distance sensor, Talon grabber)

Buzzer

The “turn buzzer on/off” block enables you to make a simple beep

The program above will make a very annoying beep, beep, beep sound forever…

Ultrasonic Distance Sensor (sonar)

The “read sonar as cm/inches/microseconds” block enables you to read the distance from the front of the Bit:Bot to the nearest obstacle. Don’t expect this to be stunningly accurate, but it is good enough for obstacle avoiding etc. Here is a very simple obstacle avoiding program

In this program it reads the distance in centimetres. If it is nearer than 20cm then it reverses and turns, otherwise it carries straight on.

Line Following Sensors

The idea of these sensors is that you create a black, non-reflective, line on an otherwise reflective surface. You can then program the Bit:Bot to follow the line.

The best way to get a good line is to print a track on a laser printer. We use these printable tiles which are excellent

This is a very simple and very inefficient line follower program. But it works. If the left line sensor detects a line then spin left, if the right line sensor detects a line then spin right. Otherwise carry straight on. You can add some LEDs to the program to make it more interesting. Here we have a Red LED on the end of each stalk if it is turning that way, or 2 Green LEDs if it is going straight

 

Programming in Python

For text-based programming there is micro-python, and I prefer to use this offline using the Mu editor.  It provides a very neat and easy way of interfacing to the micro:bit without all the fuss of dragging and dropping.

Note on examples: We want to show people how the various features can be used. We don’t want to do the coding for you – that is the learning experience you should be taking away from using it. In the following examples, we will give you the tools to use all the features of Bit:Bot but it is up to you to combine them together in your code to make it do something useful. We do give a complete example of line-following – but it is a very basic algorithm and will get confused at T-junctions  and crossings; and it doesn’t use the neopixels.

Download Python examples at the bottom of this page.

Some great tutorials/examples by Mark Atkinson here

Motors

Each motor has two pins connected to it. One determines the speed and the other the direction:

Left motor: Speed Pin 0, Direction, Pin 8

Right motor: Speed Pin 1, Direction Pin 12

The simplest way to make the motors move is to set the Speed pin to HIGH and the Direction pin to LOW (to move full speed forwards)

Move left motor Forwards:

pin0.write_digital(1)
pin8.write_digital(0)

Move left motor Reverse:

pin0.write_digital(0)
pin8.write_digital(1)

If we want to change the speed of a motor, so that it is not going at full speed all the time, we need to use PWM (Pulse Width Modulation). This is means of changing the amount of power given to the motor by switching it on and off very fast. The percentage value of PWM determines the amount of each cycle that the output is ON. So a percentage of 100% is the same as being on all the time and thus the same as the examples above. A percentage of 50% would mean that the motor is only energised half the time, so it will go much slower. Note that the actual speed of the motor is not the same as the percentage of PWM – the motor won’t turn at all if the PWM value is too low and you will also get some stuttering at certain values. Nevertheless, being able to change the speed makes for a much better robot. For example, you can make a line follower that smoothly follows the line, rather than the normal shaking left and right.

To change the PWM value of a pin, we must use the analog_write commands. These can be set to a value between 0 (always off) to 1023 (always on), so 50% would be 511. Here are the commands to change the speed of the Right motor to approx 75% (value is 770)

Move right motor forwards at 75%

pin1.write_analog(770)
pin12.write_digital(0)

Doing this for the motors moving in reverse is a little confusing. Remember we need to change the direction pin to 1 for reverse. Then we need to set the amount of time in each cycle that the speed pin is LOW. This is the opposite of moving forwards, where we set the time for it to be High. Se we simply take the number (770 in this case) away from 1023, giving 253:

Move right motor Reverse at 75%

pin1.write_analog(253)
pin12.write_digital(1)

 

Neopixels

In fact, the name “neopixel” is a termed coined by Adafruit, but like “hoover” was a name of a brand of vacuum cleaner and is now a general term for all similar products, whoever makes it. The generic term is “smart RGB pixel” and is usually referenced with the name of the chip WS2812B. However, there are many different chips, all performing in a compatible way. The ones on the Bit:Bot are actually SK6812-3535

These smart RGB pixels are able to display any of 16 million colours by selecting a value of 0 to 255 for each of the Red, Green and Blue LEDs on each chip. The whole thing is controlled by a single pin on the BBC micro:bit (pin 13 for Bit:Bot). It is simple to use the included neopixel libraries to control each pixel individually.

The pixels are labelled on the Bit:Bot. From 0 to 5 on the left arm and from 6 to 11 on the right arm. If you connect any more neopixels into the extension port, then the new ones will start at 12.

Set neopixel 2 to purple (red and blue)

import neopixel
np = neopixel.NeoPixel(pin13, 12)
np[2] = (40, 0, 40)
np.show( )

The first line imports the neopixel library. We only need to do this once, at the very top of your Python programThe second line creates an Python list with an element for each pixel. As shown, it specifies 12 pixels connected to pin 13. If you added more neopixels then you would increase the number from 12 by the number of pixels you added. eg. if you added a McRoboFace, then the total would be 12 + 17 = 29 so you would change the line to: np = neopixel.NeoPixel(pin13, 29)
The third line sets the pixel we have selected (number 2 in this case) to the colour which is set by three values in the brackets, each value can be from 0 to 255 and covers Red, Green and Blue. In our example we have set Red and Blue to 40.
The fourth line tells the neopixel library to copy all the data to the neopixels, from the Python list that we have been working with. It is only at this point that the LEDs change. In general, you would make all the changes you want and only at the end would you use a np.show( )

Line Follower Sensors

NB. Version 1.0.0 of mu editor (v1.0.0) incorporates an updated version of micropython that allows these pins to ONLY be used as buttons. So instead of using pin11.read_digital() you need to say button_B.is_pressed() for instance. The examples will be changed to reflect this

These are digital inputs and connected to Pin 11 (left) and Pin 5 (right). These are the same pins as used by the buttons, so pressing a button will have the same effect as detecting a black line. This may have unexpected side-effects – as switching the micro:bit on when both buttons are pressed can cause it to enter Bluetooth pairing mode (depending what software is installed).

So you can use the normal Button inputs to read the sensors if you want, or you can use digital_read commands (as shown below). If the left sensor detects a line, it means the Bit:Bot is too far to the right, so it should move left. The opposite is the case if the right sensor detects a line. Here is some simple code for line following in Python (the actual motor commands are in separate functions for clarity)

while True:
    lline = pin11.read_digital()
    rline = pin5.read_digital()
    if (lline == 1):
        spinLeft( )
    elif (rline == 1):
        spinRight( )
    else:
        forward(speed)

Light Sensors

These are analog sensors and will give a value of 0 to 1023, where 0 is fully dark and 1023 is maximum brightness. As there are only 3 analog pins available on the micro:bit (without affecting the LED displays) and we are using 2 of them to control the motors, we only have one left (Pin 2) to read the analog values from 2 line sensors. How can we do this? Well, the Bit:Bot has an analog switch that uses a digital output signal (pin 16) to determine whether the analog input we are reading is for the left sensor or the right sensor.

Therefore, to read the light sensors we need to set the selection output pin first, then read the analog data.

In Python, we can do it like this to read the values into 2 variables called leftVal and rightVal:

Pin16.write_digital(0) # select left sensor
leftVal = Pin2.read_analog()
Pin16.write_digital(1) # select right sensor
rightVal = Pin2.read_analog()

 

Buzzer

The buzzer is a very simply device that outputs a 2.4kHz sound when it is set to ON. It is NOT controlled by the tone signal that can be output by the micro:bit on Pin 0 so you don’t need to install any libraries to operate it.

It is connected to Pin14. Setting this to ON (1) will activate the buzzer and setting to OFF (0) will deactivate it.

In Python, a very simple and annoying beep, beep, beep sound can be made as follows:

while True:
    pin14.write_digital(1)
    sleep(400)
    pin14.write_digital(0)
    sleep(400)

Ultrasonic Distance Sensor

This optional HC-SR04 ultrasonic distance sensor addon can be used most easily in Microsoft PXT. In MicroPython we are hampered by the lack of a microsecond resolution timer. (but see the demo “Ultrasonic Obstacle Avoider” below)

Example Micropython Programs

 

 

Santa16

Santa16 – A robotic advent calendar for December 2016

santa16

During the first 24 days of December you will get a part each day to help you assemble the robot. Things will start happening about half-way through, but the final part on 24th December is worth waiting for as it will unlock the power of the robot!

The following links provide you with the instructions you need to assemble and use the robot.

Happy Christmas!

 

Playground for Crumble, Micro:Bit & Raspberry Pi

Playground for Crumble, BBC Micro:Bit and Raspberry Pi

IMG_0999b PlayMicro03aPlayCrum_03

(Click on any image to enlarge)

 Purchase Here

Playground Overview

The Playground system allows you to connect external electronics (inputs, outputs, sensors, etc.) to your controller. Currently supports Crumble (from Redfern Electronics), Raspberry Pi and the BBC micro:bit.

The connections from the controller are converted to 3-pin 3.5mm jack connections and the connecting cables are 20cm jack cables – although longer cables can be used if required.

The separate electronic parts, Gizmos, can be used with any Playground. The exception being the Motor Gizmo, which can only be used with Crumble, as the micro:bit does not have integral motor drivers.

All of the Gizmos can be used within your programs using the built-in drivers for the relevant part.

Because each connection includes the necessary power and ground, you don’t need to wire these in separately – this transforms what can be a complicated and messy wiring setup into something tidy and more easily understood

Please check out these videos for Playground for Crumble and Playground for MicroBit

 

Installing Raspberry Pi Software

We have created a python library module that allows you to use the Playground for Raspberry Pi easily and quickly. You can install this from your Raspberry Pi connected to the internet as follows.

  • Download the latest version of the software using wget like this from a command line (eg. LXTerminal):
    wget http://4tronix.co.uk/pg.sh -O pg.sh
    bash pg.sh
  • This will create a new folder on your Pi in the /home/pi folder called playground (all lower case) with the playground.py library module and example files

 

Gizmos

IMG_0337a

Initially, we have 11 Gizmos for sale. These have been colour-coded in a similar way to our Crumbs:

  • Blue:  Digital inputs, such as a Button or Touch sensor
  • Yellow:  Analog inputs, such as a Light sensor or Dial
  • Black: Digital outputs, such as LEDs or Buzzer
  • Red:  Analog outputs such as the Servo or Motor
  • White:  Smart Pixels (aka “neopixels” or “sparkles”), individually addressable, chainable, RGB pixels (Flame, Blaze and Fire Stick)

 

Button Gizmo

Button_02

This provides a simple digital input to Playground. It is Active (High) when pressed and inactive (Low) when not pressed. There is a white indicator LED to show whether it is active or not.

Worksheet Links: Crumble  BBC micro:bit   Raspberry Pi

 

Touch Sensor Gizmo

Touch_02

This provides a digital input to PlayGround. Simply touch the pad on the sensor for it to become active (High) and release for it become inactive (Low). There is a white indicator LED to show whether it is active or not. In fact the sensor will detect your finger without actually touching, so you can do experiments to see how many sheets of paper you can cover it with before it stops working

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Dial Gizmo

Dial_02

The Dial Gizmo provides an analog input to your Playground. On the Crumble it will read from 0 to 256, while on the micro:bit it will go from 0 to 1023. The actual top end number will vary due to various losses in the system

Worksheet Links: Crumble  BBC micro:bit    Raspberry Pi

 

Light Sensor Gizmo

Light_02

The Light Sensor Gizmo is an anlog input Gizmo that reacts to the brightness of light to the sensor in the centre. It is tuned to be sensitive to daylight. The values vary from 0 (dark) to 256 (bright) on the Crumble, while on the micro:bit it will go from 0 to 1023. The actual top end number will vary due to various losses in the system

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Traffic Light Gizmo

Traffic_02

The Traffic Light Gizmo is a digital output Gizmo for your Playground. Each of the large 10mm LEDs will turn on when the appropriate input is set to High. There are three inputs, one for each of Red, Amber and Yellow

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Buzzer Gizmo

Buzzer_02

The Buzzer Gizmo is a digital output Gizmo for your Playground. When the input is set to High, the buzzer will sound and a white indicator LED will light

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Flame Gizmo

Flame_01

The Flame Gizmo provides a single, fully controllable, RGB pixel. This allows you to change the colour to any one of 16 million different colours. These are chainable, with both an input and an output connector. On the Crumble, these “smart pixels” are referred to as “Sparkles”, while on the micro:bit they are known as “neopixels”

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Blaze Gizmo

Blaze_02

The Blaze Gizmo gives you a ring of 8 , independently controllable, RGB pixels. This allows you to change the colour of any or all of them to any one of 16 million different colours. On the Crumble, these “smart pixels” are referred to as “Sparkles”, while on the micro:bit they are known as “neopixels”. These can be added onto the end of a chain of Flame Gizmos if required, or used on their own

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Servo Gizmo

Servo_02

As the name suggests, this Gizmo allows you to very easily connect a miniature 9g servo to your Playground. Plug it in, then program it for a 180 degree range of movement

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Motor Gizmo

(Not compatible with micro:bit Playground)

Motor_01

The Motor Gizmo is driven directly from the Crumble motor driver outputs – it cannot work with the micro:bit. Use the Crumble motor control blocks to set the speed and direction of up to 2 Motor Gizmos. You can build yourself a robot very easily with 2 of these

Worksheet Links: Crumble  (BBC micro:bit and Raspberry Pi not available – a prototype motor Gizmo for Pi is shown at top of page – this has a built in motor driver.)

 

Prototyping Gizmo

Proto_01

This simple Gizmo allows you to build your own Gizmo for those inputs or outputs that are not yet available as a ready-made Gizmo. For instance, you could make a temperature sensor, or have a controllable relay. The board has 4 holes for the Signal, 6 for each of Power and Ground, and 48 for you to use for your creation.

 

 

 

McRoboFace Home Page

McRoboFace – Emoticon for Electronic Creations

mrf02b

(Click on any image to enlarge)

Purchase McRoboFace Here

Overview

The McRoboFace is a robotic face with 17 individually controllable RGB LEDs that you can use to bring your electronic creations to life.

Each LED can be set to any of 16 million different colours (256 for each of Red, Green and Blue).

All the LEDs as fully compatible with the “standard” WS2812, also known as “neopixels” – a name coined by Adafruit. As such, any of the many libraries and examples for most of the common controllers can be used to drive them. This includes:

  • Crumble
  • Arduino
  • micro:bit
  • ESP8266
  • Raspberry Pi
  • Codebug
  • BeagleBone

 

Tour of the ‘Face

v02_Render03

The “mouth” is made up of 14 small (3.5mm) pixels numbered in small lettering from 0 to 13:

  • Lighting 0 to 5 gives a smile
  • Lighting 0, 5, 6, 7, 8, 9 gives a frown
  • Lighting 0, 5, 10, 11, 12, 13 gives a straight-line
  • Use other combinations for quizzical looks, open mouth, etc

The “nose” comprises a small (3.5mm) pixel numbered 14

The “eyes” comprise two standard (5mm) pixels numbered 15 & 16

 

v02_Render04

The rear shows the 3 mounting holes, each is 2.8mm diameter for use with M2.5 screws

There are 4 connections at the bottom:

  • Gnd – Ground pin. Connect to 0V from your controller
  • Vcc – Power pin. Connect to the power pin from your controller.Ideally this is 5V, but on the micro:bit for instance only 3.3V is available. This will work, although it is below the recommended minimum voltage
  • Din – Data input pin. Connect this to the control output from your controller
  • Dout – Data Output pin. Use this to connect additional smart pixels such as another McRoboFace, a CodeBug GlowStar/GlowBug, Crumble Sparkles or an Adafruit neopixel strip etc.

 

Connections to Example Controllers

For the following photos I have soldered on the 4-pin right angle header to make connections easier using jumper leads. Photos are of a prototype McRoboFace, without the numbers to identify each pixel

Crumble

Crumble01

The Crumble knows smart pixels as Sparkles and they must be connected to the D pin. Use the + and – pins to provide Power and Ground

The software is as simple as setting each pixel to the required colour. This is what the picture above is running:

Crumble02

 

Arduino

Arduino01

For the Arduino, any of the output pins will work. In this example we are using A0 as it is closest to the %V and Ground pins.

The code used relies on the well-known and well supported FastLED library. In the Arduino IDE, go to Sketch / Include library / Manage Libraries and then search for FastLED. Select it and install.

Then you can use this example code to show various facial expressions. The important parts are:

  • in setup ( ) – you need to define the number of LEDs, and the pin to be used to control them: FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  • to change any pixel, set its RGB value in the led array, eg. leds [3] = CRGB (RedValue, GreenValue, BlueValue);  When you have set all the pixels you need, then call FastLED.show ( ); to transfer the changes to the pixels.

 

micro:bit

microbit01

In micro python on the micro:bit, you can use any output pin to control the McRoboFace’s pixels. In this example we’re using Pin 0

As with the Arduino, you first need to include the right library and then define which pin you’ll be using and how many pixels are required. micro:bit calls them “neopixels”

microbit02

 

Raspberry Pi

You can do this in two ways:

  1. Connect directly to GPIO pin and install some software. This software often changes as Raspberry Pi change things in the kernel and will need keeping up to date
  2. Use Picon Zero to provide a simple interface to all your devices including smart pixels

Directly to GPIO Pin

rpi01

You need to use GPIO 18, which is physical pin 12. You can use the 5V and Ground pins directly. No level changers are required as the pixel can be controlled using 3.3V quite happily as shown.

If you already have neopixels supported on your Pi then there is no need for the build and install steps below. You can visit McRoboFace githib repo for the information below

$ git clone https://github.com/4tronix/mcroboface
$ cd ~/mcroboface
$ sudo apt-get install python-pip python-dev
$ sudo python setup.py install

NB. For Raspbian Jessie release 10th May 2016 (and probably later versions also) you will need to add the following lines in ‘/boot/config.txt’ :

hdmi_force_hotplug=1
hdmi_force_edid_audio=1

This will create a folder on your Pi called mcroboface and provide a simple example, mcroboface.py. Run this as:

$ sudo python mcroboface.py

 

Using the 4tronix Picon Zero

rpi02

Picon Zero output 5 can be used to drive smart pixels in a very simple manner. You should first visit the main Picon Zero page to download the library

Download the simple test example from here

 

Singalong Kit for McRoboFace

sa02

The Kickstarter campaign for McRoboFace included an option for some electronics that allowed the mouth of McRoboFace to be controlled by an audio input signal.

This was developed by Robin Newman and the full blog can be seen here

Download the assembly instructions here

 

ZeroPoint – Analog Output for your Raspberry Pi

ZeroPoint – Analog Output

IMG_0286a

IMG_0292a

 

Overview

ZeroPoint is an analog gauge with a prototyping area for your own sensors

The gauge is a small stepper motor (X27.168) that is driven using an H-bridge (it’s a bipolar stepper so needs to be driven both ways)

Although it is a standard stepper motor to operate, it only travels through 315 degrees before hitting the physical end stops.

This gauge is used in many vehicles for speedometer, tachometer, etc. and so is in plentiful supply

It is a very weak stepper motor and cannot be used to drive much at all (cue someone trying to use two for a small robot!)

Power is taken from the 5V of the Raspberry Pi, so no additional power is required.

 

Software

We have a python library which can be used to position the needle accurately. You can download directly the library and example file by typing the following into the terminal window. Open LXTerminal and type:

  • wget http://4tronix.co.uk/zpoint.sh -O zpoint.sh
  • bash zpoint.sh

That will create a zeropoint folder in your home folder, with the library and example file:

  • zeropoint.py  library module for ZeroPoint
  • testPoint.py  a simple test script that allows you to set the position from 0 to 100% by pressing the number keys  (and ‘a’ for 100)
  • zeropoint.init ( ) – initialises the various settings and forces the pointer to zero
  • zeropoint.setTo (position) – sets the pointer to position (from 0 to 600)
  • zeropoint.stepToZero ( ) – forces the pointer to the zero position (oversteps to ensure this)
  • zeropoint.cleanup ( ) – closes down tidily, stopping the background stepper thread, shuts down the GPIO handler

 

Finally, there is a PDF file with a number of dial templates that could be used. Of course you can create your own with your specific measurement values on such as degrees Celsius/Fahrenheit  or humidity etc.

base3

Links

 

Using the Prototype Area

The prototyping area is intended for you to add you own sensors or input devices so you can create a standalone analog meter. These could be temperature sensors, light sensors, buttons, etc. To help you wire this in we’ve provided:

  • 6 spare GPIO signals (labelled with both BCM GPIO numbers and physical pin numbers)
  • I2C signals
  • Power lines: Ground, 3.3V and 5V (each has a column of 5 holes, all connected together)
  • There is then a bank of 8 x 6 non-dedicated holes for you to put in your own components. NB. 4 holes are missing in bottom right corner to allow space for the mounting hole, giving a total of 44 non-dedicated holes

Ultrasonic Addons for CrumbleBot – Assembly and Use

Ultrasonic CrumbleBot Addons

IMG_0099b

IMG_0098b

Download Updated Crumble software from here

This post gives brief instructions for assembling the Static and Panning versions of the Ultrasonic addon for CrumbleBot

You will need version 25.5 or later of the Crumble Software – see the link above to download it.

 

Static Ultrasonic Distance Sensor

IMG_0106b

Check you have the correct parts:

  • White base PCB with ultrasonic sensor
  • Red Positive power connection PCB
  • Black Negative power connection PCB
  • 2 x 15mm Pillars
  • 6 x 6mm Screws
  • 2 x Nuts

Fit the Distance Sensor to the CrumbleBot

  1. The Black negative power connector PCB is fitted on the left side of the CrumbleBot with the writing facing upwards.
  2. Use a screw and nut to screw the connector PCB into the hole marked V-. Do not tighten the screw
  3. Screw in the Red positive power connector PCB onto the right side of the CrumbleBot using a screw and nut into the connector marked V+. Don’t tighten the screw.
  4. The other ends of the two power connectors PCBs should line up with the 2 mounting holes at the front of the CrumbleBot
  5. Now use 2 more screws to fit the 15mm pillars onto the top side of the CrumbleBot, feeding the screws through the mounting holes, through the power connector PCBs and into the pillars
  6. Finally, use the 2 remaining screws to fit the main ultrasonic sensor board to the tops of the 2 pillars
  7. Now tighten all the screws so everything is fixed tightly
  8. It should now look like the photo below

IMG_0098b

Using the Static Distance Sensor

  • Ensure you have downloaded the latest version of the Crumble Software (must be at least v25.2)
  • Use a crocodile clip cable to connect one of the inputs (A, B, C or D) to the connection marked “SONIC” on the sensor board
  • Use the “Distance” block and set both ‘T’ and ‘E’ to the same pin as you are using to connect the sensor (The example below shows it connected to input A)
  • The example code below simply gets the distance and saves it into variable t. You can look at the variables and see the distance change as you move your hand in front of the sensor

sonic01

 

Panning Ultrasonic Distance Sensor

IMG_0103b

Check you have the correct parts:

  • White base PCB with ultrasonic sensor and 4-pin connector
  • Larger White PCB with servo and 4-pin connector
  • Red Positive power connection PCB
  • Black Negative power connection PCB
  • 2 x 25mm Pillars
  • 6 x 6mm Screws
  • 2 x Nuts
  • 4-way Female-Female 10cm Cable (various colours)

 

Fit the Distance Sensor to the CrumbleBot

  1. The Black negative power connector PCB is fitted on the left side of the CrumbleBot with the writing facing upwards.
  2. Use a screw and nut to screw the connector PCB into the hole marked V-. Do not tighten the screw
  3. Screw in the Red positive power connector PCB onto the right side of the CrumbleBot using a screw and nut into the connector marked V+. Don’t tighten the screw.
  4. The other ends of the two power connectors PCBs should line up with the 2 mounting holes at the front of the CrumbleBot
  5. Now use 2 more screws to fit the 25mm pillars onto the top side of the CrumbleBot, feeding the screws through the mounting holes, through the power connector PCBs and into the pillars
  6. Then use the 2 remaining screws to fit the servo board to the tops of the 2 pillars
  7. Now tighten all the screws so everything is fixed tightly
  8. Push the Board containing the ultrasonic sensor onto the top of the servo and use the screw inside the servo parts bag to fit it more permanently (actually, you can leave this off until you are sure you have it set to the centre position when the servo is centred)
  9. Finally, use the 4-way cable to connect the Sensor PCB to the Servo PCB. Make sure that the wires do not cross over. So for example, if you have Brown, Red, Yellow Orange at the top, then you must also have Brown, Red, Yellow, Orange at the bottom. (your wires may be completely different colours, so just ensure they are in the same order at the top as at the bottom)
  10. You should now have something like the photo shown below

IMG_0099b

 

Using the Panning Distance Sensor

  • Ensure you have downloaded the latest version of the Crumble Software (must be at least v25.2)
  • Use a crocodile clip cable to connect one of the inputs (A, B, C or D) to the connection marked SONIC on the servo board
  • Use another crocodile clip cable to connect one of the inputs to the connection marked SERVO on the servo board
  • Use the “Distance” block and set both ‘T’ and ‘E’ to the same pin as you are using to connect the sensor (The example below shows it connected to input A)
  • Use the “Servo” block to set the position of the servo from -90 degrees to +90 degrees. 0 degrees should be straight ahead
  • The example code below sets the servo to straight ahead, then gets the distance and saves it into variable t
  • If the servo is not pointing straight ahead, pull off the top PCB with the sensor on and fit it onto the servo again so it is pointing ahead. Then tighten the screw.

sonic02

 

 

“QUARK” – First Views

“QUARK” – Overview and Description

(Click any image to enlarge)

Now updated to include V0.2

IMG_0245a

Version 0.2 “Button”, “Blinkies” and underside of “Proto”

Quark_06a

v0.1 Top side

Quark_07a

v0.1 under side

Specification

  • Processor: ATMega328P-AU
  • Clock Speed 16MHz
  • Fully compatible with Arduino Uno
  • USB Interface: CH340G
  • Battery: Rechargeable Lithium Ion LIR2032 (3.6V nominal)
  • Diameter: 28mm (v0.1 was 27.25mm)
  • Weight: 2.9g without battery (5.5g with battery)
  • On-board Charger, with charge indication LEDs
  • On-Off Switch
  • D13 LED (Blue)
  • 4 Digital I/O Pins (Arduino Uno pins D2, D3, D4, D5)
  • 4 Analog I/O Pins (Arduino Uno pins A0, A1, A4, A5)
  • I2C pins (Shared with pins A4 and A5)

 

Changes between v0.1 and v0.2

The only real change is the header strips which are now both 6-pin straight headers instead of one 5-pin and one 7-pin curved. This allows us to actually fit headers and I have fitted 6-pin low-profile female headers

I’ve blocked off one pin to act as a polarising location, so plugin boards will only fit one way – having cut off the matching pin on the plugin’s male header. (Note. this polarising scheme will change in the next revision and existing plugins will not be compatible)

We’ve also shipped these with 2 additional plugins:

  • Blinkies – a set of WS2812B-compatible smart pixels (aka neopixels). These are connected to pin D4 on the “Arduino” and can be driven using the FastLed library
  • Proto – a simple prototype board allowing you to add sensors: digital, analog or I2C of your choice
    • 56 holes arranged in 7 rows of 8
    • The middle 4 pins of top row are connected to A5, A4, A1, A0 respectively (note that A4 and A5 are the default I2C pins SDA and SCL)
    • The middle 4 pins of the bottom row are connected to D5, D4, D3, D2
    • Additional 5 Ground pins on the left
    • Additional 5 Vcc pins on the right

 

Getting Started

  • You will need the Arduino IDE – download from the Arduino website
  • You may also need drivers for the CH340 USB interface. These are included with Windows 10, but also available online (just Google for your OS and CH341 or CH340)
  • You’ll also need a Micro USB lead
  • Set up the IDE with the correct COM Port, and use board type Arduino/Genuino UNO
  • The boards have been shipped running the Example Blink sketch and so will blink the Blue LED on and off every second

 

Charging

  • The built-in LIR2032 battery will last around an hour or so, depending what it is doing (based on the same circuit running on the 4tronix SmartBadge which lasts 45 minutes when powering neopixels)
  • It will take about 30 to 40 minutes to charge if switched off
  • The Red LED indicates charging and faster charging will occur if the unit is switched off during the charging
  • The charge is complete, the Green LED is lit and the charging circuit shuts down
  • Whenever the USB lead is plugged in, it will charge, but this is only really effective when the Quark is switched off

 

Know Your “Quark”

Quarkv02_02

v0.2 Pinout

quark_03a

V0.1 Pinout

 

Naming

  • There is a project on my system named Quark, which has several designs in a partially complete stage. This is just the first one onto a PCB.
  • Intel already have a product range Quark, so we won’t be using this name when/if the product gets released.
  • Please let me know of any name ideas you think may fly