Components of your LED Frisbee

Your Frisbee is already assembled. These are the components that went into making it, as well as the tools you will use to program it:

Icon

Glow-in-the-dark Frisbee

Everyone loves glow-in-the-dark.

Icon

RGB LEDs

Your Frisbee has 6 RGB LEDs. Each Light Emiting Diode can glow Red, Green, and Blue. By combining these 3 colors in different ways, you can create almost any color.

Icon

Premade Circuit Board

This allows the microcontroller to control the LEDs.

Texas Instruments Microcontroller (TI_PDIP_20)

Microcontroller

This is basically a small computer on a single chip. This chip will control the LEDs.

Icon

Micro USB Connector

This connector is on the frisbee board. You will use an USB cable to connect this board to your computer and use it to program your microcontroller.

MSP430 Board Layout

This is the board that will be attatched to your frisbee (color of board may vary). The board will attach to your computer using a micro USB cable (highlighted in red). This will allow you to program the MSP430 and run the LEDs.

Board Layout

Pin to LED assignments:

You can choose to re-label the LEDs in any way you want, but this lets you know the pin location of each LED.

RED1 = 20
GREEN1 = 21
BLUE1 = 19

RED2 = 17
GREEN2 = 18
BLUE2 = 16

RED3 = 3
GREEN3 = 4
BLUE3 = 2

RED4 = 6
GREEN4 = 8
BLUE4 = 5

RED5 = 10
GREEN5 = 11
BLUE5 = 9

RED6 = 13
GREEN6 = 14
BLUE6 = 12

Board Layout

Programming Help

Download Energia

If you are working at home and haven't already downloaded the programming software Energia, follow the intructions at the bottom of the page.

Instructions

1. Open a new Energia window. You can do this by double clicking on the energia.exe application.

New Energia Window

2. Copy the example code from below and paste it into the eneria window.

Example Code in Energia Window

3. Read the Basic Commands and the Color Mixing sections below so you understand what the commands mean and how they work.

4. Change the code so it does what you want it to.

5. Once you have mastered that, you can learn more in the More Programming Concepts section.

Basic Commands

Command Explanation
int RED1=17; Assigns the name RED1 to the value 17,
allowing you to turn the innermost red LED on by name rather than trying to remember the pin #.
From this point, any time you type “RED1” the program will interpret it as the value “17,” or pin #17.
pinMode(name, OUTPUT); Sets the LED as an output. Put this in the setup code.
digitalWrite(name, HIGH); Turns the LED off.
delay(time); Causes a delay for the given number of milliseconds.

Color Mixing

Color Mixing

The following colors can be achieved by turning on different LEDs (of the same number) at the same time:

Color LEDs on
Red Red
Yellow Red Green
Green Green
Cyan Green Blue
Blue Blue
Magenta Red Blue
White Red Green Blue

Example Code

Note that the code above simply turns on the LEDs 1-6 to different colors and doesn’t change, but all of the needed commands are shown.

You can copy and paste this code into energia, and then change it so it does what you want it to.

More Programming Concepts

For Loops

Allow you to repeat code several times without typing it out every time.

For Loop

The following code would cause three LEDs to blink 10 times.

for(int i=0; i < 10; i++){
  digitalWrite(LED1,HIGH);
  digitalWrite(LED2,HIGH);
  digitalWrite(LED3,HIGH);
  delay(50);
  digitalWrite(LED1,LOW);
  digitalWrite(LED2,LOW);
  digitalWrite(LED3,LOW);
  delay(50);
}

Additional Help

Additional programming help can be found at energia.nu/guide

Additional download options can be found at energia.nu/download

Note: These downloads will not work for your frisbee!

Caring For Your Frisbee

The LED Frisbee design has been carefully tested to ensure durability. However, they are not indestructible. The Frisbee should be fine for normal use, and should even be able to survive small amounts of water, but it is recommended that it be used with care, and not used in the rain or near large amounts of water.

Replacing the battery

The battery is attached with zip ties to ensure that it won’t fall out during a hard impact. Get your parents to help you clip the zip ties. If you want, you can pull out the zip ties and insert new ones, or a piece of sturdy tape, such as duct tape, will hold the new battery in place.

In case the board falls off:

The boards have been attached with industrial strength adhesive that should withstand normal use. In the unlikely event that the LED board becomes detached from the Frisbee, using strong tape, such as duct tape, should reattach the board well enough for normal use.

In case not all of the colors work

