Need Help with rctime and photocells
jmevans
Posts: 22
I am wanting to connect three photocells up on three pinewood derby lanes to monitor the finish line.
I have tested this with the BS2 but thought that the SX would be better with the Interupt capabilitys,
my question is what is the best way to do this using the interupt?
On the BS2 i used rctime to measure the ambiant light level then contuiualy checked for substantial changes on each of the three photocells.
A simple example would be of great help.
Thnx.
Mark
I have tested this with the BS2 but thought that the SX would be better with the Interupt capabilitys,
my question is what is the best way to do this using the interupt?
On the BS2 i used rctime to measure the ambiant light level then contuiualy checked for substantial changes on each of the three photocells.
A simple example would be of great help.
Thnx.
Mark
Comments
A photocell does not lend itself very well to interrupts. You would have to adjust them for different light levels.
You "may" be able to use a capacitor to sense a rapid change in light levels.
These values are just guesses, you might have to play around with them.
This should read as LOW until the photocell is darkened, then it should go HIGH for a short time.
If you want to use INTERRUPTS you would have to use one of the RB pins. But interrupts sound awfully complicated for this application. (Unless it's just as a learning exersice).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Post Edited (Bean (Hitt Consulting)) : 1/16/2007 10:15:38 PM GMT
My circuit uses the comparator with a calibration resistor to set the sensitivity of the photo-detector (part of an IR LED/transistor pair from RadioShack).
In the SX/B help file, under the INTERRUPT keyword, there is a demo that uses port B edge triggered interrupts to determine which button (of four) was pressed first. If you can adapt your detection circuit this may be the best way to go. The project discussed above is really designed to aid in fine-tuning the performance of a pinewood derby racer by measuring its "lap" time.
Post Edited (JonnyMac) : 1/17/2007 12:25:03 AM GMT
I would like to be able to get more accuracy in the timer (Maybe by using the Interupt)
and if it is possible to get more accuracy in the reading of the photocells that would be nice.
Thanks for any of your input.
Mark
You have a couple things working against you:
1st photocells are just slow reacting by nature (probably milliseconds)
2nd each RCTime command takes an uncertain amount of time to complete
If you look at Jon's schematic, you will see that he is using phototransistors. These react almost instantly (microseconds).
Also he is using a calibration pot so that he gets a digital signal (either on or off) from the phototransistor by using the SX28 built in comparitor.
You could probably get away with just using a pot instead of the 10K pull-up resistor in Jon's schematic, and adjust it for the threshold level of the pins (1.4V or 2.5V). It will be tricky though (If someone moves and their shadow goes over the track, it may think a car has passed over the sensor).
A better way to go might be to use a "break-beam" sensor. Each track would have a IR transmitter and IR receiver on each side of the track. When the car reaches the IR beam, it breaks it and creates a digital signal for the SX. The 38KHz frequency could be generated by the SX, and IR receiver modules are very common (these give a digital signal). This type of system would be accurate to more than 1millisecond.
Good luck,
P.S. What do you think about using one of my video display boards for a display ? It would be large enough for everyone to see. I'll donate one to you if your interested. They are 6 lines of 16 characters.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Post Edited (Bean (Hitt Consulting)) : 1/18/2007 4:06:29 PM GMT
P.S. I·would love to·try one of your video display boards, it·would be nice if everyone could see the results.
Thanks again
Mark
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman