Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:05 18 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Timing i.e basic 1/100th second stopwatch

Author Message
Pete Locke
Senior Member

Joined: 26/06/2013
Location: New Zealand
Posts: 179
Posted: 09:34pm 28 Jun 2015
Copy link to clipboard 
Print this post

Howdy all you clever coding micro/mini mite people. I have a need for a rather simple timer, accurate to 1/100th of a second for timing up to 1 minute. This is for 1/4 mile time trials. Our Aeroclub last weekend ran a fun day where you could take Mum's car up to the runway, put the boot up it, and see how fast you could get to the other end of the 1/4 mile without letting the smoke out of the engine. Great day and a total success with minimal carnage. We had to borrow timing gear for the event which did a fine job. Very old, and rather clunky to use but OK. So here's the thing. Spent some time on the net looking for a kit set that would handle the 1/100 requirement. Not a sausage. Commercial gear is available at well outside our non profit club's budget. I've read all the micromite and such posts being well impressed with what has been done, and although I don't understand the fine print can grasp the concepts being created. So for something simple, can someone put their hand up to guide me in the direction of the following, or even better accept a bribe to make up something as follows....
1/ Enter car number (1-200ish)
2/ Input to start timer
3/ Input to stop timer.
4/ Input to reset the display to zero.

Simple as that. But on the wish list....

Be able to enter the same car number again, and have the timer put the second time after the first, so at the end of the day if a car does say four runs down the track we can access the times done in order.

Hope this makes sense, and there can be some direction from this.

Cheers
Pete'
Hokitika
New Zealand.
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 10:08pm 28 Jun 2015
Copy link to clipboard 
Print this post

Hello !

Some Questions:

1) How many people (cars) and how many times per car you want to store and query again?
2.) Start and stop the timer with buttons or via external contacts?
3.) What size should have the display of the timer?
4.) Which accuracy should have the timer, here sufficient precision the internal "SETTICK" timer?

Greetings from Austria!

Wolfgang
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 10:23pm 28 Jun 2015
Copy link to clipboard 
Print this post

The internal oscillator in the micromite is "good enough" provided the temperature doesn't change too much during the event.

I would measure in milliseconds and save the data to an array.
Array size needs to be Number of vehicles X number of runs.

DIM results(200,5) should fit into a micromite with room for the program.

One button for start/stop and a touch screen for entering the vehicle number and retrieving the results. Nice and compact!

Even better would be a sensor at the start line and finish line.

The risk is having the battery go flat and loosing ALL the results.

A laptop logging the results to disk would be a good idea!


Jim


VK7JH
MMedit   MMBasic Help
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 1212
Posted: 10:32pm 28 Jun 2015
Copy link to clipboard 
Print this post

How about just using a maximite and one of the SPI tft's with the touch panel then one can simply log to the SDCard then later look at the results on a computer.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 10:46pm 28 Jun 2015
Copy link to clipboard 
Print this post

Hi Pete,

Sounds like a good day out (if you're into cars that is!).

As to your requirements then this should be relatively easy. There are many ways to achieve this (as with all 'projects') but the following would be my approach:

One 'unknown' is how on what device you want to see the times. Do you envisage a large multi-7-seg display? Or is it just on a 'small' screen? Either way, no problem.
Also, I assume only one car is 'running' at a time?? This is important to establish.
Below represents two buttons - one to start the timer, the other to stop the timer; although you could use just one button for start/stop if you wanted to.

Steps:

1> Set up an array for storing driver name i.e. DIM DriverName(200) as String (OPTIONAL)

2> Set up a multi-dimensional array for the 'visual' times i.e. DIM CarTime$(200,5) as string (this allows 5 times to be stored per car)

3> Set up an array for time in milli-seconds (ms) for calculation purposes DIM Duration(200,5) as Integer. Sorting this will allow you to display a 'leader board'

4> Configure pins for Start & Stop buttons i.e. SetPin xx,DIN,PULLUP (connect button between pin xx and Gnd). Do two of these on different pins to give you the two buttons i.e. SetPin yy,DIN,PULLUP for Stop Button

5> Clear all arrays to begin with

6> Use a Do Loop to repeat the following code:

Begin with DO

Enter car-number i.e. INPUT "Car Number",CN (This will give a CarNumber (CN) index pointer)

Check for any previous 'runs' by searching for first zero in Duration(CN,y) array. This will give a
RunNumber(RN) index pointer for car number CN):
FOR RN = 0 to 4
IF Duration(CN,RN)=0 then EXIT FOR
NEXT RN

