Maker.io main logo

Gator:color ProtoSnap Hookup Guide

2018-11-08 | By SparkFun Electronics

License: See Original Project micro:bit

Courtesy of SparkFun

Introduction

The gator:color is one of a series of gator-clippable boards called gator:boards that SparkFun has created to interface with the micro:bit and gator:bit expansion for micro:bit. The gator:color has a smattering of a different color LEDs that can be used either in place or broken away from the main board. In this hookup guide we’ll go over how to light up our LEDs, both by simply turning them on and also by dimming them using a process called Pulse Width Modulation (PWM).

Figure 1

SparkFun gator:color ProtoSnap

 

Required Materials

For this activity, you’ll of course need a micro:bit. You’ll also need some alligator clips to connect everything together, and a micro usb cable to program your micro:bit. All of these things are shown below, so grab them if you haven’t already. You can go ahead and grab a gator:bit as well to create some more robust projects, but you’ll be able to get along fine with just a micro:bit.

Suggested Reading

If this is your first time using a gator:bit, check out the gator:bit Hookup Guide.

Figure 2

Gator:bit Hookup Guide

May 10, 2018

Gator:bit is a rugged development breakout board for the BBC micro:bit. gator:bit exposes almost every pin on the micro:bit to an alligator clippable pad. Gator:bit features over-voltage, over-current, and short circuit protection circuitry on every IO pin as well as built-in addressable LEDs, built-in buzzer, and a power management solution to give you sensible powering options.

Also, if you’re starting out with electronics and 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.
  • Analog vs. Digital: This tutorial covers the concept of analog and digital signals, as they relate to electronics.
  • Getting Started with the micro:bit: The BBC micro:bit is a compact, powerful programming tool that requires no software installation. Read on to learn how to use it YOUR way!

Hardware Overview

The gator:color is perfect if you want to add a low-profile glowing component to your project. The gator:color contains 6 monochrome LEDs, which means that each light only emits one color. On board there are two white LEDs, along with one each of red, green, blue, and yellow LEDs. The board has power tabs broken out on the edges so that the board doesn’t have to be broken apart to light up the LEDs.

Powering your LEDs

The LEDs can be powered through either of two ways. The first simply turns the LEDs on, and is done by clipping the - side of the LED to ground on the micro:bit and connecting the to 3V on the micro:bit. The other way to control these LEDs would be to connect the gator:color’s Power to pins 0, 1 or 2 on the micro:bit (with Ground connecting to Ground). This method gives you more control over your LEDs, allowing you to turn the LEDs on and off with the micro:bit, as well as change the brightness level using Pulse width modulation (PWM).

Power Tabs

Power Tabs

If and when you choose to incorporate your gator:color LEDs into a project, there is also a breakout power strip at the top of the board that you can use.

Figure 4

Power Strip

Breaking Apart Your Board

Each of the LEDs can be broken away from the board to be lit individually. To do so, twist the LED board gently from side to side until it pops out. The connection points are highlighted in the image below.

Figure 5

Break points for gator:color LED tabs

The Power Strip breaks out in a similar manner as the LED boards. Break points are highlighted below.

Figure 6

Break points for gator:color power strip

Hardware Assembly

Let’s start by simply turning the LEDs on. Using your alligator clips, connect the - side of the LED to ground on the micro:bit and connect the to 3.3V on the micro:bit. You should see all of the gator:color’s LEDs light up. This type of setup is shown in the photo below.

Figure 7

If you want to dim the LED or control it with the micro:bit, you can connect the on the LED to any of pins 0, 1 or 2. LEDs are either on or off, with no brightness in between, so we control brightness by turning the light on and off very fast in a process known as PWM. Connect your pins as you see in the image below and we’ll go over the code necessary to dim your LEDs in the next section.

Figure 8

Using with the gator:bit If you are using the gator:bit, keep in mind that you'll have to use pins P15, P14 or P13 to drive your LEDs, as the protection circuitry on the rest of the gator:bit pins does not create a high enough voltage to drive some colors of LED.

Using MakeCode

As you’ve seen, it’s pretty simple to get your LEDs to simply light up; just connect power to power and ground to ground. However, if you want to do some fancy dimming or flashing effects, you’ll need to upload some code to your micro:bit.

If you’ve never used MakeCode before, refer to the Using MakeCode section of our Getting Started with the Micro:Bit.

Figure 9

Getting Started with the micro:bit

March 21, 2017

The BBC micro:bit is a compact, powerful programming tool that requires no software installation.

Read on to learn how to use it YOUR way!

Dimming LEDs is done using Pulse Width Modulation. To use PWM in MakeCode, go to Advanced->Pins and select the analog write block, shown below.

Analog Write Block

Analog Write Block

The analog write block defaults to a value of 1023, or 100%. If you wanted to turn the light down to 50% brightness, you’d plug a value of 511 into your analog write function. Of course, you also want to make sure that whichever pin is selected in the MakeCode block is the pin that is clipped to the pin on the LEDs. This can be done with any of the LEDs to create patterns with different brightnesses or even flashing LEDs.

Example: LED Pulse

The following example will gradually turn the LEDs up to full brightness, then gradually go back down. This will fade the LED’s on and off. To do this, we write the value LightValue (Which we initialize to 0 in our on start function) to our analog pin P0 (3.3V from the LED’s should be connected to this pin). We then add lightStep (which we set to 5 in our on start function) to LightValue, which changes the brightness by a tiny amount. Once LightValue reaches its maximum (1023) we multiply lightStep by -1, changing the value of lightStep to -5. This means that when we add lightStep to LightValue, LightValue will decrease. We do the same thing (multiply by -1) when LightValue reaches 0 to flip the direction around again. Finally, we add a delay of our choosing from Advanced->Control in to slow our fade down a little bit. The whole program is shown below.

Figure 11

Pulsing LED Code

Resources & Going Further

Now that you have the hang of the gator:color, what will you light up? Have a look at some of the resources below for more information and inspiration!

制造商零件编号 DEV-14208
MICRO:BIT EVAL BRD
SparkFun Electronics
制造商零件编号 DEV-14484
GATOR:BIT
SparkFun Electronics
制造商零件编号 PRT-12978
TEST LEAD GATOR TO GATOR 19.7"
SparkFun Electronics
制造商零件编号 PRT-14299
MICRO:BIT BATTERY HOLDER - 2XAA
SparkFun Electronics
制造商零件编号 COM-14890
SPARKFUN GATOR COLOR PROTOSNAP
SparkFun Electronics
制造商零件编号 DEV-15162
GATOR:BIT V2.0 CARRIER BOARD
SparkFun Electronics
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum