Exercise 18. Final Project



Project Development - Embedded Programming


ISS



  • I have done a lot of research as result of this topic learning everything from hex code to the International Space Station. Here is a link to my resources.

    Work Flow

    Once I was able to access the ISS-Above data stream, I knew that I could use this information for my needs Click here to see how I access the ISS-Above data stream.

    I want my project to flash blue leds when the Internation Space Station flies over our location. ISS-Above "tells" PiGlow to turn on 0xB - eleventh LED or white LED when ISS is above our location. I will test for B and turn on my LEDs to blue. I can't use delay function because the Fab arduino needs to contiuosly monitor the Raspberry Pi and ISS-Above. I need to use the milli function and amchine state.


    Neopixels and Machine State

  • I begin by soldeing jumpers leads to single neopixel. This includes power, ground and signal
  • I connected the red to power , green to ground and signal to pin 6 on the Arduino.

  • ISS


  • Downloaded Adafruit Neopixel library
  • Installed the Adafruit library by selecting zip library files in Arduino.
  • ISS


  • I open File --> Examples --> Adafruit Neopixel --> simple.
  • I changed the number of pixels from 16 to 1 and then uploaded and ran the program.
  • Next, I open File --> Examples --> Adafruit Neopixel --> strandTest file
  • I changed the number of pixels from 16 to 1 and then uploaded and ran the program.
  • While I could set the color of the neopixel this program uses delay commands.
  • I spoke to Dr. Harris about this issue. He suggested this adafruit tutorial on milli fucntion and machine state
  • I began with a program to blink a light without using a delay instead you use the milli function and machine state.
  • Below is section of the code:
  • // check to see if it's time to change the state of the LED

  • unsigned long currentMillis = millis();
  • if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime))

    {

    if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime))

    {

    ledState = LOW; // Turn it off

    previousMillis = currentMillis; // Remember the time

    digitalWrite(ledPin, ledState); // Update the actual LED

    }

    else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime))

    {

    ledState = HIGH; // turn it on

    previousMillis = currentMillis; // Remember the time

    digitalWrite(ledPin, ledState); // Update the actual LED

    }


    ISS


    The final code below combines I2C Code, Machine State with Neopixels. This is a portion of the code.

    void receiveEvent(int howMany) { <---- I2C code

    while (0 < Wire.available()) { // loop through all but the last

    unsigned char c = Wire.read(); // receive byte as a character

    Serial.print(c,HEX); // print the character

    if (c == 0x0B) //white

    {

    if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime)) Machine State code

    {

    ledState = LOW; // Turn it off

    previousMillis = currentMillis; // Remember the time

    digitalWrite(ledPin, ledState); // Update the actual

    for (int i=0;iNeopixel or LED code

    pixels.setPixelColor(i, pixels.Color(0,0,0)); // Moderately bright blue color.

    }

    }

    else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime))

    {

    ledState = HIGH; // turn it on

    previousMillis = currentMillis; // Remember the time

    digitalWrite(ledPin, ledState); // Update the actual LED

    for (int i=0;i

    pixels.setPixelColor(0, pixels.Color(0,0,255)); //neo pixel code make it blue

    pixels.show(); //neo pixel code

    }

    Final Assembly

  • Once I finished the programming, I soldered a 8 LED neopixel stick.
  • ISS


  • I connected LED stick to an arduino and I uploaded NeoPixel/Machine State file and I confirmed the LED sticks worked
  • ISS


  • I laser cut 8 holes into the "my book"
  • I put 8 transparent glue sticks into holes
  • I then added the LED neopixel stick to a my "book"
  • I aligned each glue stick above each pixel
  • Neopixel Neopixel





    Videos


    Exercise Files