Skip to main content

10

Minor Versionm

by Joshua

Introduction

Use a micro:bit to build a Binary Calculator with a 4 bit register to learn how binary works and how to calculate a decimal number from a binary number.

Video Overview

Featured Document

  1. We're going to build our circuit on a large LEGO baseplate. We'll need enough room for the Bit Board, 4 switches, one button, and the 7 Segment Display. Connect the four switches and the button as shown. Each needs to be connected to ground (GND) and to the appropriate pin.
    • We're going to build our circuit on a large LEGO baseplate. We'll need enough room for the Bit Board, 4 switches, one button, and the 7 Segment Display.

    • Connect the four switches and the button as shown. Each needs to be connected to ground (GND) and to the appropriate pin.

    • The PDF for this guide contains a lot of useful information about how binary works. Don't forget to check it out!

    • If you like this project check out our Binary Math Game guide!

  2. Using Female/Female jumper wires connect the 7 Segment Display to the pins on the back of the Bit Board. You can use whatever wire colors you like, but typically we try to use red for positive, black or green for negative (ground) and colors like orange, yellow, blue, brown, etc. for "signal" wires. You can position the components closer or farther apart, as long as you have space to run the Maker Tape to make all the connections.
    • Using Female/Female jumper wires connect the 7 Segment Display to the pins on the back of the Bit Board.

    • You can use whatever wire colors you like, but typically we try to use red for positive, black or green for negative (ground) and colors like orange, yellow, blue, brown, etc. for "signal" wires.

    • You can position the components closer or farther apart, as long as you have space to run the Maker Tape to make all the connections.

    • Make sure each path of tape from a component to the Bit Board does not cross over another path. That would cause a short circuit!

    • Remember, Maker Tape is conductive on both sides, so if you cut a piece too short you can just stick another piece on top of it to continue your circuit.

  3. Sometimes we build up a LEGO contraption to hold things like our 7 Segment Display, and sometimes we design and 3D print something... but sometimes simple is best, and some tape or a well placed rubber band does the job. For this project we just built up a small wall of LEGO bricks and mounted our sensor to it using a rubber band. (It works!)
    • Sometimes we build up a LEGO contraption to hold things like our 7 Segment Display, and sometimes we design and 3D print something... but sometimes simple is best, and some tape or a well placed rubber band does the job.

    • For this project we just built up a small wall of LEGO bricks and mounted our sensor to it using a rubber band. (It works!)

  4. This step is completely optional, but sometimes labels are helpful. Is the first switch 8 or is it 1? Is the switch on when it's up or down? With a few labels you won't have to remember! :)
    • This step is completely optional, but sometimes labels are helpful.

    • Is the first switch 8 or is it 1? Is the switch on when it's up or down? With a few labels you won't have to remember! :)

  5. Connect a USB cable to the micro:bit and then plug it into your computer.
    • Connect a USB cable to the micro:bit and then plug it into your computer.

    • We'll be using makecode.microbit.org to program our board. It uses a simple drag and drop block interface.

    • We're going to load the following code for our Binary Calculator program: https://makecode.microbit.org/_avbceA0oH...

    • The attached PDF for this guide goes into great details explaining the code and what each section does.

  6. Once you've got the code loaded on the micro:bit you can test it out.
    • Once you've got the code loaded on the micro:bit you can test it out.

    • For this project you can either power the Bit Board using a 2 AAA battery pack, or by keeping the USB cable plugged directly into the micro:bit

    • Can you step through the sequence to count from 0 to 15 by selecting the position of each switch and pressing the Calculate button? Challenge your friends to see who can do it faster, or who can do it without making any mistakes.

  7. This binary calculator has a 4 bit register and counts to 15. How high could you count with a 16 bit register? How about a 32 bit register?
    • This binary calculator has a 4 bit register and counts to 15. How high could you count with a 16 bit register? How about a 32 bit register?

    • The attached PDF has a good explanation of bits and how binary systems work, including a handy chart you can use to visualize how to set the switches to get the desired decimal.

Finish Line

Attached Documents

Pete Prodoehl

Member since: 03/04/2020

281 Reputation

278 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 0

Past 7 Days: 1

Past 30 Days: 10

All Time: 825