Another Picaxe Stopwatch

eggdweather

Senior Member
Yes, but you should check it can count at 1-pulse per mS, I suspect it can't. Four independent timers would make it easier to implement as resetting them all at the same time would have less latency, if that's what you need.
 

tarantulataramasalata

Senior Member
Thanks eggd. The things are from China, and will take a couple of weeks to arrive. So...

Any thoughts about this diagram? I suppose it is not essential that the timer is very accurate, as long as it is more or less right (what's a couple of milliseconds in the grand scheme of things?) and consistent! (It's a start gate/timing system for F1 in Schools, which is like a powered Pinewood Derby)

Each timer circuit has it's own chip to generate the 1Khz clock, feeding cascading decade counters and a 7 segment & driver combo. These are controlled by a 'motherchip' that interfaces with the various other inputs and outputs. That looks like 15 inputs and outputs, although the lighting sequence for the start will either have it's own chip as a sub-chip, or take another 4 outputs from the motherchip.

IMG_20161030_093643956_HDR.jpg
 

nick12ab

Senior Member
Any thoughts about this diagram?
4017 and 4511 pairs won't work as expected because the 4511 expects a BCD input and the 4017 has a one-hot output. Maybe you want a 4510 instead?

Why are individual 1kHz clocks generated? As the 08M2s are controlled by internal oscillators, the timers will quickly get out of sync and it will be noticeable that some timers are running slightly faster than others. Better to generate the 1kHz clocks from the motherchip using pwmout, then they will all be based off the same clock.
 

tarantulataramasalata

Senior Member
Thanks Nick. 4017 and 4510 pairs it is then!

The timers only do up to 9 seconds so I am guessing that they won't be noticeably out of synch by then. I used separate chips because I thought that the mother chip might struggle to do all the other stuff simultaneously. However if the various outputs can each do pwmout then the mini chips can take a hike too!
 

nick12ab

Senior Member
Thanks Nick. 4017 and 4510 pairs it is then!
I meant 4510 instead of the 4017.

The timers only do up to 9 seconds so I am guessing that they won't be noticeably out of synch by then.
They probably would be as milliseconds and tens of milliseconds are being displayed.

I used separate chips because I thought that the mother chip might struggle to do all the other stuff simultaneously. However if the various outputs can each do pwmout then the mini chips can take a hike too!
if the mini chips are just being commanded by the mother chip using serout, then just using pwmout instead would actually use less resources on the mother chip.

I believe with 15 outputs and 6 inputs I will need a 40X2?
You could just about use a 28X2, but better to just use a 40X2 as it costs the same and gives you more room for expansion.
 

eggdweather

Senior Member
Your diagram in logical terms looks OK, maybe add a means of resetting the timers, one RESET output and link all the screen resets to that maybe.

I think having a distributed multi-CPU solution makes the system easier to understand for educational purposes - a sort of IOT approach, lots of cheap CPU's all doing their own thing but controlled centrally.
 

Pongo

Senior Member
The timers only do up to 9 seconds so I am guessing that they won't be noticeably out of synch by then.
I agree with nick12ab, in this application you do not want to be open to any accusation of unfairness. Use one accurate 1 Khz oscillator to drive all the counters. Use the motherchip outputs to gate/inhibit the counting.
 

Rick100

Senior Member
Hello,

Looks like a fun but large project . Forgive my ignorance but what are the outputs Finish 1, Finish 2, Gate 1, Gate 2, Full Start 1, and Full Start 2 hooked up to ? Leds or solenoids or something else ? I assume the "Lighting Sequence" starts the race like a drag race Christmas tree . Do you have to detect an early trigger press ? Do the timers start when the "Lighting Sequence" ends or when the "Trigger" buttons are pressed ?

Here's a thread about a pinewood derby circuit.
http://www.picaxeforum.co.uk/showthread.php?24819-Pinewood-Derby-Stopwatch-Timer&highlight=pinewood+derby
It's different from your set-up but might be worth reading.

Good luck,
Rick
 

Rick100

Senior Member
It might be possible to do the pulse counting with one Picaxe for each lane and use a preassembled and cheap Max7219 display module driven by the same Picaxe to replace all that led driver circuitry(8 chips per lane). Post 31 of the pinewood derby thread has some code that does something similar. It counted the 1 KHz signal from it's own PWM to time 3 cars.
http://www.picaxeforum.co.uk/showthread.php?24819-Pinewood-Derby-Stopwatch-Timer&p=251389&viewfull=1#post251389

I might be able to improve on it to time 1 car by changing the timing loop structure. Of course the devil is in the details.

Good luck,
Rick
 

tarantulataramasalata

Senior Member
New Schematic!

Thanks for the suggestion of a MAX7129. I have a couple of 4 digit displays, and there are tutorials for hooking up the driver chip. Do you know how to hook up 4 individual 7 segment displays? (I am trying to use what I have to a certain extent.)
I am also hoping that the 40X2 will chunter out 1Khz PWM from 4 different pins that I can that merely stop when needed.

