Go Down

Topic: Need help =Game timer tower for kids church (Read 1 time) previous topic - next topic

kidpreacher5325

Hello.  I am the children's ministry director at my church.  I want to build a game timer tower. I have done a little with IC chips and pcb's but I want to start using programmable boards  to do more. I have very little understanding on HOW it works, just good at putting in pieces and following directions.

I want to build a tower about 5' tall.  I would like it to have 12 segments of LEDs.  The Top row would be "Standby" or waiting mode. Push a button, and the lights would move consecutively down the tower until the last. It would then stay on the last for a set amount of time, then reset back to "Standby" until someone hits the button again. 

I have the ARDUINO UNO board, a spst button, and LOTS of LEDs. What I don't have is the knowledge. Also, I only have 3 weeks to get this programed and built. 

I have spent a couple of days reading through the forum and playground, and understand the "debounce" code, but was not sure if it is needed since pushing the button would start the sequence of set times.

I also wondered if a sketch could be written so that the towers default would be a fast top to bottom loop, then go to standby when the button is pushed once, then do the actual countdown on a second push (obviously need a debounce here), then pause for a set time, and go back to loop.

If anyone is able to help me with this, I would so appreciate it. I will be checking here hourly, but I can also be reached at 727-809-0926 or at darin@firstprotestant.com. Thank you.

kidpreacher5325

I know people are reading this.  Please help.

CrossRoads

What do you have for a power supply?
What I would recommend is wiring the LEDs in strings, say 3 for a 12V supply, 4 for a 15V supply, then wire the strings in parallel for as many LEDs you want in each group, and use two TPIC6B595 to drive the strings.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

And some test code to light them up:
Code: [Select]


#include<SPI.h>
byte ssPin = 10;
byte button = 2;
byte x;
byte lightArray [] = {
  0b00000000, 0b00000001, // row  0 on
  0b00000000, 0b00000010, // row  1on
  0b00000000, 0b00000100, // row  2 on
  0b00000000, 0b00001000, // row  3 on
  0b00000000, 0b00010000, // row  4 on
  0b00000000, 0b00100000, // row  5 on
  0b00000000, 0b01000000, // row  6 on
  0b00000000, 0b10000000, // row  7 on
  0b00000001, 0b00000000, // row  8 on
  0b00000010, 0b00000000, // row 9  on
  0b00000100, 0b00000000, // row  10 on
  0b00001000, 0b00000000, // row 11 on
};
void setup(){
  SPI.begin();
  pinMode (ssPin, OUTPUT);
  pinMode (button, INPUT_PULLUP);
}
void loop(){
  if (digitalRead(button) == LOW){
    for (x=0; x<12; x=x+1){
      digitalWrite (ssPin, LOW);
      SPI.transfer(lightArray[x*2]); // 0,2,4,6,8,10,12,14,16,18,20
      SPI.transfer(lightArray[(x*2)+1]); // 1,3,5,7,9,11,13,15,17,19,21
      digitalWrite(ssPin, HIGH);
      delay (1000);
    }
  }
}

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

kidpreacher5325

pinMode (13, OUTPUT);
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
pinMode (10, OUTPUT);
pinMode (9, OUTPUT);
pinMode (8, OUTPUT);
pinMode (7, OUTPUT);
pinMode (6, OUTPUT);
pinMode (5, OUTPUT);
pinMode (4, OUTPUT);
pinMode (3, OUTPUT);
pinMode (2, OUTPUT);



digitalWrite(13, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(13, LOW);    // sets the LED off
digitalWrite(12, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(12, LOW);    // sets the LED off
digitalWrite(11, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(11, LOW);    // sets the LED off
digitalWrite(10, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(10, LOW);    // sets the LED off
digitalWrite(9, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(9, LOW);    // sets the LED off
digitalWrite(8, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(8, LOW);    // sets the LED off
digitalWrite(7, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(7, LOW);    // sets the LED off
digitalWrite(6, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(6, LOW);    // sets the LED off
digitalWrite(5, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(5, LOW);    // sets the LED off
digitalWrite(4, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(4, LOW);    // sets the LED off
digitalWrite(3, HIGH);   // sets the LED on
   delay(1000);                  // waits for a second
   digitalWrite(3, LOW);    // sets the LED off
digitalWrite(2, HIGH);   // sets the LED on
   delay(5000);                  // waits for a second
   digitalWrite(2, LOW);    // sets the LED off


}

cedarlakeinstruments

#5
Sep 02, 2015, 02:42 am Last Edit: Sep 02, 2015, 03:34 am by cedarlakeinstruments
Here's a simpler way. I haven't tested it but it looks like it'll work fine.

Code: [Select]

// Choose an appropriate pin for pushbutton input here
const int INPUT_PB = 14;
const int TOP_ROW = 13;
const int BOTTOM_ROW = 2;

void setup()
{
// Put the rest of your setup code here...


pinMode(INPUT_PB, INPUT);
// Activate input pullup
digitalWrite(INPUT_PB, HIGH);

// Quick top to bottom cycle
cycle(100);
}


void loop()
{
// Top row ON
digitalWrite(TOP_ROW, HIGH);

// Wait for button press (assume switch to ground)
while(digitalRead(INPUT_PB) == HIGH)
{
// 50 ms response time
delay(50);
}

// Cycle down at 1 second per row
cycle(1000);

// Bottom row on for 1 extra second
digitalWrite(BOTTOM_ROW, HIGH);
delay(1000);
digitalWrite(BOTTOM_ROW, LOW);
}

void cycle(int time)
{
// Cycle top to bottom
for (int i = TOP_ROW; i >= BOTTOM_ROW; i--)
{
// LED on
digitalWrite(i, HIGH);
// Wait
delay(time);
// LED off
digitalWrite(i, LOW);
}
}
Electronics and firmware/software design and assistance. No project too small

Go Up