... | ... | @@ -8,7 +8,10 @@ Microbot Lab |
|
|
|
|
|
<p id="top"></p>
|
|
|
|
|
|
# Features
|
|
|
## Description
|
|
|
This lab enables students to learn about communication interception through a hands on approach with Micro:Bots. We will demonstrate the use of radio technology as a means for remote control and the potential for radio wave hijacking. Students will learn the fundamentals of Bluetooth and radio waves through implementation by using one micro:bit as a controller for another micro:bit embedded in a robot.
|
|
|
|
|
|
## Features
|
|
|
* **Estimated Time: 1 Hour** (base lab), **3 Hours** ([Hacking](#hacking), [Further Exploration](#furtherexploration))
|
|
|
* **Appropriate Grades:** 6-12
|
|
|
* **Topic Alignment** ( **L**imited, **M**edium, **H**igh )
|
... | ... | @@ -39,10 +42,8 @@ Microbot Lab |
|
|
| Think Like an Adversary | H |
|
|
|
| Keep It Simple | M |
|
|
|
|
|
|
# Description
|
|
|
This lab enables students to learn about communication interception through a hands on approach with Micro:Bots. We will demonstrate the use of radio technology as a means for remote control and the potential for radio wave hijacking. Students will learn the fundamentals of Bluetooth and radio waves through implementation by using one micro:bit as a controller for another micro:bit embedded in a robot.
|
|
|
|
|
|
# Step 0: The Basics
|
|
|
## Step 0: The Basics
|
|
|
* Micro::Bit Coding Options
|
|
|
* [Click here to code with JavaScript/Blocks] (https://makecode.microbit.org)
|
|
|
* [Click here to code with MicroPython](https://python.microbit.org)
|
... | ... | @@ -50,13 +51,13 @@ This lab enables students to learn about communication interception through a ha |
|
|
* [Click here for Micro:Bit radio basics](https://makecode.microbit.org/reference/radio)
|
|
|
|
|
|
|
|
|
# Step 1: Gather Materials
|
|
|
## Step 1: Gather Materials
|
|
|
* Micro::Bit (1 per person / 2 per team)
|
|
|
* Micro-USB Cable
|
|
|
* Battery Pack (Equivalent to two AA batteries)
|
|
|
* Microbot
|
|
|
|
|
|
# Step 2: Get Familiar With Microbots
|
|
|
## Step 2: Get Familiar With Microbots
|
|
|
Radios work by sending and receiving messages over different channels. This allows you to use on Micro:Bit to send messages and another to receive them. In this lab, you will use a Micro:bit as a controller to get user input and then send messages based on those inputs. Then, you will use a second Micro:bit to receive messages from the controller and then control the robot based on those received messages.
|
|
|
|
|
|
Start this lab by going over this basic programming example.
|
... | ... | @@ -69,25 +70,19 @@ The first set of code is for the Micro:Bit controller. This controller waits for |
|
|
|
|
|
The second set of code is for the Micro:Bot robot. This Micro:Bit waits to receive a message. If they receive a "left" message, it tells the robot to go left. If they receive a "right" message, it tells the robot to go right.
|
|
|
|
|
|
# Step 3: Download The Files
|
|
|
## Step 3: Download The Files
|
|
|
* Download (click on) the following file to get started: [MicroBotLab.zip](/uploads/99bcb034cdee9aad07dcc403efcdbe35/MicroBotLab.zip)
|
|
|
|
|
|
* Unzip MicrobotLab.zip (right click on the MicrobotLab.zip and select "extract all". Then, just pick where you want to save your copy of these files). Notice there are three folders/directories in MicrobotLab:
|
|
|
* **Attackers**: This directory holds code to simulate an attack that jams the radio channel and makes the robots behave chaotically.
|
|
|
* **HexFiles**: This folder/directory holds all of the .hex files, or files that are ready to be run on a Micro::Bit.
|
|
|
* **JavaScript**: This folder/directory holds all of the JavaScript code for the labs. This includes base code and completed code. The base code is code that you can start with instead of creating new projects from scratch. Completed code is code that members of the CEDAR lab completed that you can look at if you get stuck.
|
|
|
* **Python**: This folder/directory holds all of the Python code for the labs. This also includes base code and completed code.
|
|
|
* Unzip MicroBotLab.zip to your desired folder. For **instructions** on how to unzip click [here](how-to-download-and-open)
|
|
|
|
|
|
![microbot_files](/uploads/55820c43e18aa35782b09b8757501741/microbot_files.PNG)
|
|
|
|
|
|
# Step 4: Open your editor
|
|
|
* For JavaScript/Blocks, you will use the Micro::Bit online editor: [MakeCode](https://makecode.microbit.org/). Here, you can switch back and forth between JavaScript and Blocks by clicking on the button/slider in the top center of the screen.
|
|
|
|
|
|
![blocks](/uploads/7061a5064100caa0790c714bdb1182c1/blocks.PNG)
|
|
|
## Step 3: Download The Files
|
|
|
* **NOTE**: There is an extra folder for this lab, **Attackers**
|
|
|
* **Attackers**: This directory holds code to simulate an attack that jams the radio channel and makes the robots behave chaotically.
|
|
|
|
|
|
* For Python, you can use Mu ([click here to see Mu](https://codewith.mu/)) or the online editor ([click here to get to the online editor](http://python.microbit.org/v/1)).
|
|
|
## Step 4: Open your editor
|
|
|
* This base code is also available in the directory that you downloaded as well as this repository. If you don't remember how to open code in your editor, see the **instructions** [here](how-to-download-and-open).
|
|
|
|
|
|
# Step 5: Get Moto-Bit library
|
|
|
## Step 5: Get Moto-Bit library
|
|
|
* For JavaScript/Blocks, start by selecting the "Advanced" drop down box in the libraries toolbar.
|
|
|
|
|
|
![microbot_lib1](/uploads/8b8abbdeb2a7281e77d469955ce2fa39/microbot_lib1.PNG)
|
... | ... | @@ -104,10 +99,10 @@ You can check to make sure that you have the library by searching for the librar |
|
|
|
|
|
![microbot_lib4](/uploads/50880517646fef4065f781d017771d02/microbot_lib4.PNG)
|
|
|
|
|
|
# Step 6: Programming!
|
|
|
## Step 6: Programming!
|
|
|
**Partner up first!**
|
|
|
|
|
|
## Complete the Robot Code
|
|
|
### Complete the Robot Code
|
|
|
1. Open the robot base code by:
|
|
|
1. Go to the files you downloaded from above
|
|
|
2. Double-click on the JavaScript or Python folder
|
... | ... | @@ -128,7 +123,7 @@ You can check to make sure that you have the library by searching for the librar |
|
|
* When the command "right" is received over the radio, drive the mototbit right
|
|
|
3. Generate your robot .hex file and flash your robot Micro::Bit. If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
|
|
|
## Compelete the Controller code
|
|
|
### Compelete the Controller code
|
|
|
1. Open the controller base code by:
|
|
|
1. Go to the files you downloaded from above
|
|
|
2. Double-click on the JavaScript or Python folder. Stick with the same language as you chose for the robot_base
|
... | ... | @@ -445,7 +440,7 @@ You can check to make sure that you have the library by searching for the librar |
|
|
|
|
|
<br></br>
|
|
|
|
|
|
## Test your code
|
|
|
### Test your code
|
|
|
* Your robot should:
|
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* wait for commands from the controller
|
... | ... | @@ -454,7 +449,7 @@ You can check to make sure that you have the library by searching for the librar |
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* send commands to the robot upon various button presses: a+b is "start" and "stop", a is "left", b is "right"
|
|
|
|
|
|
## Hack <a name="hacking"></a>
|
|
|
### Hack <a name="hacking"></a>
|
|
|
* Now try to intercept other robots. Are you able to control another group's robot simply by changing what radio group you set your controller to?
|
|
|
* Are you able to control another group's robot?
|
|
|
* Does your control work with their robot?
|
... | ... | |