Chapter 3 – Vision and Navigation Technologies with Zumi

3.1 – QR Codes

Overview

You’ve probably seen Quick Response (QR) codes for a wide variety of things: to connect to WiFi, go to a URL, play games, or make payments. These codes are so popular because they are condensed labels that can easily be read by a computer.

Scanning a QR code

QR codes may look like a random array of pixels to humans, but to a computer, they contain encoded information!

QR codes store information in the form of binary numbers. Binary is the language used by computers to retrive, process and send data. In binary, information is stored in the form of 0s and 1s.

Activity: Sending instructions to Zumi using a QR code

 

Let’s try to send instructions to our Zumi bot using a QR code.

To do so, we need to ask Zumi to:

1. Turn on the camera, and scan the provided QR
2. Decode the instruction found from the QR code
3. Run the decoded instruction on Zumi

Pseudocode for Activity

 

Here are the steps we need to follow to send instructions to Zumi using a QR code.

# Import Camera
# Start Camera
# Repeat while true: -> this tells Zumi to run this block of code while the program is running

# Create an img variable and set it to take picture -> stores our scanned QR code
# Create a message variable and set it to get the QR code message and pass in the img variable
# print the message to the terminal

# if the message is "left":
# turn left by 90 degrees
# break out of the loop

# else if the message is "right":
# turn right by 90 degrees
# break out of the loop

# close the cameras

 

Try using the blockly blocks provided, and create a program for the instructions provided above!

Challenge: Binary decoding

 

Ready to go beyond? Use the ASCII chart provided below to write a short message in binary, and then swap with a friend to decode each other’s messages.

Conclusion

And that’s a wrap on QR codes! Try exploring other ways you can use QR codes to send instructions to Zumi.

In the meantime, let’s move onto the next part: Sign Detection!

Demo Video

 

Questions

 

License

Share This Book