Some of the LEDs on your Frisbee might not work for every color, or may stop working eventually. If this is the case with your Frisbee, it is your job as an engineer to program a pattern that still looks cool without using that color.

In case of the chip not programming

First, make sure that you have downloaded the BYU version of Energia. This version has been specially modified to work with your frisbee board. Next, check to make sure that you are connecting to the correct device within energia. If these are not your problems then unfortunately, electronics cannot be made to last forever. A microcontroller such as the MSP430 will eventually fail overtime and use. If this happens, there isn't much you can do, but you still have a great glow-in-the-dark frisbee! Note: It should only fail after A LOT of use. This most likely won't happen to you.

Glossary

int Short for integer (a number). It is used in a program to assign a variable, which can be used to give a number value (in this case a pin number) a name that is easy to remember. If this is done at the beginning of the program, any time that name is used, the program will interpret it as the number.
Variable A name or symbol that is assigned to a value, such as using int RED1 = 15; to assign the value of 15 to the name RED1.
LED Short for light emitting diode. A small, bright light that requires little power to turn on.
RGB Short for red, green, and blue. Since these are the primary colors of light, they can be combined to make any color.
Pin The chip for the microcontroller has several pins. Writing programs in energia allows you to control whether or not electricity flows through one of the pins. In the case of the Frisbee, this allows you to decide which LEDs are turned on.
Loop A part of a program that repeats continually.
“for” loop A loop that continues until the conditions set for the loop are completed
Pulse width modulation The process of turning on and off an LED quickly such that it appears to be dimmer or brighter. This is done using a loop or a delay.
Programming Language Computers only really only understand 1’s and 0’s. However, to make things easier for people, programming languages have been created, which the computer then compiles down to 1’s and 0’s. This way, both people and the computer can understand what is happening. A programming language generally consists of specific, simple commands, which can be combined to do many things. The programming language for energia is specifically made to make programming simple for the MSP430 Launchpad.
Energia A simple programming language specifically for the MSP430 Launchpad.
Algorithm Computers are very useful and fast, but they aren’t very smart. They can only accept specific, simple commands. A list of simple commands that can be used to accomplish a task is called an algorithm.
Electrical Engineer A cool person that gets paid a lot of money to do awesome stuff.

Energia Installation Instructions

1. Click on the correct link below for your operating system to start downloading!


BYU Energia for Windows:

Download here: Windows BYU Energia


BYU Energia for Linux (64-bit):

Download here: Linux BYU Energia


BYU Energia for MacOS (Mojave - 1.14 or older):

Download here: MacOS BYU Energia


You may need the Silicon Labs driver in order to connect to your board

Download Driver here: Silicon Labs Driver Webpage



2. Go to your downloads folder. Look for BYU-Energia.msi installer and click on it.

Energia Folder

3. This starts the BYU Energia installer, follow the instructions shown.

Next Energia Folder

4. Wait for the installer to finish, this may take a few minutes.

5. Open the energia-BYUv1.0 folder

Extract All Screenshot

6. The energia.exe application in your folder should now work. Double click on it and a new energia window should pop up. See the programming help section for instructions on how to begin programming your frisbee using energia.
Note: You may need to run the program as administrator or as root.



Sample Code

The following section contains the code you'll need during Chip Camp. As your camp counselors direct, copy and paste the code for each day's project into your IDE. Note that this code is not complete: you'll have to fill in some functions as part of your project!


Initial Code for Day 1: Microcontroller and LEDs


// Generic code for the LED Breadboard part of the Innovations Module
// assert high. Code turns on/off all five LEDs every second.


#define ledOne 2
#define ledTwo 3
#define ledThree 4
#define ledFour 5
#define ledFive 6


void setup() {
    // put your setup code here, to run once:
    pinMode(ledOne, OUTPUT);
    pinMode(ledTwo, OUTPUT);
    pinMode(ledThree, OUTPUT);
    pinMode(ledFour, OUTPUT);
    pinMode(ledFive, OUTPUT);
}

void loop() {
    // put your main code here, to run repeatedly:
    digitalWrite(ledOne, LOW);
    digitalWrite(ledTwo, LOW);
    digitalWrite(ledThree, LOW);
    digitalWrite(ledFour, LOW);
    digitalWrite(ledFive, LOW);
    delay(1000); //1000 = 1 second

    digitalWrite(ledOne, HIGH);
    digitalWrite(ledTwo, HIGH);
    digitalWrite(ledThree, HIGH);
    digitalWrite(ledFour, HIGH);
    digitalWrite(ledFive, HIGH);
    delay(1000);
}