Monitor start button: i.e. WaitStart: If PIN(xx) = 1 then WaitStart (where start button is connected to Pin xx)

Record start time: actually set the Timer to 0 i.e. Timer = 0

Monitor stop button: i.e. WaitStop: IF PIN(yy) = 1 then WaitStop (where stop button is connected to Pin yy)

Record stop time: i.e. Duration=Timer: Duration(CN,RN)=Duration (store Timer value into a Duration integer first so we can do calculations on this)

Convert Duration into MM:SS and store in CarTime$(CN,RN) (dividing Duration by 1000 gives number of seconds. I assume all cars will do this in less than 1minute - if not then will need to divide answer by 60 to get minute(s)

Back to start of loop ready for next car or 'run' (as same car could do another run immediately?): i.e. LOOP



Note: the above is just a 'guide'. There are many additions you can do to this as already mentioned such as Leader Board. This is simply sorting the Duration() array to display whatever you need.

I hope this gives you a bit of guidance - no doubt many other will chip in with their ideas . . .

WW

UPDATED: Due to Typo's

Edited by WhiteWizzard 2015-06-30
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Pete Locke
Senior Member

Joined: 26/06/2013
Location: New Zealand
Posts: 179
Posted: 12:02am 29 Jun 2015
Copy link to clipboard 
Print this post

Many thanks for the almost immediate reply's. OK, so to sort out some questions, and my limitations in this project.....
An external trigger (dry relay contacts) one for the start and one for the stop photo eyes would be used. A safe guard for false triggering is as simple as a switch. A 7seg LED display for the timing guy (that would be me) to look at. I'm an electronics tech and would have no problem taking a 7seg array and buffering it for a large public display. The run is one car at a time and we don't need intermediate times to be flashed up through the run or any fancy stuff like that. Just a display rolling up the numbers for the punters to look at while some poor piece of metal is being thrashed through a 1/4 mile run . The day limits the number of entries to about 100 vehicals, but if we can get the side road up to scratch then we don't have to wait for the car to return back down the track before the next one is launched. So a total number of cars to keep track of would be at best about 200. The number of runs per car would be about 5. After all there's only so much daylight . A simple keypad entry would be good, and easy for all to use.
It's a fun day out for the participants so the internal clock would be well good enough. A flash memory (extnl thumb drive?) in case of battery failure would be a good thing. There is no power out on the airfield so it's all done with batteries.
My limitation here is, I know nothing about writing code for the boards you guys are using here. Well I know nothing about code full stop. My programming was a brief introduction in to BASIC back in the TRS-80 days. I posed this query here because it seems these things are very flexible in their usage and a timer would be quite a simple job for one of them. Thanks for giving a brief on how to approach the programming of the boards, but again. I can grasp the concept but lack the ability to use it.
I have no problem with a soldering iron and a bag full of clever bits to knock up a finished item and would quite like to build a timer to suit. I can see that one of the micro or maxi boards would do the trick.
Thanks again
Pete'.
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 1212
Posted: 01:02am 29 Jun 2015
Copy link to clipboard 
Print this post

Hi Pete,
The logistics has got me thinking here and how about using a laser pointer set on a rigid stand at the finish. Then place a mirror so the the laser goes back to the starting area on the side of the track. The idea here is with a laser pointed at a led or photo sensor will be high when the beam is there, as the car goes over the line the beam is broken and a low is close to instantly given. This would mean the 'unit; would have to be where the beam is directed and connected but I do think it would work with close to split second accuracy.

A bit of work to setup but eh if it works one problem solved.

Cheers Bryan
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 01:46am 29 Jun 2015
Copy link to clipboard 
Print this post

As a start, here is a very simple 100th of a second display using THIS display unit. HERE is the thread for that.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2294
Posted: 03:09am 29 Jun 2015
Copy link to clipboard 
Print this post

it is an interesting problem when one thinks about it. to me, it seems the two major challenges are not in fact programming related. they are:
1. design a means to detect a car passing - for example, a broken light beam.
2. work out how to get signals to/from the start and finish sensors.

given you don't want to reel out 1/4 mile of cable to the finish line, i'd consider using something like these:
http://www.ebay.com/itm/171793533126
(433Mhz HC-12 SI4463 Wireless Serial Port Module 1000m)

i would recommend three of these modules - one attached to a netbook that handles collating the car number and start/stop times, one that is attached to a micromite at the start line, and one that is attached to a micromite at the finish line.

just before each run starts, transmit from the netbook a "time mark" signal that directs both micromites to zero their internal clocks. both will see this command at the same time. the netbook then sits there listening, waiting to receive an "i have started at this time" message from the start line, then some time later an "i have finished at this time" from the finish line. the time for the run is simply (finish time - start time).

the micromites are well suited to doing the timing. the netbook (running a small application) is well suited to keeping track of the car numbers, run times, and storing information on mass storage. you'd be ill advised to try to achieve these functions using the micromites.

as for power: netbooks can be had that will run for most of the day on a single charge, and at lunchtime you can recharge from an inverter in your car. the equipment at start and finish lines can be powered from a couple of old car batteries (one at each end) which will have more than enough juice to last the day.


cheers,
rob :-)
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 03:17am 29 Jun 2015
Copy link to clipboard 
Print this post