The dotted lines represent two boards, one at each end of the track. There are two lanes, and two timers per lane, measuring reaction speed and total race speed. The execute is also a reset.

Any thoughts welcome! Cheers

IMG_20161031_154527932.jpg
 

Rick100

Senior Member
Hello,
Thanks for the suggestion of a MAX7129. I have a couple of 4 digit displays, and there are tutorials for hooking up the driver chip. Do you know how to hook up 4 individual 7 segment displays? (I am trying to use what I have to a certain extent.)
You displays will have to be common cathode to use with the Max7219. Here is a good tutorial by westaust55 on using the chip.
http://www.picaxeforum.co.uk/showthread.php?23293-Getting-Started-with-the-MAX7219-Eight-Digit-7-Segment-LED-Driver&highlight=max7219

This page shows hooking up individual displays.
http://picprojects.50webs.com/max7219.html

I am also hoping that the 40X2 will chunter out 1Khz PWM from 4 different pins that I can that merely stop when needed.
I would probably feed one pwm signal from the master to all four timers and then have a line going to each timer that you would set high for the period you want timed.

The dotted lines represent two boards, one at each end of the track. There are two lanes, and two timers per lane, measuring reaction speed and total race speed. The execute is also a reset.
The 40X2 looking at it's inputs and setting it's outputs will probably skew your results. Is this for the real competition or practice and development of the cars? Whats the auto/manual switch do? Do you have to detect and react to an early trigger press? Sorry for all the questions but it can be the small details that that make a project difficult or even impossible.

Good luck,
Rick
 

AlbertZ

Senior Member
Thanks for the suggestion of a MAX7129. I have a couple of 4 digit displays, and there are tutorials for hooking up the driver chip. Do you know how to hook up 4 individual 7 segment displays? (I am trying to use what I have to a certain extent.)
I am also hoping that the 40X2 will chunter out 1Khz PWM from 4 different pins that I can that merely stop when needed.

The dotted lines represent two boards, one at each end of the track. There are two lanes, and two timers per lane, measuring reaction speed and total race speed. The execute is also a reset.

Any thoughts welcome! Cheers

View attachment 20396
You don't have to crank out four separate PWM signals. Feed a single 1kHz signal generated by the Picaxe into a CD4066. The gates are controlled by four separate PICAXE pins. Each pulse is .001 seconds, count the pulses and convert it to a display.
What kind of sensors are you using to start and stop the timers?
 

tarantulataramasalata

Senior Member
I would probably feed one pwm signal from the master to all four timers and then have a line going to each timer that you would set high for the period you want timed.

Whats the auto/manual switch do? Do you have to detect and react to an early trigger press? Sorry for all the questions but it can be the small details that that make a project difficult or even impossible.
Thanks Rick - it might be simpler to power on and off the led driver as (I think) you suggest!

Auto/manual: After the light sequence, you can start the cars from zero (auto) or wait until the trigger and human response times (manu)

If the triggers are pressed before the light sequence goes out, then the full start light goes on and the car doesn't move. Then it's the walk of shame!!! - Manually wheeling the car down the track (it's a tough life)

Thanks for your consideration :)
 

nick12ab

Senior Member
Thanks AlbertZ, I will try a 4066.
Or just use normal AND gates (4081).

Whether you should go for one gated PWM signal or four individual ones depends on whether or not you think you'll need extra PWM signals for something else. Using one gated PWM signal gives better expansion possibilities, but if you don't need the PWM for anything else, gating just adds unnecessary external components.
 

tarantulataramasalata

Senior Member
I have just dug out from my chip horde a 40X - I hope I can still use it!

Shall I select the 40X1 from the list in the Picaxe Programmer?
 
Last edited:

Rick100

Senior Member
I have just dug out from my chip horde a 40X - I hope I can still use it!

Shall I select the 40X1 from the list in the Picaxe Programmer?
On the left side the Picaxe Editor 6 , in the Workspace Explorer , under Settings Picaxe type , is the "Check Picaxe type connected" option. You can hook up the chip and see what chip and firmware version it is. The drop down list in PE6 shows a 40X part. There is also a "Show more Picaxe types" option if you can't see it in the list. I've never used the older parts so I'm not sure what the limitations are.

Dang. I have some that are common anode - is there a way round this?
Probably but it would be more trouble than it's worth. I got a Max7219 with 8 digits on Ebay for around 3 USD.

In the manual mode, does the "total race time" timer start when the lights go out or when the racer presses his button? I assume the reaction timer starts when the lights go out and stops when the racer presses his button. Are you going to use this in an actual competition?

Good luck,
Rick
 

tarantulataramasalata

Senior Member
Yeah, I read today about how to use CA displays and I agree it's not worth it!

In the manual mode, does the "total race time" timer start when the lights go out or when the racer presses his button? I assume the reaction timer starts when the lights go out and stops when the racer presses his button. Are you going to use this in an actual competition?
Total Race time = reaction + race time

Please define 'actual competition'! Will there be competing teams? Yes. So 'yes' to actual competition. However, no money will be changin hands. Do you smell a problem? ;)

