Current methods for using computer to detect events?

Other race electronics and general electronics discussions.
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Current methods for using computer to detect events?

Post by Stan Pope »

I'm looking for the current best methods for simple attachment of experiment event monitors. In the good old days (i.e. MS-DOS days), one could use the printer port inputs with simple programming to count or time events with simple electronics and simple programming. What are some good current methods?

At http://www.ao-cs.com/~regan/pinewood/, Regan describes the kind of functionality that I want, although he has provision for more inputs than I need.

I would like to count and compute delta times for a series of pulses. The data source is from my friction test equipment involving a 2 ounce ring attached to a PWD wheel. Goal is to measure the time needed for prescribed numbers of revolutions (corresponding to various track lengths) and also to measure time for the wheel to spin down entirely. Sensing via LED / Photodiode through either TTL or CMOS interface.
Stan
"If it's not for the boys, it's for the birds!"
User avatar
gpraceman
Site Admin
Site Admin
Posts: 4926
Joined: Fri Jun 20, 2003 12:46 am
Location: Highlands Ranch, CO
Contact:

Re: Current methods for using computer to detect events?

Post by gpraceman »

With Windows providing too many layers between the hardware and software, I would not depend upon any direct inputs. There can be latency in there. You may want to consider getting an Arduino board and program the microcontroller to do what you are looking for and then communicate your data over a serial port (or via a USB to serial interface). The Arduino has a good number of I/O pins that you can take advantage of and it is not too hard to program it. There is the Arduino Mega, if you need even more I/O.

http://www.arduino.cc/
http://www.sparkfun.com/categories/103

Image
Randy Lisano
Romans 5:8

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.
dna1990
Master Pine Head
Master Pine Head
Posts: 360
Joined: Wed Jan 09, 2008 8:16 pm
Location: Houston, TX

Re: Current methods for using computer to detect events?

Post by dna1990 »

I second the arduino platform if starting new. Lots of help forums and examples, etc. Lots of new 'shields' being developed and sold.

But just good cheap PIC programming is fine too (the arduino is just a packaged micro platform). Get something like PICBasic or MikroBasic (or C) and go to town. They all have very simple serial interface abilities, but also I2C and SPI routines if needed. Surprisingly easy to get started.

Let the micro do all the low level timing and counting (less influenced from PC timings, MS Win bloat, etc). And just pass the results to the PC for data analysis and display.
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

Thanks, guys.

Sounds like it will be more work than I hoped for, but if I can get there, it should be a good utility function to keep around.

Why:
On my web page A Method to Compare Pinewood Derby Wheel-Axle Frictions from 2003, I suggested an improvement involving timing the number of revs necessary to traverse typical tracks rather than timing the period for motion to totally decay. This approach also improves the data gathering by clearly identifying the "start-up time" for the motion. By reducing the interval to "real track" terms, that start-up time becomes a more significant part of the total time, and, if the setup is done well, I can zero in on it with accuracy!

I finally found cheap, readily available material for a steel ring and just about have it completed. Thought I'd go ahead and try to actually run some of the friction experiments that I listed on the web page.

So, I guess I gotta set about learning about these Arduino rascals! :)
Stan
"If it's not for the boys, it's for the birds!"
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

Anyone who wants to participate in the development of said device is welcome! Payment for assistance (other than citation as coauthor) probably can't happen, though. :)
Stan
"If it's not for the boys, it's for the birds!"
*5 J's*
Master Pine Head
Master Pine Head
Posts: 755
Joined: Fri Apr 03, 2009 8:55 am
Location: Norway, Maine

Re: Current methods for using computer to detect events?

Post by *5 J's* »

Stan - I looked into this a bit a month or two ago but put on the back burner as I got busy with some other stuff. The other issue was fabricating a ring that didn't cause the wheel to orbit on the axle. I tried cutting a hole in a wooden disc, eveny weighted, but couldn't get the wheel into the disc perfectly square so the wheel tended to orbit - at that point I knewI would not be able to get consistent results and put this project on the back burner.

