SparkFun gator:bit v2 Hookup Guide

Pages
Contributors: LightningHawk, Englandsaurus
Favorited Favorite 1

Introduction

The SparkFun gator:bit v2 is a development board for the BBC micro:bit. Almost every pad of the micro:bit is broken out to alligator clippable pads, on the gator:bit, so you can get the most out of it. The gator:bit comes equipped with five addressable LEDs, a built-in buzzer (speaker), as well as a power management system that gives you access to 3.3V and 5V. The gator:bit can be powered from 2.7V - 9V giving you quite a range of powering options.

SparkFun gator:bit v2.0 - micro:bit Carrier Board

DEV-15162
2 Retired

Without any external hardware, the gator:bit (v2) is still an exploratory development board for micro:bit. Whether it is data visualization using the on board addressable LEDs or creating musical works of art using the built-in speaker we've got it covered with the with the gator:bit.

With some alligator clips and extra hardware you'll be able to explore inputs like sensors, potentiometers, and buttons and control outputs like lights, motors, and speakers.

Required Materials

Here are some products that will help you get started with the gator:bit:

Suggested Materials

In addition to the above, here are some products to get you started with building circuits to control inputs and outputs using the gator:bit:

SparkFun gator:log - micro:bit Accessory Board

SparkFun gator:log - micro:bit Accessory Board

DEV-15270
$13.95 $7.25

SparkFun gator:soil - micro:bit Accessory Board

SEN-15272
Banana to Banana Cable - Right Angle

Banana to Banana Cable - Right Angle

CAB-15368
$4.95 $4.46
1

Suggested Reading

If you aren't familiar with the micro:bit, we recommend reading here for an overview.

If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing.

What is a Circuit?

Every electrical project starts with a circuit. Don't know what a circuit is? We're here to help.

Voltage, Current, Resistance, and Ohm's Law

Learn about Ohm's Law, one of the most fundamental equations in all electrical engineering.

What is Electricity?

We can see electricity in action on our computers, lighting our houses, as lightning strikes in thunderstorms, but what is it? This is not an easy question, but this tutorial will shed some light on it!

Light-Emitting Diodes (LEDs)

Learn the basics about LEDs as well as some more advanced topics to help you calculate requirements for projects containing many LEDs.

Hardware Overview

Features:

  • micro:bit card edge connector
  • Barrel Jack (5.5 x 2.1mm)
  • Input voltage: 2.7V - 9V
  • 5 built in addressable LEDs
  • Built in buzzer
  • 5V output
  • 3.3V output
  • 7 protected input/output pins
  • 3 pins for SPI communication
  • 2 pins for I2C
gator:bit v2 with micro:bit

Powering Your gator:bit

There are 3 ways of powering your gator:bit v2, either from the barrel jack, the alligator clippable pads labeled VIN, or through the micro:bit itself. On the gator:bit, any input voltage between 2.7V and 9V will be regulated to 3.3V to power the micro:bit, the speaker, and for use by any of the alligator clippable pins. 5V is also regulated or boosted from the input voltage to power the LEDs and any off-board hardware you would like to use like servo motors. When the gator:bit is powered, the power indication LED, highlighted in red below, will turn on.

Whether you are providing power from either the barrel jack or from a clipped source, the gator:bit can be used with a USB on the micro:bit. The power circuitry for the gator:bit is arranged so that the board uses the largest power source.

Power options highlighted

Power options. Power indication LED highlighted in red.

Input Pins

I/O Protected Pins

The point of gator:bit (v2) is to give you access to as much GPIO as possible from the micro:bit, safely. Not only are pins 0, 1, 2, 8, 16, 5 (Button A), and 11 (Button B) broken out, but they are also protected against overvoltage and overcurrent/short circuit. Pins 0, 1, and 2 are ADC pins; while, pins 8, 16, 5, and 11 are digital pins capable of read and write.

Note: Due to the protection diodes, the capacitive sense functionality of pins 0, 1, and 2 may be limited, if not non-existent.

Highlighted Pin Tabs

Input pins.

I2C and SPI Serial

The gator:bit also provides access to pins 13, 14, 15, 19 & 20. These are digital pins that can be used to read and write digital signals. Pins 13, 14, & 15 are also SPI communication pins giving you the ability to use SparkFun's SPI sensors with the gator:bit. Pins 19 & 20 are I2C communication pins which extend the use of the micro:bit to include all of SparkFun's I2C sensors.

Read/Write Digital Ports

Read/Write digital ports.

Outputs

Voltage Output

The gator:bit (v2) gives you access to more micro:bit pins and it also gives you access to 3.3V and 5V. Your servo action is about to get a little cleaner and you'll be able to easily power peripheral hardware.

In order to use the voltage out tabs, the VOUT switch needs to be switched on. Having the option to turn it off is great when when you don't need it.

VOUT Switch Highlighted

VOUT switch.

On the right side of the board there are two "OUT" pins. One for 5V and one for 3.3V. You will know when the output voltage is available because two red LEDs will turn on right above the pad. You can use either of the two ground pads since all ground is connected.

VOUT Ports Highlighted

VOUT Ports.


Now let's look at the fun kind of output, light and sound! On the bottom left is a buzzer. We chose a small speaker on purpose. You'll be able to explore creating digital music and then listen to it right on the gator:bit. You can easily attach a larger speaker when you are ready to show off your work.


Piezo Speaker

You'll notice another switch here. The speaker is attached to pin 0, so if you want to play music the music switch needs to be on and you won't be able to use pin 0. Conversely, if you want to use pin 0, the music switch needs to be switched off.

Speaker and Music switch highlighted

Speaker and music switch.

Addressable LEDs

