EDUCATIONAL ROBOTICS

Introduction

Scratch 3.0 is a visual programming language developed by the MIT Media Lab. It can be used for a range of educational purposes from maths and science projects to animated stories with art and music. It provides a stepping stone to the more advanced world of computer programming. Scratch 3.0 is an online Web app that runs in your browser.

Getting started

The Edbot Dream kit enables you to assemble 20+ different robots. The heart of the Edbot Dream is the CM-150 microcontroller - the small black plastic box! The microcontroller has 4 built-in sensors (3 IR sensors and a clap counter), an internal buzzer and 4 ports to connect external equipment. It has a battery connector and a socket for the Bluetooth (BT) module.

The IR receiver is provided with the included remote control unit (RC-100). The receiver plugs into the same socket as the Bluetooth module. Please note the remote control cannot be used with the Edbot Software.

cm 150 connections

The Edbot Software enables your Scratch 3.0 project to control your Edbot Dream robots by providing extra Scratch blocks in a Scratch 3.0 extension. The MIT team haven't yet announced how they plan to incorporate external Scratch 3.0 extensions into their main Web site. However they've made the source code of Scratch 3.0 available on GitHub which has allowed us to add our own extensions!

  1. Make sure the Edbot Software is running locally on your device. Your Edbot Dream robots should be available in the Robots pane. It doesn't matter if they are configured locally or remotely.

  2. Use the following link to access Scratch 3.0 with the Edbot Dream extension:

    Most modern browsers should work. Add the Edbot Dream extension by clicking the extensions button in the bottom left corner and selecting the Edbot Dream extension. This will load the Edbot Dream blocks.

  3. After loading the extension, your program will need control of the robot. Grant control using the active user menu in the Edbot Software. See below.

    edbotsw scratch3

If you're developing solo, the Edbot Software provides a convenient per-robot option "Open access" in the Server → Setup → Configure window. This will allow any connection to control the robot. Check this option while developing so that you don't need to give control each time you test your program. To stop other network users inadvertently accessing the robot, uncheck the "Available on network" option.

You can open the sample Scratch 3.0 projects too. First generate the projects by selecting Scratch → Generate Sample Projects in the Edbot Software. This will embed the Scratch 3.0 extension with your Edbot Dream names into each project. Select File → Load from your computer from the Scratch 3.0 menu and select the project you'd like to open. The Edbot Dream extension will be automatically loaded if necessary. Note all Scratch 3.0 project files have an .sb3 suffix.

Use the Scratch → Project updater in the Edbot Software to rename robots in existing Scratch projects. You may need to reload the Scratch 3.0 Web page to get the updated Edbot Dream extension.

The Edbot Dream Scratch blocks are described below in a fair amount of detail. Please take the time to read through the rest of this document to familiarise yourself, there's a lot going on! We've called our Edbot Dream 'Anna', but you'll have given yours its own cool name of course…​

Some of the Edbot Dream Scratch blocks require you to enter a value. If you enter an invalid value, Scratch has no way of letting you know. You can check for errors by opening the Log Viewer window in the Edbot Software under Tools → Log viewer.

Motor & servo blocks

Your Edbot Dream is supplied with two motors (GM-10) and a servo (SM-10). Connect motors to port 1 / port 2 of the microcontroller using a 2-wire cable. You can control the motor speed and direction. The servo connects to port 3 / port 4 using a 5-wire cable. The servo can operate in wheel mode when it acts just like a motor. It can also operate in joint mode when you can set it to a specific position.

Single blocks

These blocks let you control an individual motor or servo. If you need to control a set of motors and servos simultaneously, use the multi blocks described below.

Set motor speed

block motor speed

This block controls the speed and direction of a motor connected to port 1 / port 2 of the microcontroller. You can also use it to control a servo in wheel mode connected to port 3 / port 4. The speed is entered as a percentage with 100 being full speed ahead. To stop a motor just set its speed to zero.

Set servo on/off

block servo torque

Use this block to turn a servo on or off. When a servo is turned off you can easily turn it yourself.

Set servo position

block servo position

Use this block to set the position and speed of a servo connected to port 3 / port 4. This block will turn on the servo and you may hear a buzzing sound as the servo holds its position. Enter this position as an angle between 0 and 300 degrees. See the diagram below.

servo angle

The speed controls how quickly or slowly the servo moves to its position and is entered as a percentage.

Multi blocks

These blocks allow you to control a set of servos or motors simultaneously.

Set motor speeds

block motor speeds

Set the speed of a set of motors or servos in wheel mode. Specify the port number followed by "/" followed by the speed expressed as a percentage. A negative speed will rotate CW, a positive speed will rotate in a CCW direction. Specify multiple motors or servos by repeating the sequence, for example "1/50/2/50/3/50/4/50".

Set servos on/off

block servo torques

Turn a set of servos on or off. Specify the port number (3 or 4) followed by "/" followed by 0 or 1 to turn the servo off or on respectively. Specify multiple servos by repeating the sequence, for example "3/1/4/1".

Set servo positions

block servo positions

