Laser, Electronics, IOT

DIY IOT Scoreboard

Ever wanted a scoreboard? Ever wanted a Internet connected scoreboard? I did so I made one.

Materials:

Neopixel strip

12x24x1/8 in black acrylic

12x24x1/8 in frosted acrylic

3 - 12x24x1/8 in birch plywood

particle photon WiFi board

5v 2-3 amp power supply

wire 

copper tape

DIY

First I designed the segments which ended up being elongated diamond shapes that i placed in a 7 segment display shape.

scoreboard.JPG

took that over to the laser cutter and cut it out twice, once in black acrylic and the second in plywood these would soon sandwich the frosted acrylic.

the chaise was made with the remaining plywood in which the segment panel set into. I used finger joints designed with the press-fit box generator Box Designer  after it was all cut out the chaise was about 21 3/8 long and 11 5/8 in tall.

scoreboard_neopixel.JPG

The hard part was cutting and re soldering the Neopixels behind the frosted acrylic, the wooden segments act as light blockers to reduce bleeding. 

 

Neopixel_wiring.JPG

After that catastrophe ad testing and rewiring I finally was able to connect the power supply and and photon. The Neopixels are pretty simple to wire up the data went to a digital pin and 5v line went to the positive 5v rail made with copper tape and GND goes to Ground.

I did that for each segment to make it easier to program. So, in the end i ended up wiring 3 digital pins, connected 4 grounds and 4 5v rails

And that was it for Hardware and Electronics here it is after its all done.

Scoreboard done.JPG

Programming Time

The code was pretty simple and nice. I used the particle build IDE to create and flash the code the interesting part was trial and error-ing the numbers display.

 

 

// This #include statement was automatically added by the Particle IDE.

// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
#include <Particle.h>
#define num_one_PIN    D6
#define num_two_PIN    D5
#define num_three_PIN  D4
#define NUMPIXELS      21

Adafruit_NeoPixel numOne = Adafruit_NeoPixel(NUMPIXELS, num_one_PIN, WS2812);
Adafruit_NeoPixel numTwo = Adafruit_NeoPixel(NUMPIXELS, num_two_PIN, WS2812);
Adafruit_NeoPixel numThree = Adafruit_NeoPixel(NUMPIXELS, num_three_PIN, WS2812);

int delayval = 1000;
uint32_t green = numOne.Color(0, 255, 0);
uint32_t red = numOne.Color(255, 0, 0);
uint32_t blue = numOne.Color(0, 0, 255);

int numberMap[10][21] = {
    {0,1,2,3,4,5,6,7,8,12,13,14,15,16,17,18,19,20,22,22,22}, //0
    {0,1,2,12,13,14,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22}, //1
    {0,1,2,3,4,5,9,10,11,15,16,17,18,19,20,22,22,22,22,22,22}, //2
    {0,1,2,3,4,5,9,10,11,12,13,14,15,16,17,22,22,22,22,22,22}, //3
    {0,1,2,6,7,8,9,10,11,12,13,14,22,22,22,22,22,22,22,22,22}, //4
    {5,4,3,6,7,8,11,10,9,12,13,14,15,16,17,22,22,22,22,22,22}, //5
    {3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,22,22}, //6
    {0,1,2,3,4,5,12,13,14,22,22,22,22,22,22,22,22,22,22,22,22}, //7
    {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, //8
    {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,22,22,22}, //9
};

int numberMapOne[10][21] = {
    {0,1,2,3,4,5,6,7,8,12,13,14,15,16,17,18,19,20,22,22,22}, //0
    {18,19,20,6,7,8,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22}, //1
    {0,1,2,3,4,5,9,10,11,15,16,17,18,19,20,22,22,22,22,22,22}, //2
    {8,7,6,3,4,5,9,10,11,18,19,20,15,16,17,22,22,22,22,22,22}, //3
    {18,19,20,6,7,8,9,10,11,12,13,14,22,22,22,22,22,22,22,22,22}, //4
    {6,7,8,11,10,9,12,13,14,15,16,17,3,4,5,22,22,22,22,22,22}, //5
    {3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,0,1,2,22,22,22}, //6
    {8,7,6,18,19,20,15,16,17,22,22,22,22,22,22,22,22,22,22,22,22}, //7
    {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, //8
    {18,19,20,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,22,22,22}, //9
};

int r_numOne(String val, String color);
int r_numTwo(String val, String color);
int r_numThree(String val, String color);
int clear(String num);

void setup() {
  Particle.function("num1", r_numOne);
  Particle.function("num2", r_numTwo);
  Particle.function("num3", r_numThree);
  Particle.function("clear", clear);
  numOne.begin();
  numTwo.begin();
  numThree.begin();

  numOne.show();
  numTwo.show();
  numThree.show();

}


int clear(String num) {
      if (num == "one"){
          for(int i=0;i<NUMPIXELS;i++){
            numOne.setPixelColor(i, 0);
          }
      }
      if (num == "two"){
          for(int i=0;i<NUMPIXELS;i++){
            numTwo.setPixelColor(i, 0);
          }
      }
      if (num == "three"){
          for(int i=0;i<NUMPIXELS;i++){
            numThree.setPixelColor(i, 0);
          }
      }
      if (num == "all"){
        for(int i=0;i<NUMPIXELS;i++){
            numOne.setPixelColor(i, 0);
            numTwo.setPixelColor(i, 0);
            numThree.setPixelColor(i, 0);
          }
      }
      numOne.show();
      numTwo.show();
      numThree.show();
      return 1;

}

int r_numTwo(String val) {
  numTwo.begin();
  //clear();
  for(int i=0;i<21;i++){
      if (numberMap[val.toInt()][i] != 22){
        numTwo.setPixelColor(numberMap[val.toInt()][i], green);
      }
  }
  numTwo.show();
  return 2;
}

int r_numThree(String val) {
  numThree.begin();
  //clear();
  for(int i=0;i<21;i++){
      if (numberMap[val.toInt()][i] != 22){
        numThree.setPixelColor(numberMap[val.toInt()][i], green);
      }
  }
  numThree.show();
  return 3;
}

int r_numOne(String val) {
  numOne.begin();
  //clear();
  for(int i=0;i<21;i++){
      if (numberMapOne[val.toInt()][i] != 22){
        numOne.setPixelColor(numberMapOne[val.toInt()][i], red);
      }

  }
  numOne.show();
  return 1;
}

void loop() {

}

In the large arrays you see a lot of 22's these equal off lights in a string of 20 lights in each segment.

After I flashed this I used the particle console to send numbers as strings and the code interprets which segment to show which number.

INSTANT IOT Scoreboard done.

iot scoreboard.JPG

Final

Using the app I can now keep score in a smash bros tournament slash massacre.

This has been While The Glue Dries.

DSC_0829.JPG