LEDs! Addressable LEDs! Connected to pin 12 are 5 addressable LEDs with the first LED on the left. The Neopixel MakeCode extension is an excellent way to control these. We have a few examples using the extension coming up.

Highlighted LEDS

LEDs!

Programming Environments

There are several programming environments to use your micro:bit and gator:bit with.

MakeCode

Makecode is a web application based on block programming. The blocks then directly convert to Javascript; you can switch back and forth for ease of inspection. To upload your program to the micro:bit you download the project and drag and drop it on the micro:bit.

A quick start guide on MakeCode is the best way to become familiar with blocks, extensions, downloading and running programs on the micro:bit.

From the start you are presented with the basic building blocks on a program. on start is where your setup is, variable declarations, and any other start up messages or images. forever is your looping function. If you want to blink an LED you'd turn an LED on for some amount of time and off for some amount of time the loop would allow that to repeat forever.

MakeCode screen shot

Click the image to get a closer look.

On the left hand side there is a simulation of the program with the micro:bit and the extension list. Once you've clicked on a extension list, you'll be provided with the blocks associated with that extension.

Input Packages Highlighted

Click the image to get a closer look.

Since the blocks are based on Javascript and you can switch between looking at a program in blocks and Javascript, Makecode is a great way to start programming fast and learn another language as you go.

Makecode javascript highlighted

Click the image to get a closer look.

EduBlocks

Similar to MakeCode there is another web and block based programming environment called EduBlocks. EduBlocks translates directly to Python 3.

Using the built in sample program you can explore how to use the blocks and load the program to the micro:bit.

EduBlocks Sample Program

Click the image to get a closer look.

By clicking on the "Blocky" tab on the right the block code is converted to Python 3.

Example block of Python 3

Click the image to get a closer look.

Another great way to start programming fast and learn another language as you go.

Others

micro:bit also has a Python Editor for Micropython. Micropython is a subset of Python 3 that was made specifically for microcontrollers like the micro:bit!

The micro:bit can also be programmed in Arduino. Even better, since the micro:bit has bluetooth and radio it works with a neat app called Blynk. You can create programs in Arduino then send and receive data via app. Sending data can even update the micro:bit to customize output in real time like lights.


Hardware Assembly

Assembly

Simply, insert the micro:bit into the slot on the gator:bit v2 as shown below.

micro:bit inserted to gator:bit v2

A micro:bit inserted into the gator:bit v2.

Programming

To program the micro:bit for the following examples, simply connect it to your computer with a USB micro-B cable. You will drag and drop the downloaded .hex files into the disc drive that the micro:bit emulates.

micro:bit connected to a laptop

A micro:bit connected to a laptop with a USB cable.

Standalone Power

To power gator:bit for the following examples, you can either power everything through the gator:bit or micro:bit. On the gator:bit, you can use the barrel jack or VIN and GND pads. On the micro:bit, you can use the JST battery terminal or USB micro-B connector.

gator:bit v2 powered through barrel jack with 4xAA battery pack

The gator:bit v2 powered through barrel jack with 4xAA battery pack.

Example Project: LED Animations

Installing the NeoPixel Extension for Microsoft MakeCode

Heads up! The following examples use MakeCode, which is a third party software and is therefore, subject to changes we may be unaware of. For most cases, you should be able to search the internet for information regarding the changes and how to work around them. For Example:

Previously, the libraries were referred to as MakeCode packages. They are now referred to as MakeCode extensions.
Doing a Google search for "makecode packages change", the first search result is Frequently Asked Questions - Microsoft MakeCode, which at the end of the article details that information.

To use the addressable LEDs on the gator:bit, you will need to install a MakeCode extension. Click on Advanced -> Add Extension. Search for the neopixel extension and click on the extension to add it to your list of usable extensions.

MakeCode Extensions

Example

Re-create the following code into your MakeCode editor or download the example by clicking the download button to test it out!


This program starts out with a rainbow pattern across the LEDs and then turns the LEDs off sequentially from the left. Once they have all turned off, a new animation will start sequentially from the left; the LEDs will turn blue but will fill the previous LEDs with a random color rather than turning off. The brightness is turned down to 75 to save your eyes and your battery life!

Example Project: Button Melody Player

This project makes use of the speaker and buttons A and B. This project is easily extendable by using alligator clips on pins 5 (button A) and 11 (button B) to trigger the button-press event using external hardware like buttons or reed switches.

Example

Re-create the following code into your MakeCode editor or download the example by clicking the download button to test it out!


At the start of the program an eighth note is displayed on the micro:bit's 5x5 LED matrix. When button A or B is pressed a video game type melody is played. You can choose from several melodies or make one of your own. By adding a few more buttons and using the "on pin __ pressed" code block on pins 0, 1, or 2, you could create a 5 button drum machine or synthesizer!

Example of "is pressed" block

This function can be found in the "input" extension in makecode.

Resources and Going Further

For more information, check out the resources below.



For additional SparkFun tutorials, check out some of these related micro:bit tutorials:

micro:bit Educator Lab Pack Experiment Guide

A quickstart guide for the micro:bit educator lab pack.

micro:climate Kit Experiment Guide

A weather station kit that is built on top of the inexpensive, easy-to-use micro:bit and Microsoft MakeCode.

micro:bot Kit Experiment Guide

Get started with the moto:bit, a carrier board for the micro:bit that allows you to control motors, and create your own robot using this experiment guide for the micro:bot kit.

Wireless Remote Weather Station with micro:bit

Monitor the weather without being exposed to it through wireless communication between two micro:bits using the radio blocks! This is useful if your weather station is installed in a location that is difficult to retrieve data from the OpenLog. We will also explore a few different ways to send and receive data.

Try exploring micro:bit with cardboard circuits!