Skip to main content

1.1

Major VersionM

by Pete Prodoehl

Introduction

Connect a Distance Sensor to a Bit Board and view the output using the built-in LED Matrix on the micro:bit

Video Overview

Featured Document

  1. We'll connect the Distance Sensor with a Crazy Circuits Ribbon Cable using all four wires. Plug the three-wire connector of the Crazy Circuits Ribbon Cable into the row with Pin 13 on the Bit Board. The wire colors should match the pin header colors, with S1 (yellow) going to the yellow pin. Next, plug S2 (orange) into Pin 14. (S2 is separated from the three-wire connector to allow you to plug it into another row.)
    • We'll connect the Distance Sensor with a Crazy Circuits Ribbon Cable using all four wires.

    • Plug the three-wire connector of the Crazy Circuits Ribbon Cable into the row with Pin 13 on the Bit Board. The wire colors should match the pin header colors, with S1 (yellow) going to the yellow pin.

    • Next, plug S2 (orange) into Pin 14. (S2 is separated from the three-wire connector to allow you to plug it into another row.)

    • Plug + (red) into VCC; S2 (orange) into TRIG; S1 (yellow) into ECHO; and - (black) into GND.

  2. We used a 3D printed part we designed to hold the Distance Sensor in place on the LEGO baseplate. A few Technic pins, a Technic beam, and a some LEGO bricks are all that is needed. Alternately you can use some LEGO bricks and a rubber band or tape to hold the sensor in place. (But don't use anything conductive!)
    • We used a 3D printed part we designed to hold the Distance Sensor in place on the LEGO baseplate.

    • A few Technic pins, a Technic beam, and a some LEGO bricks are all that is needed.

    • Alternately you can use some LEGO bricks and a rubber band or tape to hold the sensor in place. (But don't use anything conductive!)

    • 3D print your own Distance Sensor Holder with Holes. (It's the same one we use in our Bit Boar Rover Kit).

  3. If you've never used a micro:bit before you'll want to check out this guide:  Bit Board V2 Setup and Use
    • If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use

    • We're going to load the following code for our Distance Sensor 0-9 program: https://makecode.microbit.org/_b63Aw82fF...

    • In the forever block we'll set Pin 14 and Pin 13 to TRIG and ECHO (respectively) so we can read the Distance Sensor. This allows us to continually read the sensor and assign the value to distance.

    • We then check if the distance is lower than 10 and if so we show the distance on the LED matrix as a number.

    • If the distance is 10 or greater we'll just show an "X" on the LED matrix.

    • Once the code is loaded it should start running immediately.

    • You can power the micro:bit via the USB cable you used to load the code or you can use a battery pack plugged into the Bit Board.

    • Move your hand (or a flat object) in front of the sensor. When you are within 10cm of the sensor it should show a number... otherwise it will show an X.

  4. Follow along with our recorded Live Stream!
    • Follow along with our recorded Live Stream!

    • (We'll add the video to this step after we do the stream!)

Finish Line

Pete Prodoehl

Member since: 3/4/20

2,040 Reputation

444 Guides authored

0 Comments

Add Comment



View Statistics:

Past 24 Hours: 0

Past 7 Days: 14

Past 30 Days: 16

All Time: 16