Using LEGO Boost / WeDo 2.0 with Scratch and S2Bot


The S2Bot app allows you to control LEGO Boost or LEGO WeDo 2.0 from within your Scratch (or Snap!) project running on a desktop computer (Windows, Mac, Linux, Chromebook). A BLED112 dongle is required to provide the bluetooth connection on the computer.

Scratch with LEGO Boost

Supported features include:

  • wireless bluetooth connection to the LEGO hub
  • detect tilt, distance, colour, position using LEGO sensors
  • control LEGO motors with varying speeds
  • change colours of the RGB LED light on the hub
  • create sounds on the piezo sounder (WeDo only)

What you will need:

  1. A LEGO Boost (17101) or LEGO WeDo 2.0 (45300) set
  2. Windows/Mac/Linux/Chromebook computer
  3. BLED112 bluetooth dongle (not required for Chromebooks). No other type of dongle is compatible.
  4. Batteries for the LEGO hub.

Initial Installation:

  1. Install the S2Bot App from here
  2. Insert the BLED112 bluetooth dongle and let the driver install (more details here)
  3. Start the S2Bot App.
  4. Select 'LEGO WeDo 2.0' or 'LEGO Boost' from the drop down list of devices


Using the S2Bot App: 

  1. Select 'LEGO WeDo 2.0' or 'LEGO Boost' from the drop down list of devices
  2. Click the 'Scan for devices' button.
  3. You should see your LEGO hub appear in the list of bluetooth devices. If you do not see the hub press the green button so that the LED starts flashing (and you can also try restarting the S2Bot app). Remember the hub can only connect to one device at a time (so cannot connect to the BLED112 dongle if already connected to an iPad or tablet).
  4. Click on the hub name to connect it (no pairing is required).
  5. When connected (takes 5 seconds or so) you will see tilt/motor data etc on screen. 
  6. Click 'Close' to close the connection dialog.
  7. Click on the menu button (top right) and select 'New Scratch template'. Save the .sb2 template to your desktop.

S2Bot with Boost


Using Scratch:

  1. In Chrome browser go to http://scratch.mit.edu and click Create (or start the offline version of Scratch)
  2. From the File menu select 'Upload from your computer'
  3. Select the .sb2 template file you saved earlier on your desktop.
  4. Scratch should now automatically 'connect' to S2Bot and the new blocks will be available in the 'More Blocks' section. You can tell if Scratch and S2Bot are connected via the green 'connected' LED in both applications.


Input Sensors and Outputs


LEGO Boost (17101) LEGO WeDo 2.0 (45300)
RRP £149.99 (inc VAT) £144.00 (inc VAT)
Contents:

Move hub, interactive motor, colour/distance sensor

847 bricks 

Smart hub, medium motor, tilt sensor, motion sensor

280 bricks

Power Supply

Motor Output Voltage

Sensor Voltage

9V (6xAAA battery)

9V

3V

3V (2xAA battery, or 45302 rechargeable pack)

5V (via internal voltage boost circuit)

3V

Hub Internal

Inputs/Outputs

2 Interactive Motors (with position sensor)

RGB Light

-

Tilt Sensor

Current Sensor

Voltage Sensor

-

RGB Light

Piezo sounder

-

Current Sensor

Voltage Sensor

External Inputs/Outputs

(2 hub ports available)

Interactive Motor (with position sensor)

Combined colour / distance sensor

 

(WeDo Tilt and Motion sensors may also be used)

8883 M (medium) Motor

9584 Tilt Sensor

9583 Motion Sensor

 

 

Motors

The WeDo M (medium) motor can be switched on for a period of time at various different speeds.

The Boost set has 3 interactive motors, 2 internal (A and B) and 1 external (port C or D). These interactive motors have a position sensor that counts the number of steps moved, so are far more accurate and versatile than the WeDo M motor. The ‘sensor’ variable (e.g. sensorA) feeds back the step position of that particular motor.

The interactive motors can therefore be used in 3 different ways:

  1. Move ‘X’ steps in either direction. This is useful for moving a robot a certain distance, for instance the Vernie model uses 417 steps at speed 50 to move forward ‘1 grid space’.  The number of steps to move will vary from model to model. For ease of use the 'move forward/backward' and 'turn left/right' blocks control both internal motors (A and B) at the same time. 
  2. Move to position ‘X’. This is useful to move the motor to a known position, mimicking servo behaviour. For instance to move the Vernie model head back and forth you could move from position 50 to position -50. The actual position the motor stops at may be a couple of steps different to the target value, but is normally very close.   
  3. As a position sensor. The steps rotated are counted even if the axle is manually turned by hand, which means the interactive motor can also be used as a position sensor. Connect an axle and gear and then turn the gear to change the position value.

 

RGB LED Light

The LED light on the hub may be changed to one of 10 colours (or switched off entirely).

 

Piezo Sounder

The WeDo smart hub has an internal piezo sounder that can play notes.  There is no sounder inside the Boost move hub.

 

Tilt Sensor

The WeDo tilt sensor is external, the Boost tilt sensor is inside the move hub. However they both give a value 0-5 in the ‘tilt’ variable depending on which way the sensor is leaning.

The Boost template also gives additional ‘tiltX’ and ‘tiltY’ variables for more detailed position information of the internal tilt sensor.

The WeDo external tilt sensor will also work if connected to the Boost move hub. However the value will only be available in the 'sensor' variable (as the 'tilt' variable is reserved for the internal tilt sensor instead).

 

Motion and Colour/Distance Sensors

The WeDo motion sensor gives a value between 0 and 100 in the ‘distance’ variable, incrementing in steps of 10. It does not detect changes very close to the sensor. 

The Boost colour/distance sensor is two sensors in one, giving both ‘distance’ and ‘color’ values at the same time. It also has a more accurate close up ‘distance’ resolution than the WeDo motion sensor, initially counting from 1 to 10 close-up and then counting in steps of 10 from 10 to 100.

The colour sensor identifies 6 main colours of LEGO brick and places the colour reference number in the ‘color’ variable – black (0), blue (3), green (5), yellow (7), red (9) and white (10).  The brick should be held within 2 cm of the sensor to be identified, if no colour is detected the ‘color’ variable will contain the 'unknown' value 255. Other colours will simply be sorted to the nearest known colour, so for instance brown may be identified as 7 (yellow) and pink as 9 (red).

 

Voltage and Current Sensors

These internal sensors measure the current and control electronics voltage (around 3V) within the hub. For advanced projects the current variable value could be used to detect a ‘stalled’ motor.

 

Boost Model Assembly Instructions

Unusually, LEGO Boost does not come with printed assembly instructions, they are only supplied in electronic format within the Boost app. The reason, as clarified by LEGO, is that the intended Boost experience is centered around a 'Build-Code-Play' experience and the intention is to encourage the users to begin to program the model behavior at designated points during the model build, so the users can get the full experience of bringing a model to life. These play-breaks allow the young users to have a break during building, and learn programming. Building with only the PDF circumvents the true LEGO Boost experience. 

However Scratch users may want to work differently, to build and control models such as Vernie from Scratch (without using the LEGO app), so third party generated assembly instructions for the Boost models may be downloaded here in PDF format.

LEGO, Wedo, and Boost are trademarks of LEGO. S2Bot is not developed by or associated with or endorsed by or sponsored by LEGO. SBrick is a trademark of Vengit Ltd.