The only thing you have to take into consideration if you use the above units is...

suggested that when the power supply voltage is greater than 4.5 V , you need concatenating a 1N4007 diode to avoid module built-in LDO got fever.

You definitely don't want the LDO to get a fever in this situation.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 10:31am 29 Jun 2015
Copy link to clipboard 
Print this post

Maybe put the MMite at the finish line. Let it control the starting signal directly, so that the start pin is an output, not an input. Choose a starting signal that sits at the finish line and can be seen from the start, like a car headlamp. Maybe a few lamps to act more like starting tree. Although this won't catch false starts...

I started building something similar for a farmer's market zucchini race (cars made from zucchinis, skewers, wood disks and carrot chunks as retainers, that race down a 16 foot slope with 3 lanes) but haven't gotten around to finishing it yet. I used a 20x4 lcd character module to see results.
Visit Vegipete's *Mite Library for cool programs.
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 1212
Posted: 01:01pm 29 Jun 2015
Copy link to clipboard 
Print this post

Thinking more on what I said about using laser pointers, they could be put in say 25mm downpipe tube and the receiver also put in one. Set both up then use a white board to aim the lasers until alignment is spoton and the unit see a high signal. Now the start line could also have the same setup using another pin on the unit.

So when the car breaks the start beam the counter starts and the same at the end the counter stops. Once setup it would just plain work giving 1/100th of a second accuracy with minimal parts. 2 laser pointers, 2 receiver chips going to inputs and the required solid framework for the laser's setup.

Using a maximte and the SDCard would store the data in an excel file which can be looked at later on a computer. For a real life display a large 7 segment display could show the timer for the audience.
 
Pete Locke
Senior Member

Joined: 26/06/2013
Location: New Zealand
Posts: 179
Posted: 08:40pm 29 Jun 2015
Copy link to clipboard 
Print this post