Anyway - I was looking into using an Arduino board and using a IR emitter and collector to count the revolutions, and give me the time it took to complete x revoltutions as well as to tell me the total number of revolutions and total spin time. I also can across this slot sensor.

I may have more on my other computer. I'll check Tuesday if I have more (cannot remember how far I got).
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

*5 J's* wrote:Stan - I looked into this a bit a month or two ago but put on the back burner as I got busy with some other stuff. The other issue was fabricating a ring that didn't cause the wheel to orbit on the axle. I tried cutting a hole in a wooden disc, eveny weighted, but couldn't get the wheel into the disc perfectly square so the wheel tended to orbit - at that point I knewI would not be able to get consistent results and put this project on the back burner.

Anyway - I was looking into using an Arduino board and using a IR emitter and collector to count the revolutions, and give me the time it took to complete x revoltutions as well as to tell me the total number of revolutions and total spin time. I also can across this slot sensor.

I may have more on my other computer. I'll check Tuesday if I have more (cannot remember how far I got).
Cool! I'll talk to you more about this and get you some details as the ring testing proving progresses. I'm close to having a well-balanced ring of requisite size. Just a bit more trim needed to get the static balance "on". The ring seems to align well on a wheel and spin with acceptable lateral runout. I haven't checked the dynamic balance, but hoping that the machining is symmetrical enough that there are no problems with that.

My guess is that the orbiting arises from lack of dynamic balance, and that is easy to cause with composite construction. I sketched out a series of symmetric holes which when lead filled were sufficient to bring a 2" od wood ring up to 2 ounces. At that, I was sure that I would have to carefully match the opposing lead slugs and their insertion depth or the rascal would wobble like a boozer on Saturday NIght.
Stan
"If it's not for the boys, it's for the birds!"
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

You guys are really a bad influence on me! But I won't tell my Bride.

I may be in for a "learning experience." Hope it is a good one.

I ordered an Arduino Uno and started writing the timing program. It looks like I can't make the program as parametric as I hoped, but the cases I'll be studying don't require frequent changes in the track lengths. I'll just time the "standard" cases during the same "spin." At least it "speaks my language" ... mostly.

I suspect that I can't divide an individual wheel rotation as finely as I had hoped ... the chip is probably not fast enough. But I'm pretty sure that I can screw it down to 0.05 or 0.1 rotations per state change. And that should be good enough.

Now to set the photodiode up in a manner that it doesn't interfere with rewinding the ring! Maybe go "reflective or not" instead of "opaque or not". And learning how to make "my PC program talk to the device. But that is for later!
Stan
"If it's not for the boys, it's for the birds!"
*5 J's*
Master Pine Head
Master Pine Head
Posts: 755
Joined: Fri Apr 03, 2009 8:55 am
Location: Norway, Maine

Re: Current methods for using computer to detect events?

Post by *5 J's* »

I cannot find the info I thought I had saved Stan. It was something about how to interface or read the sensor such that you did not miss a status change. I think it was related to an interrupt, but it was quite a while ago.
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

*5 J's* wrote:I cannot find the info I thought I had saved Stan. It was something about how to interface or read the sensor such that you did not miss a status change. I think it was related to an interrupt, but it was quite a while ago.
I've got the concept! Good shot!

It alerts that the timing scheme is defective so I know that I"m not sitting there, hour after hour, producing scrap!
Stan
"If it's not for the boys, it's for the birds!"
John Shreffler
Merchant
Merchant
Posts: 163
Joined: Wed Feb 04, 2004 8:32 pm
Location: Vienna, VA
Contact:

Re: Current methods for using computer to detect events?

Post by John Shreffler »

How many events are you looking at? If it is not over 8, you could use The Judge processor, and put the results into Excel, where you could compute deltas automatically. If interested, I could send you a chip.
John Shreffler
Maker of The Judge
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

