FRC team 5584. Est. 2014

 

 

Follow Our Progress

Keep updated with the team by following our social media channels. For exciting highlights videos and robot reveals, be sure to subscribe to our YouTube channel!

Read more

 

Robocamps

Come and join us at one of our Robo Camp workshops! Held at three locations across the Eastern suburbs of Melbourne. Register on our website now!

Read more

 

Our Sponsors

The companies that support our team to run each season and are helping us promote a bright future for STEM in Australia. 

Read more

 

What do I need to complete this exercise?

  • 1 x Arduino Leonardo board
  • 1 x Plug pack 9v 1A DC with 2.1mm diameter center-positive jack
  • 1 x USB cable (Type-A to Micro-B)
  • 1 x PC with the Arduino IDE (see Setting Up Arduino IDE)
  • 1 x Battery (12v)
  • 1 x Addressable LED strip (5m, 12v)

 

How do I connect the Arduino to the LED Strip?

NOTE: we only connect to one end of the LED strip - connect to the end with the two arrows pointing away from the wires.

NOTE: if you are observing any wierd behaviour when using the arduino then double check the connections here. Poor earth connection between Arduino and LED strip will result in all sorts of random light sequences, you have been warned! 

  1. Connect one red wire from the LED strip to the positive terminal of the 12v battery
  2. Connect one white wire from LED strip to the negative terminal of the 12v battery
  3. Connect other white wire from LED strip to the GND (next to PIN 13) of the Arduino board
  4. Connect the green wire from the LED strip to PIN 6 of the Arduino board
  5. The remaining red wire does not need to be connected - make sure the end is insulated with tape

 

How do I program the arduino?

  1. If you have not already done so, refer to the artcle: Setting Up Arduino IDE
  2. Download AdaFruit NeoPixel library from github (see "Download Zip" button at http://github.com/adafruit/Adafruit_NeoPixel)
  3. Unzip the library file
  4. If necessary, rename the root directory of the unzipped file structure to Adafruit_NeoPixel (in our case it unzipped as "Adafruit_NeoPixel-master" so we had to rename to "Adafruit_NeoPixel")
  5. Move to your home directory:
    • If you have Windows on your PC: move the directory to C:\Users\USERNAME\Documents\Arduino\libraries\Adafruit_NeoPixel
    • If you have Linux on your PC: move the directory to /home/USERNAME/sketchbook/libraries/Adafruit_NeoPixel
  6. Check that the Adafruit_NeoPixel library is correctly located by looking at the path to the Adafruit_NeoPixel.h file, it needs to look like this: .../libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h. If there is an extra "Adafruit_NeoPixel-master" or "Adafruit_NeoPixel" directory then move the files up one directory level.
  7. We can now create a program to make use of the Adafruit_NeoPixel library - do this by copying the sample code from the next section into the main window of the Arduino IDE.
  8. Select "File" then "Save as" and save the project as "led_light_strip"
  9. Upload using "File" > "Upload" (or CTRL+U) as described in the Setting Up Arduino IDE article, refer to that article if you have any difficulty with uploading to the Arduino
  10. The program should illuminate each of the 80 LEDs until they are all lit RED and then switch each one off until they are all unlit, this is repeated for GREEN and then again for BLUE before the program is automatically restarted on the Arduino so the sequence repeats indefinitely

 

What code should I load onto the arduino?

The following code will cycle all of the pixels in the LED strip through all three primary colours (RED then GREEN then BLUE) at full brightness. Note that on our 5m strip each pixel is 3 LEDs and there are 80 such pixels so this program manages 240 LEDs in total:

#include <Adafruit_NeoPixel.h>

// specify the pin that we use to control the
// light strip
#define PIN 6
// in our case we have 3 LEDs per pixel so 240 LEDs
// equates to 240/3=80 pixels #define NUMPIXELS 80

// delay to control speed of the light effect
#define DELAYVAL 20

// construct and configure the pixel array
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() { pixels.begin(); // This initializes the NeoPixel library. }
// Most of the world specifies colours in the order "R-G-B"
// but for some reason this library (or maybe it is the
// cheap LED light strip that we have) has the order "R-B-G"
// instead. Anyway, here are some colours to play with ...
//
//       R   B   G   COLOUR
//     ====================
//       0   0   0   OFF
//     255   0   0   RED
//       0   0 255   GREEN
//       0 255   0   BLUE
//     255 255 255   WHITE
//     255   0 255   YELLOW
//     128 255   0   PURPLE
//     175 148  75   PINK
//     237   6 120   ORANGE
void loop() { // For a set of NeoPixels the first NeoPixel is 0, second is 1 // all the way up to the count of pixels minus one
// There are alternative ways of writing this code but this
// code illustrates how easy it is to get some good effects
// with some very simple software ...
for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(255,0,0)); // RED // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(0,0,0)); // OFF // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(0,0,255)); // GREEN // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(0,0,0)); // OFF // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(0,255,0)); // BLUE // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } for(int i=0;i<NUMPIXELS;i++){ // pixels.Color takes RBG values
// from 0,0,0 up to 255,255,255 pixels.setPixelColor(i, pixels.Color(0,0,0)); // OFF // send updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds). delay(DELAYVAL); } }