Initial Code for Day 2: Carduino


/*
* Chip Camp Car
* Michael Eyler
* May 2018
*/

#define enR 3 //Right motor enable (PWM)
#define R1 4 //Right motor port 1
#define R2 5 //Right motor port 2
#define enL 9 //Left motor enable (PWM)
#define L1 7 //Left motor port 1
#define L2 8 //Left motor port 2
int motorSpeed=130;



void setup() {
    pinMode(enR, OUTPUT);
    pinMode(R1, OUTPUT);
    pinMode(R2, OUTPUT);
    pinMode(enL, OUTPUT);
    pinMode(L1, OUTPUT);
    pinMode(L2, OUTPUT);
    analogWrite(enR,motorSpeed);
    analogWrite(enL,motorSpeed);
}

void loop() {
    //Go straight for 2 seconds
    forward(2000);
    //Go left for 0.5 seconds
    left(500);
}

void cease() {
    digitalWrite(R1,LOW);
    digitalWrite(R2,LOW);
    digitalWrite(L1,LOW);
    digitalWrite(L2,LOW);
}

void forward(int dis) {
    digitalWrite(R1,HIGH);
    digitalWrite(R2,LOW);
    digitalWrite(L1,HIGH);
    digitalWrite(L2,LOW);
    delay(dis);
    cease();
}

void left(int ang) {
    digitalWrite(R1,HIGH);
    digitalWrite(R2,LOW);
    digitalWrite(L1,LOW);
    digitalWrite(L2,HIGH);
    delay(ang);
    cease();
}

Initial Code for Day 3: Glow-In-The-Dark Frisbee


// BYU Chip Camp 2019
// Innovations Module - LED Frisbee
// Template code - turns on each light, one at a time


#define RED LOW,HIGH,HIGH
#define YELLOW LOW,LOW,HIGH
#define GREEN HIGH,LOW,HIGH
#define CYAN HIGH,LOW,LOW
#define BLUE HIGH,HIGH,LOW
#define MAGENTA LOW,HIGH,LOW
#define WHITE LOW,LOW,LOW
#define OFF HIGH,HIGH,HIGH

int LEDs[6][3] = {
    {20, 21, 19}, //LED1
    {17, 18, 16}, //LED2
    {3 , 4 , 2 }, //LED3
    {6 , 8 , 5 }, //LED4
    {10, 11, 9 }, //LED5
    {13, 14, 12} //LED6
    //RED, GREEN, BLUE
};

// Function that turns on a specified LED to a specific color
void writeRGB(int LEDNUM, int c1, int c2, int c3){
    digitalWrite(LEDs[LEDNUM-1][0], c1);
    digitalWrite(LEDs[LEDNUM-1][1], c2);
    digitalWrite(LEDs[LEDNUM-1][2], c3);
}

// Function that turns off all 6 LEDs
void clearLEDs()
{
    for(int x=1;x<=6;x++)
    {
        writeRGB(x,OFF);
    }
}

// put your setup code here, to run once:
void setup()
{
    // This code cycles through each pin and sets it up as an output
    for(int i = 0; i < 6; i++){
        for(int j = 0; j < 3; j++){
            pinMode(LEDs[i][j], OUTPUT);
        }
    }
    clearLEDs();
}

void loop()
{
    //Basic Colors - Red, Green, and Blue
    
    writeRGB(1,RED); //Turn the first one RED
    
    delay(750); //Wait 750 milliseconds
    
    writeRGB(2,GREEN); //Turn the second one GREEN
    
    delay(750);
    
    writeRGB(3,BLUE); //Turn the third one BLUE
    
    delay(750);
    
    writeRGB(4,WHITE); //White - All colors combined!
    
    delay(750);
    
    writeRGB(5,BLUE); //Turn the fifth one BLUE
    
    delay(750);
    
    writeRGB(6,GREEN); //Turn the sixth one GREEN
    
    delay(2000);
}

This software is licensed under the GNU General Public License which means that in order to distribute this software, we must have the source code available to the general public. The source code is quite large and we wish to not host it on our website. If you desire to have access to the source code, go to the energia git hub webpage, download those files, then apply the appropriate patch listed below. You must also change the pins_energia.h file. This file is located under energia_byu\hardware\msp430\variants\launchpad\pins_energia.h. This is also available as a BSP from energia.

Windows Patch
Linux Patch
MacOS Patch
pins_energia.h