Well, Mr Postman brought part of the Arduino order a couple days ago, but the rest is still enroute. Starting to get anxious to try it out! Loaded the software up on this box and on my laptop (which is the box that will be working in the shop.)

Bride wasn't really very impressed with the Arduino card ... gave me one of those "$30 for that?" kind of looks. But I just think of it as diamonds and rubies ... for a nerdy guy! :)

The timing isn't greatest ... Grandson Andrew finished painting his cars tonight. Final assembly and bench tuning tomorrow. Then on to a track somewhere to prove that it works.

He did a really nice job on the wheels and axles this year ... took his daddy some effort to keep him focused. His attention span is still short. But they did it in short sessions over a week + timespan.

If he qualifies for district, we may hit the shop again and maybe have some Arduino results to factor into the plan.
Stan
"If it's not for the boys, it's for the birds!"
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

John Shreffler wrote:How many events are you looking at? If it is not over 8, you could use The Judge processor, and put the results into Excel, where you could compute deltas automatically. If interested, I could send you a chip.
The thread sits idle for a couple of days, then after I start typing an update, in comes a new post!

Very generous offer, John, thank you. If I understand the chip, it would function nicely with separate LED/photodiode detectors scattered along a real track. In my case, for this first app. I'm gathering data from just a single loaded spinning PWD wheel on a PWD axle counting and timing fractional revolutions. I don't immediately see how I would use the chip. Did you have some specific ideas?
Stan
"If it's not for the boys, it's for the birds!"
John Shreffler
Merchant
Merchant
Posts: 163
Joined: Wed Feb 04, 2004 8:32 pm
Location: Vienna, VA
Contact:

Re: Current methods for using computer to detect events?

Post by John Shreffler »

The chip delivers times to .0001 seconds expressed in ASCII and formatted serial 9600-8-none-1. The chip itself does not know or care that it is on a pinewood derby track and that the inputs are generated by IR sensors. The inputs could be switches, magnetic pulses into a Hall Effect device, mercury sloshing around in a vial, or somebody shouting into a microphone. The only questions are: are 8 data points enough? Is it appropriate to consider a common start point and have 8 channels? Tell me more about what you are trying to do.
John Shreffler
Maker of The Judge
User avatar
Stan Pope
Pine Head Legend
Pine Head Legend
Posts: 6856
Joined: Sat Jul 05, 2003 7:01 pm
Location: Morton, Illinois
Contact:

Re: Current methods for using computer to detect events?

Post by Stan Pope »

John Shreffler wrote:The chip delivers times to .0001 seconds ... Tell me more about what you are trying to do.
Okay. Sorry, I almost included this detail this morning, but thought you already knew the background. In 2003, I described a friction comparison apparatus at http://www.stanpope.net/pwafm.htm. I'm just now getting around to actually building one!

Two inputs, only.

The device being sensed is a 2 ounce ring with friction fit over a PWD wheel sitting on a PWD axle. The ring is accelerated by a falling weight which then detaches and allows the ring to "coast" to a stop. The ring face is marked with bars so that its rotation can be sensed and timed. So, one input is the start or release and the other is the change between dark and light (or reflective and nonreflective) in the band of bars.

Depending on the hardware speed, the ring face would be divided into between 10 and 100 intervals. My intent is to time from release to various numbers of rotations. The number of rotations would correspond to the distance the wheel would travel. Distances of immediate interest are 0.3" (stiction), 2' (end of acceleration phase), 12', 20', 28', 36', 44', and stopped (end of coast phase), and some intermediate distances corresponding to BestTrack S/L to F/L distances. Sensing the stopped state is the one that demands that the rotation be sensed to less than about 36 degrees.

Experimental variables include bore treatments, axle treatments, and axle orientation.

The PIC program is given the various distances (converted to fractional rotations) and records and reports the time from start until each of the events.
Stan
"If it's not for the boys, it's for the birds!"
Post Reply