Wow.....Thanks again for the input guys. Starting to get a sweat up digesting the reply's . So again, the start/stop signal to the timing unit isn't a problem. Yes we do actually have a 1/4 mile of cable to run out from the start position down to the end. No problem there, and I have access to all manor of photo eyes that will do a fine battery powered job of looking after the start and finish triggering, presenting a set of dry contacts (or a 12v signal) to the timing board. That part of things is easy enough. It's the actual timing unit I was looking for. I thought that back in the past maybe something like I'm after had been done and dusted, and a link to that project would be available from someone who has been a member here a lot longer than I have. No problem if not, and I'm not asking to take up your time 'inventing' something new for the job.......but please feel free to do so if it's interesting .
Cheers
Pete'
Hokitika NZ
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:12pm 29 Jun 2015
Copy link to clipboard 
Print this post

Hi Pete,

Based on your last reply; I would refer you back to my original post (ignore step 1 if using a MicroMite).

Simply wait for the 'start' input pin to go low (based on my original code samples) and immediately reset the inbuilt Timer. Then wait until the 'stop' input goes low and store the Timer value. This will be a value in milli-seconds (ms) for the time of the 'car run'.
Storing all timings in this ms value allows you to sort them into a 'leaderboard'.
Converting them into MM:SS:sss (hopefully MM not required) will allow you to display the timings on whatever display hardware you wish. This conversion is just basic maths which the MicroMite can perform very simply with just a few lines of code.

All other 'features' are more hardware orientated (which it sounds like you have covered). And many software features could be incorporated depending upon your 'imagination' and requirements.

Do the code snippets originally posted make some kind of sense or do you need more help?

WWEdited by WhiteWizzard 2015-07-01
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
BrianD
Newbie

Joined: 06/05/2014
Location: New Zealand
Posts: 7
Posted: 11:23pm 30 Jun 2015
Copy link to clipboard 
Print this post

Hi Pete

I built timing gear for our local car club a few years ago that is still in use now so may be able to offer some advice. The gear is mainly used for hill climbs but has also been used for 1/4 mile drags. For the start line we use a hockey stick with a mechanical lever type switch although I also built a traffic light style set of start lights but we mainly use the hockey stick as that seems to be what most of the competitors prefer. For the finish line we use a rubber hose that triggers a pressure switch and this has proven to be very reliable and at one event we had a radar gun recording a car going over the line at 127mph and the pressure switch detected it every time. The finish line pressure switch triggers a maxon VHF radio and transmits a dtmf tone to the maxon receiver at the start line.

I wrote the software back in 2001 and used a Atmel microcontroller and used the timer overflow to generate an interrupt and in the interrupt service routine it simply increments a variable that I use for the timing count.I used a 4 line LCD character display and the system can run two cars on the course at a time

I have considered using a laser beam for the finish line but see no real advantage over the hose and pressure switch. Also a laser beam could go out of alignment which is possible for equipment that is only a temporary set up for each event which in our case is often on gravel roads.

My main reason for keeping it quite simple is that I am not always the person running the gear so by keeping it simple means that it is easy for other people to set up and operate.And if I am not at the event then I can often sort out any issues over the phone. Also no readily available TFT LCD displays or micromites etc when I built this system.

The other reason is that if there is a problem it is usually quite easy to fix quite quickly without a whole lot of test gear as competitors tend to get unhappy if they have to sit around waiting while you diagnose and fix a fault.

I'm quite happy to share more details of the hardware and send you a copy of my progamme listing so send me a pm if you are interested. My programming skills certainly aren't as good as some of the members on here as I am a radio tech rather than an IT person but it should be fairly easy to follow
 
Pete Locke
Senior Member

Joined: 26/06/2013
Location: New Zealand
Posts: 179
Posted: 08:14pm 01 Jul 2015
Copy link to clipboard 
Print this post

Well it looks like I have found a board of tricks to fit the bill. Many thanks to all who chipped in with ideas and such. Turns out the Aussies do have a kit that will fit the bill. A pre made kitset (not sure how you can have a kitset pre made ) but Kitstop have just the beastie. It's on the way.
Cheers
Pete'.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024