Count up timer

Thread Starter

dthx

Joined May 2, 2013
195
Hmmm....Ok.
Say I have a mechanical limit switch which toggles back and forth....it makes and breaks.
Could I ask the Arduino to acknowledge the switch opening....but ignore the switch closing...or vice versa?
 

djsfantasi

Joined Apr 11, 2010
9,163
Yes, you could. The program you write on the Arduino will do whatever you tell it. It just occurred to me. You do realize the Arduino must be programmed?
 

Thread Starter

dthx

Joined May 2, 2013
195
Yes, I know it does.....
And no...I'm not a programmer....
but I remember some basic from the TRS-80.....I can hear you laughing...
and I have a family member that used to program years ago....he worked on the Saturn 5.
We'll get it done somehow if I decide to go that way.
But I understand why you asked that question.
D.
 

elec_mech

Joined Nov 12, 2008
1,500
There are a couple of caveats worth noting before going too far down a microcontroller(uC) path.

First, and djsfantasi may be able to answer this as my Arduino experience is limited to a single program to date, will an Arduino be able to handle clocking and updating four digits at 100Hz accurately? Normally I'd suggest the PICAXE, but I'm pretty sure it can't do this. An Arduino might, but I'm sure there is some upper limit.

Additionally, things get more complicated if you're talking about a single uC running and simultaneously updating up to four separate 100Hz clocks and 16 digits. Of course you can use one clock signal for all four, but updating the digits will take time from the uC which may or may not affect the clock. The question is what are the limitations of the uC you decide to use.

The link I provided in my first post uses digital logic with a uC to time two racing pinewood derby cars. The digital logic is purely hardware and takes care of the timing and displays. The uC, if memory serves, turns the clock on and off and determines the winner.

If there is no hurry, I can try a PICAXE with a MAX7219 and see how accurate it is. If it works, I suggest PICAXE over the Arduino only because the former uses BASIC language which is much easier to learn than C which the latter uses.
 

Søren

Joined Sep 2, 2006
472
The first question I have is WHERE do I get 4 " pre built numbers or the led strips that you mentioned?
I cant find anything on the Internet....
Darryl
1 minute search ;)
http://flying.en.made-in-china.com/product/seFmBcYTEzVq/China-Large-7-Segment-LED-Display.html

Product Description
Big 7-segment LED display
Jumbo LED display
Available sizes: 5'', 6'', 7'', 8'', 10'', 12'', 16''.
Light emitting colors: Red, green, amber, yellow, blue and white.
Viewing angle: 120 degrees
Applications: Big LED clock display, public bus No., cinema..

Just one page out of >20mio that Google spat out.
 

Thread Starter

dthx

Joined May 2, 2013
195
So...after some thinking....I don't think that I should try to run the counters thru any kind of board.
Even if the uC board would be capable of 1/100ths sec....it seems like that would require a good deal of programming, etc....
I think I'll build the counters in a box by themselves and start, stop, and reset them by way of a simple output from some kind of uC board (be it Picaxe or whatever) or a mechanical relay or pushbutton.
I guess if I go that way, there will be some code but seems to me it should be straightforward....
I think I'm going to need some kind of board though... so that I can make the overall machine adaptive to 1, 2,3, or 4 players trying to team up to change both tires for the quickest time ......or 2 players playing against 2 players...or one player playing for the fastest time of the fair, etc.......
 

Thread Starter

dthx

Joined May 2, 2013
195
Mr. Chips....
Re: your Bill of Materials for the counter....
what do you mean by "assorted resistors and capacitors"
D.
 

MCU88

Joined Mar 12, 2015
358
Even if the uC board would be capable of 1/100ths sec....it seems like that would require a good deal of programming, etc....
Not really. Using the internal timer0 and interrupts of the MCU will result in high-accuracy. An advanced-novice C programmer such as myself could do your project without much drama.
 

Thread Starter

dthx