Use this block to set the position and speed of a set of servos connected to port 3 / port 4. This block will turn on each servo and you may hear a buzzing sound as the servo holds its position. Specify the port number followed by "/" followed by the position as an angle between 0 and 300 degrees, followed by "/" followed by the speed as a percentage. Specify multiple servos by repeating the sequence, for example "3/150/50/4/150/100".

LED & buzzer blocks

Set LED module

block led module

The optional LED module (LM-10) can be connected to port 3 or port 4 of the microcontroller. The module consists of an orange and a blue LED.

lm 10

The LEDs can be switched on or off by setting a value. The possible values are listed below.

Value

Orange LED

Blue LED

0

Off

Off

1

On

Off

2

Off

On

3

On

On

Buzzer pitch

block buzzer pitch

Use this block to play a note on the microcontroller's built-in buzzer. Specify the pitch, from 0 to 48 and the duration in units of 1/10 of a second (a duration of 10 would be 1 second).

Buzzer melody

block buzzer melody

This block plays a melody on the microcontroller's built-in buzzer. We use the term melody here loosely! A melody is represented by a number ranging form 0 to 24. You should allow a few seconds for the melody to complete. The following Scratch script cycles through each melody:

block buzzer melodies

Sensor blocks

Port sensor

block get port sensor

Use this Scratch reporter block to get the value of an external sensor connected to port 3 or port 4. The sensor types are listed below. Edbot Dream is supplied with a servo (SM-10), the remaining sensors are optional.

sm 10

Servo position (SM-10)
Get the servo position in degrees. Valid range is 0 to 300 degrees rounded to 1 decimal place. See the servo diagram.

irss 10

IR sensor (IRSS-10)
The IR sensor uses infra-red to measure the distance to an object. It was calibrated using a vertical white A4 card. Note the sensor may give different measurements for different coloured objects placed the same distance away. The reading should be interpreted as an approximate distance in centimetres. The measuring range is 3cm to 30cm rounded to 1 decimal place. A value of 100.0cm means "out of range".

dms 80

DMS sensor (DMS-80)
The DMS sensor is an accurate distance sensor which uses triangulation and is not affected by object colour. It returns the distance in centimetres. The measuring range is 8cm to 80cm rounded to 1 decimal place. A value of 100.0 means "out of range".

tps 10

Temperature sensor (TPS-10)
Returns the temperature in degrees Celsius.

ts 10

Touch sensor (TS-10)
The touch sensor is a micro-switch. It returns 1 if the switch is depressed, otherwise 0.

mgss 10

Magnetic sensor (MGSS-10)
The magnetic sensor is a reed switch which detects the presence of a magnet. It returns 1 when a magnet is present, otherwise 0.

In addition you can use the raw value returned from a sensor. This will be a number between 0 and 1023 depending on the type of sensor.

Left IR sensor

block get left ir

The built-in left IR sensor uses infra-red to measure the distance to an object. It was calibrated using a vertical white A4 card. Note the sensor may give different measurements for different coloured objects placed the same distance away. The reading should be interpreted as an approximate distance in centimetres. The measuring range is 3cm to 20cm rounded to 1 decimal place. A value of 100.0cm means "out of range". In addition you can use the raw value returned from the sensor.

Right IR sensor

block get right ir

The built-in right IR sensor uses infra-red to measure the distance to an object. It was calibrated using a vertical white A4 card. Note the sensor may give different measurements for different coloured objects placed the same distance away. The reading should be interpreted as an approximate distance in centimetres. The measuring range is 3cm to 20cm rounded to 1 decimal place. A value of 100.0cm means "out of range". In addition you can use the raw value returned from the sensor.

Centre IR sensor

block get centre ir

The built-in centre IR sensor uses infra-red to measure the distance to an object. It was calibrated using a vertical white A4 card. Note the sensor may give different measurements for different coloured objects placed the same distance away. The reading should be interpreted as an approximate distance in centimetres. The measuring range is 3cm to 20cm rounded to 1 decimal place. A value of 100.0cm means "out of range". In addition you can use the raw value returned from the sensor.

Clap count

block get clap count

This reporter block detects the number of claps (loud noises) that have occurred in the last few seconds. This is called the live count. When you've finished clapping, the live count is transferred to the last count and the live count is set back to 0.

You can reset the last count to zero using the following block.

block clap count reset

Speech blocks

The following blocks instruct your Edbot Dream to speak! The voice, language, volume, pitch and speed will have been set up during configuration.

Try configuring your Edbot Dream with a different language, if you have the voices available. You can then type text in your chosen language in the speech blocks!

Say

block say

Say the words! This block won't wait for the speech to finish before continuing to the next block.

Say and wait

block say wait

Say the words! This block will wait for the speech to finish before continuing to the next block.

Current word

block get current word

This reporter block gives you the current word as it is being spoken. It returns empty text (zero length) if your Edbot Dream isn't speaking. Use it to add visual emphasis during speech. The example below displays the current word in a speech bubble.

block current word example

General blocks

Reset

block reset

Use this block to reset the microcontroller. It will stop any connected motors or servos, turn off the LED module if plugged into port 3 / port 4, set the last clap count back to 0 and halt any speech on a word boundary.

Status

block get status

This reporter block can be used to check if your Edbot Dream is connected to the Edbot Software and whether it is enabled or not. The block returns true if connected or enabled and false if not.