I am confused how to code arduino scoreboard. It will be 4 sided so it will be like a jumbo torn in a stadium with clock, period,and score on each side. It is for a air hockey table. I want to run it manually with an ir remote. Still confused all hep appreciated. The set time when you hit reset is 3:00. The buttons are +1 for home and guest,-1 for home and guest, start/stop clock, and reset clock. I will be using 7 segment LEDs. Need to be fit in a confined space.
Ah right. I thought that you'd perhaps been lucky enough to get one from a refurb job.
So the way I see it, it would actually be TWO devices. One to act as the remote control and the other to receive the signals and act accordingly.
It shouldn't be too hard. It's just a matter of having a count down timer that is being displayed and a continuous monitoring of the IR signal. You can even use the remote from ANY old TV set. Just sniff out what codes they send and then write them into your code to do the job required.
First of all, congratulations on thinking to ask BEFORE you purchased the components! Many newbies don't, and find they have made thir projects more difficult, or wasted money.
So, how many digits on each side? How big must the digits be? How bright must they be (eg. Readable outdoors in bright sunlight?). Will all 4 sides always show the same data?
I will assume 8 digits per side and each side displays identical data.
My first idea would be a simple circuit with no multiplexing. Buy common anode displays. Wire the cathodes for each segment of each corresponding digit on all 4 sides together. Use one tpic6c595 chip per digit to drive. This would keep things simple but you would need 8 tpic chips and 256 series resistors.
Second idea would be to use 4 max7219 chips, one for each side. Common cathode displays would be needed. The max chips could be wired in parallel so they always display the same data, or in series if different data is to be shown. This would mean no series resistors needed, but large digits could not easilly be used (large digits often require more than 5V to run).
As for the Arduino, an Uno will be fine, no need for a Mega or Due here. To keep things small, a Nano 3, Pro Micro or Pro Mini (with separate usb to serial adaptor).
If the digits are all the same, they could be run in parallel with a TPIC6B595 to drive each digit with its 150mA drive capability per output - you'd only need 80mA with smaller displays.
I have a board with 12 '6B595s and a '328 for Arduino functionality.
Wire up a small board with just current limit resistors and the IR receiver. http://www.crossroadsfencing.com/BobuinoRev17/
This card was designed for LED strips (usually 12V, 3 LEDs with current limit resistor) so there are no resistors on the board, like these: http://www.dipmicro.com/store/index.php?page=2&act=viewCat&catId=511
What is your plan to drive 3:00 down to 0:00, 0-9, and 0-9? Looks like 5 digits at least, and maybe 7 if score can be double digits. So that's either 35 or 45 IO pins. For 1 face of the scoreboard. The 4 faces can be in parallel and driven by a Mega, but you must limit the current to each segment to 5mA so that only 20mA flows total from an IO pin to avoid overloading either the pin, or the port.
You can use 4 x MAX7219, let each one drive the 5 or 7 digits on each face of the scoreboards. In that case you need 4 sets of common cathode digits.
You can use 5 or 8 TPIC6B595 to drive all the faces in parallel. In that case you need 4 sets of common anode digits.
baucat9:
Also, I am looking for someone to help me write the code. Please personal message me if you would like to help.
Shane, lots of people here will help you with the code, including me, but most will not do it over personal messages. That's because no-one else will ever benefit from the discussions and insights.
Don't feel embarrassed, no-one will look down on you as long as you are willing to have a go and learn from the experience. What people here don't like is someone demanding to be spoon-fed or not listening to the advice they asked for.
OK Here's a basic framework for you to work with. It uses 6 buttons for input and the serial port for display, but it could easily be modified to suit any input method you choose and any display you happen to implement.
#include "TimerOne.h"
int timeLine=180;//start with 3minutes
int homeScore=0;
int awayScore=0;
bool paused=0;//make this 1 to start in a paused state
//connect pins 2 - 7 to buttons
//the other side of the buttons go to GND
//button functions
// 2 Reset score and time (and waits for buttone 3 to start)
// 3 Pause/Resume (in paused state timer stops going down)
// 4 Increment Home Score
// 5 Reduce Home Score
// 6 Increase Away Score
// 7 Reduce Away Score
void setup()
{
int n;
for (n=2;n<8;n++)
pinMode(n,INPUT_PULLUP);
Serial.begin(9600);
Timer1.initialize();
Timer1.attachInterrupt(updateTimeline);
}
//set by interrupt routine to signal display need updating
bool timeUpdated=true;
void loop()
{
int n;
bool debounce=false;
//first look for any input
for (n=2;n<8;n++)
if(digitalRead(n)==LOW)
{
debounce=true;
switch(n)
{
case 2://reset
timeLine=180;//start with 3minutes
homeScore=0;
awayScore=0;
paused=true;
break;
case 3://pause-restart
paused=!paused;
break;
case 4://increment home
homeScore++;
break;
case 5://decrement home score
if(homeScore>0)
homeScore--;
break;
case 6://increment away score
awayScore++;
break;
case 7://decrement home score
if(awayScore>0)
awayScore--;
break;
}
}
//Now update display (but only if updateTime has executed since last time)
if(timeUpdated)
updateDisplay();
if(debounce)
delay(400);
}
void updateDisplay()
{
char timeString[6];
sprintf(timeString,"%d:%d",timeLine/60,timeLine%60);
Serial.println(timeString);
char scoreline[20];
sprintf(scoreline,"Home %d:%d Away",homeScore,awayScore);
Serial.println(scoreline);
timeUpdated=false;
}
void updateTimeline()
{
if(!paused)
timeLine--;
timeUpdated=true;
}
Paul, I agree completely. I want to learn because someday I want to be the one giving the advice and knowing how to code arduino. That's why I am asking questions so I know what different things are for. I think I am going to go with your first suggestion. My questions are what is the serial port, explain what you mean by display using the serial port, and would it be ok to use 7 digit boards because i only need 3 digits for the clock. For this, I would like to know what i need to modify from the suggested code. Lastly, do i need to get 256 resisters or is 256 series resister a type of resister?
baucat9:
Thanks, but I am not interested in being 3rd party arduino equipment since I am new to arduino.
Also, I am looking for someone to help me write the code. Please personal message me if you would like to help.
Thanks,
Shane
I can understand your trepidation, however.....
Crossroads is a very highly respected member here and probably has 90% of the code you are looking for.
as for the hardware side.
you will need to ;
determine what chip to use
lay out a board
buy the components,
order the boards
assemble and test,
*fix any mistakes
run the $$$
board ? $25 for the first one that may (or may not) work
all the chips, shipping, possibly multiple sources.
or, get the board from Crossroads, spend your time on the displays and everything works.
on a lower count LED display, I would argue that calling the pins from a mega would be faster and easier, but in your case, I would at least run the numbers.
chances are you could be complete before a set of boards arrives from China.
I am not going to buy from China. Second the boards from crossroads are at least $37 which I think is a little high for my simple project. I think I am going to use the pro mini which will be fast enough for me. Even if it is delayed 2-3 seconds, no big deal.
baucat9:
My question is do I need to define what equals every number(What pins)or is that already defined?
The pins I suggested were just for the sake of having something to demonstrate the principles. Hook an arduino up to some buttons using it's input "pins" as I described and you'll see that it works. In reality, you could use any input method and just modify the code to suit your final design.
baucat9:
What is the serial port?
It's a serial communication interface included on all arduino boards. In reality you won't be using it in your final design. When you hook up your arduino to a computer you can monitor this for anything your program sends down it and have it display on your screen. The arduino IDE includes a "Serial Monitor" My code uses this as a stand in for your final display. In reality, this part would have to be rewritten to send the same information to your REAL display.
There are cheaper ways of doing it, but in view of your limited experience in electronics, it may be one of the simpler solutions to implement. Yes, it should work.
baucat9:
. To clarify, I do not need to hook up anything to pin 1 correct?
Pin 1 is, internally (within the arduino circuitry) connected to the serial port. It's worth leaving this alone so that you can still use the serial port to communicate with the computer. It's a valuable tool to help work out what's going wrong (when things need to debugging).
baucat9:
And what is the UpdateTime for? What is the GND? What board should I use?
In the example code I posted, UpdateTime is simply a function that decrements the playing time remaining. It gets called once every second.
GND (short for Ground) is the negative side of the power supply on the arduino. There are a few pins on the arduino marked GND. In the example code I posted, the arduino detects it's input pins being connected to this (by the action of the button).
So what do I hook the output to so the code can tell the digit what to display? I want to make the design so I can buy all parts from US companies, and it is simple. Please give me more suggestions. I will consider Crossroads if I can get a better price than $37 per board. Also do Crossroad's boards come pre-coded? I need to know more info. The boards must also be simple. The first suggestion he gave me I did not understand.
Which of my boards are you referring to?
Here's what I do for shift register outputs - I make an fontArray and I call up a number from that array when I want output something:
bye fontArray[] = {
0b00111111, // 0 0b7-6-5-4-3-2-1-0, 7 = DP, 6 = f, 5 = e, 4 = d, 3 = c, 2 = b, 1 = 1, 0 = a
0b00000110, // 1
//etc
};
Displays are set up thus:
a
f b
g
e c
d DP
then to output to a shift register using SPI library:
digitalWrite (ssPin, LOW);
SPI.transfer (fontArray![number_to_display);
digitalWrite (ssPin, HIGH); // outputs change on this rising edge
If you want to send out 8 digits to daisy chained shift registers, use 8 SPI.transfers.
For example, here are 4 TCIP6B595s, with a PWM used for output enable for brightness control.
My board with '328P has 12 of these for up to 12 digits. The current limit resistors and LEDs are off board.