Joined May 2, 2013
195
Thank you MCU88.
Mr. Chips:
Re your suggested BOM again...
Are all these components (less the LED's) going to be soldered to some sort of board?
and the 5K trim pot......what kind of connections are needed for it.....
D.
 

MrChips

Joined Oct 2, 2009
30,806
assorted resistors and capacitors

As djs pointed out, you will need an additional resistor for the decimal point.
You will also need some resistors for the 555 timer circuit, which I have yet to provide.
You will need a timing capacitor for the 555 timer circuit.
You will need some power supply smoothing capacitor, and some decoupling capacitors.
The 5k trim pot is to allow you to fine tune the 555 timer circuit to get the desired clock frequency.
All of these would become clear it I were to provide you with a circuit diagram but I need you to confirm which approach you are going to take before I draw a schematic.
 

djsfantasi

Joined Apr 11, 2010
9,163
@elec_mech , I don't have any experience with a Pic, but like the Arduino because it's a complete solution. What I mean is that I don't have to worry about wiring up a PCB with any supporting circuitry. Also, it isn't too hard to move to Arduino C from Basic (I converted a Basic program to 500 lines of Arduino C easily)

@dthx, I did have some comments about doing everything in the micro, but it appears as if you are going with separate counters, under the control of a micro. If this is the case, I see 2 pins used to set the number of players (1-4), and 2 pins for each station (1 for the sensor and one for start/stop of the counter; reset can be handled external to the micro). This is a total of 10 pins, well within the Arduino UNO's capability

If this is the direction the OP decides to go, I can provide snippets of Arduino C code
 

elec_mech

Joined Nov 12, 2008
1,500
Allow me to reconfirm what you're currently planning to do just to be sure we're all on the same page . . .
  1. Have up to four stations.
  2. Each station has a 4-digit display such that SS.mSmS where SS represents 00-99 seconds and mSmS represents 00-99 in 1/100th of a second.
  3. There will be a single switch - when engaged, the counter will start from 00.00 and run until the switch is disengaged. In the absence of anything else, if the counter reaches 99.99, it will then turn over to 00.00 and continue counting until the switch is disengaged.
  4. There will be a reset switch. When pressed, the display will go to 00.00.
Anything else? If not, you don't need a microcontroller(uC) at all. This can be done exclusively in digital logic hardware. If, however, you want to add some intelligence, you could use a uC to light up an LED over the winning display, record and store the shortest time, etc. If you opt to do this, I'd suggest a CD4510 and CD4543. In this way, you could add an I/O expander to the uC that reads the BCD value of each digit. Another method may be to simply count the number of clock pulses to each digit and whichever has the lowest number is the winner. The value can be calculated in the uC from there to store it.
 

Thread Starter

dthx

Joined May 2, 2013
195
yes, almost.
Correct...there will be up to 4 stations......maybe only 3.
But, only 2 of them will be timed...
So there will only be 2 counter displays (of 4 numbers each) that read (x/ x/. x/x) or (Tens of seconds / seconds . 1/10th secs / 1/100th secs.).....like 36.53 seconds
The other 2 stations are not timed...they are just tasks that have to be completed ( a switch is thrown) before the game is legitimate.
That's where I am now in my thinking as of now.
I'm meeting with the Fair board this weekend to see where the game will be located and what kind of electrical I have...
And...I'll go over the game with them....to see if they are also on the same page as to what we do.
I have a year to build this.
D.
D.
 

djsfantasi

Joined Apr 11, 2010
9,163
Whoa! What happened to the requirement of two to four players? And what is this new requirement that "a switch is thrown"? Can you describe your sequence with the same level of detail as @elec_mech did? This will help decide the best approach.
 

Thread Starter

dthx

Joined May 2, 2013
195
Ok....I knew it would come to this...as it should.
I've set on 1,2, or 3 players....not 4.
So....lets take 3 players first.....one counter

The machine is set by way of a toggle switch for 3 players
This sets the machine to only allow ONE counter to work.
The players are lined up and ready to run to the machine. (like a pit crew)
Picture the machine as a race car with 2 tires and a jack .
One player runs up (like a pit crew member) and jacks the car up ....this completes a limit switch and a bell rings AND the SINGLE counter starts.
When the bell rings (the counter is running) the other two players run off the line and each take an impact wrench out of a "shoe" that has a foot switch in it.
(For 3 players, the foot switch does nothing)
They remove the lug nuts, take the tire off....put the tire back on and tighten the lug nuts....
The jack man watches....
When each "tire man" is finished the "jack man" releases the jack and lowers the car down to stop the counter.
Their time is manually listed on a white board for everyone to see.
They can then go about their business at the fair and come back later in the night to see if they had the fastest time.
Now 2 players....two counters
The Two Player Game is selected by way of a toggle switch.
Both players are lined up at the line and ready to play.
A non- competing attendant jacks the car up , completes the limit switch, and rings the bell.
But..NEITHER of the counters start at this point.
Hearing the bell, both players rush to their respective tires and take their impact wrenches out of their "foot switch shoe"
When they do that, their respective counter starts.....(two counters are in play)
Each "tire man" takes their tire off...puts their tire back on and THEN puts the impact wrench back in the shoe....
The shoe switch toggles and Stops each respective counter.
The Jack is lowered for effect only.
The player with the fastest time shown on his counter wins.
One Player Only...one counter
A toggle is selected for only One Player
Only one counter is in play.
The player runs to the machine and raises the car using the jack.
The jack makes a limit switch, rings the bell....
AND starts his counter.
He drops over to the front tire and takes the impact wrench out of the shoe (which does NOTHING)...the counter is still counting.
He takes the tire off....puts the tire back on ...tightens the lug nuts and when he puts the wrench back in the switch shoe....
The counter DOES NOT STOP......
He has to let the car down with the jack and fire the limit switch under the frame to stop the counter...
His time is noted manually on a white board.
2 and 3 player teams are getting ready to play against each other.
There will always be individuals who want to play individually against the machine for the fastest time...
Awards will be given to the fastest teams in each category.
I haven't selected any of the mechanical switches yet...but they are all available.....
The foot switch is ava. in a normally open or NC configuration.....they are commonly used to operate a hydraulic shear..
 
Top