Ima wait for the chips to be delivered then I can assemble a breadboard.

Cheers
 

Rick100

Senior Member
Do you smell a problem? ;)
No, but people and parents can take this stuff very seriously. I used to do a little RC car racing and have seen it first hand. I was never good enough to take it too seriously but I always had fun anyway.:) There was a lot of money changing hands between me and the hobby shop. I was just wondering how accurate and reliable it needed to be.

Good luck,
Rick
 

tarantulataramasalata

Senior Member
Hi Rick, I'm a high school teacher, so it's all in the classroom. No parents allowed!

I think that as long as it is the same for each race is doesn't have to be totally accurate.

Thanks for the help
 

tarantulataramasalata

Senior Member
Thanks for that. I think I need a pair facing each other across the track - these look like they are next to each other. Do they need a reflector thing?
 

tarantulataramasalata

Senior Member
1st Chip test = Woe.

This is the first 40 pin chip I have hooked up. I'm getting a 'No hardware found' message...

I've tested the cable, that seems fine. The connections seem to tally, and the power supply checks out.

Does this photo look OK? I think it's a 40X - I've had it for a few years!

IMG_20161101_225729473.jpg

PS: As you might divulge, I have hooked a couple of resistors to a headphone socket for ease of breadboarding! I think they are all in the correct holes?
 

hippy

Technical Support
Staff member
The 40X needs a resonator. 0V and V+ on both sides of the chip must be connected. You need a resistor with your LED. Reset must be pulled to V+ via 4K7.

See PICAXE Manual 1 for minimum operating circuit.
 

AlbertZ

Senior Member
Thanks for that. I think I need a pair facing each other across the track - these look like they are next to each other. Do they need a reflector thing?
I've used these to detect a ball rolling down a ramp and an HO train approaching a crossing. Why do you think you need to have them facing each other. I've used that approach for a Pinewood Derby project and it works as well but in hindsight I would use these little devils. Reflectivity is important because it determines the sensitivity, however if the distance from the sensor to the target is less than 1 inch, shouldn't be a problem. If you want a separate receiver and transmitter see post#10 for the wiring schematic and part numbers. In that configuration the IR LED was separated from the photo-transistor by about 4".
 

tarantulataramasalata

Senior Member
Why do you think you need to have them facing each other.
Not only am I grasping at straws, it is dark and I have my hands tied behind my back! I am just going by the enclosed picture. Why on earth I have 'senior member' status I can only guess; it makes me sound like I am some guru!f1_race_300x180.png
 

AlbertZ

Senior Member
Not only am I grasping at straws, it is dark and I have my hands tied behind my back! I am just going by the enclosed picture. Why on earth I have 'senior member' status I can only guess; it makes me sound like I am some guru!View attachment 20403
That's OK, I thought there was a specific reason you wanted them separated. Here is a drawing of the finish line configuration that I made. Go back to the link in post #10 for the schematic and specifics. The downside of separating the two devices is that alignment is very critical. The further apart they are the more prone to "misses". The side by side configuration is less wiring and you have a sensitivity adjustment. Good luck!
Pinewood Derby Bridge.JPG
 

tarantulataramasalata

Senior Member
I think that the side-to-side option would be best for a variety of reasons. Apart from the fact that this is the standard method (which I appreciate is not the be-all-and-end-all), the finishing gantry is independent of the track, the cars can be any colour, and they may cross the line in a variety of ways. It's more of a rocket to the stately Pinewood Derby 'roll'
 

AlbertZ

Senior Member
Nice bridge drawing, AlbertZ! The datasheet for the TCRT5000 Line Track sensor suggests a max transceiver-reflector distance of 25mm. To cross the track it's about 6".

Do you think this would be good? https://goo.gl/MkugGY
In theory, yes, they will work. However you will have to do some experimentation. The IR LED has a 30 mA max current rating so you need to set your current limiting resistor value to give you a current as close to 30mA as possible. As I mentioned previously, alignment is critical! A few degrees mis-alignment and the photo-transistor wont trip. You're going to have to experiment to find the configuration that gives optimum results. You may even need to go to a higher power IR LED. I assume you will be driving the LED through a transistor controlled by one of the output pins of your processor.
 

Rick100

Senior Member
I don't see anything obvious. It may be a bad connection. Use your meter to measure voltages. Make sure you have 5 volts at the + power supply pins and at pin 1(reset). What value is your resonator. The Picaxe editors have a troubleshooting feature you can use to test your connection. In PE 6 it's under the com port selection.

Good luck,
Rick
 

tarantulataramasalata

Senior Member
Hi Rick

4.8v at all supply pins inc. pin 1.

Pic of resonators attached - I ordered 16mhz?

Other picaxe chips program fine using my rig.

Connectivity throughout the circuit established...

I have tried 2 different chips - however, they have been kicking around for 10 years or so, and might have encountered something that killed them! I will buy a new picaxe and bin these old ones :(

Cheers!

IMG_20161106_182855731 (1).jpg
 
Top