Home brew slot car lap counter - Page 1
Forum section: electronics / projects

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 03, 2023, 04:35:45 pm
content: Help, I am working on a lap counter for the slot cat track. I have a optical photo transistor under the track. That feeds a hex inverter that drives a decade counter. If I hook it all up to my audio generator it all works as far as the counter part. The problem is with counting the pulses out of the optical transistor. I get false readings. Any ideas on how this could be made to work? Or maybe a better way? Thanks Mike

author: CaptDon
author_rank: Super Contributor
timestamp: March 03, 2023, 06:11:45 pm
content: How about a schematic? How about driving a one shot 74121 etc so you don't get multiple hits for a single event?

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 03, 2023, 06:20:46 pm
content: Not sure how to post a schematic? How do I trigger the 74121? In a nut shell I need to figure out how to input a 74LS90 counter. Mike

author: pqass
author_rank: Super Contributor
timestamp: March 03, 2023, 08:25:44 pm
content: Q: How to post a schematic?A: Create a PNG, JPG, GIF, PDF, or whatever and attach it to your message; see "Attachments and other options" link below your message textbox.Q:"I get false readings..."A: Your circuit could be too sensitive or it may be triggering multiple times for the same car (due to light flicker).As it was suggested, you could use a 74121 monostable IC to create a consistent width pulse on the first trigger received. ie. for duration of a car traveling at the slowest speed over the phototransistor. This should eliminate multiple triggers for the same car.Alternatively, you can use an RC network to clean up the flicker. See 2nd circuit here:https://www.eleccircuit.com/light-actuated-relay-circuits-by-photo-transistor/.You may need to play with the R1C1 and VR1. Given that your Vcc is 5V, you could use a 74LS14 instead of the 40106.

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 03, 2023, 10:10:27 pm
content: Thanks I will look into this. Now can I take the output from the optical transistor and use that for the input to the 74LS14? Mike

author: pqass
author_rank: Super Contributor
timestamp: March 03, 2023, 11:04:00 pm
content: See attached for a corrected schematic.I've added a fixed R2 resistor to make sure that the phototransistor isn't placed directly across the power rails (when VR1 is at its minimum resistance).Phototransistors don't produce current on their own like solar cells. They need to be biased (via VR1, R2). When light hits it, it effectively changes the voltage at the emitter pin. R1, C1 combination slows down this change of voltage (to suppress brief flashes) but if the change in voltage is sustained, the schmitt trigger input threshold to the inverter will be crossed and the output will flip (and only flip back if the voltage goes back past the other threshold).You're probably going to have to have a consistent light source above the track; probably can't rely on ceiling lighting.And, you're going to have to experiment with the 1M VR1 pot to control sensitivity; maybe 100K, 10K, dunno.The output of the circuit can feed the 74ls90 counter directly.FYI: How does a phototransistor work:https://www.elprocus.com/phototransistor-basics-circuit-diagram-advantages-applications/

author: james_s
author_rank: Super Contributor
timestamp: March 03, 2023, 11:32:48 pm
content: The 10M and 1M resistor values seem very high to me, it's possible you're picking up electrical noise from the slot cars themselves. Between the arcing brushes in the motor and the pickup brushes to get power from the track to the car there could be quite a lot of noise. 1uF seems very large for the capacitor there too, 0.1uf is more typical for that sort of low pass filtering.

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 04, 2023, 12:11:59 am
content: This is the circuit I am using for the sensor. I am going to order some SN74LS14's. Hoping that does the trick.

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 04, 2023, 12:17:08 am
content: Thanks for all the help. I think I am on the right track. Mike

author: CaptDon
author_rank: Super Contributor
timestamp: March 04, 2023, 12:25:39 am
content: So I take it you are using an LED emitter / photo transistor receiver both down in the slot to detect the actual guide that is part of the car as it passes through. Is it one of those 'one piece' devices where the emitter and detector are in a singular plastic housing? Get classy with your 7490 counter and add a reset push button and use the 7490 to drive a 7447 7 segment display.

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 04, 2023, 12:54:26 am
content: Yes one of the parts that has the led and transistor in one pack. It outputs multiple outputs that screw up the count. Hoping that a SN74LS14 will clean up the signal to the counter.

author: pqass
author_rank: Super Contributor
timestamp: March 04, 2023, 01:10:15 am
content: Quote from: WB8PFZ on March 04, 2023, 12:11:59 amOh!I thought you just had a phototransistor pointing upwards through a hole in the track and relying on the car to block the overhead lights. Are you using a specific kind of photo interruptor like these (https://www.google.ca/search?q=slot+photo+interrupter+sensor&source=lnms&tbm=isch) or are you making one of your own with a discrete LED and phototransistor? You may have alignment issues or too fat a beam width where a bouncing car isn't fully blocking the light.Are you able to view the output (at the emitter) with an oscilloscope?Maybe the phototransistor isn't fast enough (to cope with the pin/blade width), leading to slow rise/fall times.Check your datasheet as the choice of resistors (1K LED and 10K emitter resistors in your case) may dictate response times.For example, page 3 test circuit here shows 50R for LED resistor and 100R on the emitter to produce 10us/8us rise/fall times (https://www.mouser.ca/datasheet/2/427/tcst1103-1767323.pdf)However, the schmitt inverter should help square up slow signals (as long as the emitter rises above about 1.6V; the upper threshold).

author: geggi1
author_rank: Frequent Contributor
timestamp: March 04, 2023, 09:49:56 am
content: Insted of doing this optical have you considered to do this magnetically.By using a hall sensor you might get a better and accurate pickup of the car.The simplest way to get a hallsensor is to scavenge one of an old PC fan.You can try to see if it is possible to detect the magnet in the motor, if not you can attach a tiny button size magnet to the car.

author: WB8PFZ
author_rank: Regular Contributor
timestamp: March 04, 2023, 12:38:28 pm
content: My electronics goes back to the mid 70's when I was in electronics in school. I remember building circuits using the parts I am using now. That's why I decided to go this road. Not really up on hall sensors but I will do some research. Actually cars come with magnets on them for grip to the track. Here is the picture of the optosensor I am using. Mike

author: CaptDon
author_rank: Super Contributor
timestamp: March 04, 2023, 01:50:11 pm
content: A 7414 may help but won't solve the issue. The counter can trigger as fast as 30Mhz. You need to trigger a one shot like a 74121 or the dual retriggerable 74123. Set the output pulse at perhaps .25 seconds. That way it can only generate one pulse and by the time it can generate a second pulse the car will be long gone. With the retriggerable 74123 set at .25 seconds the worst that could happen is you would get one pulse slightly longer than .25 seconds. I highly suggest you get a copy of 'The TTL Cookbook'!!! Every item you need to complete your project is covered in great detail in that book. All the way from de-bouncing circuits to counters to readout displays. It's all there including practical circuit schematics with real parts!! I have owned my book since 1976 first edition sixth printing and I still refer to it often!! It has handy timing charts to select components for timers and one shots!! Cheers mate.

author: Terry Bites
author_rank: Super Contributor
timestamp: March 04, 2023, 02:17:45 pm
content: A TSOP18... series detector will only respond to a 38kHz pulsed IR source. Shine an IR LED pulsed at 38kHz at the TSOP18...You need to run the emitter at low power to avoid flooding the area with IR.Run the LED from a 555 oscillator or from an Arduino...... GPT says:int ledPin = 9; // choose the pin for the LEDvoid setup() {pinMode(ledPin, OUTPUT); // declare the LED pin as an output}void loop() {digitalWrite(ledPin, HIGH); // turn the LED ondelayMicroseconds(13); // delay for half the cycle (1/76 Hz = 13 microseconds)digitalWrite(ledPin, LOW); // turn the LED offdelayMicroseconds(13); // delay for the other half of the cycle}

author: CaptDon
author_rank: Super Contributor
timestamp: March 04, 2023, 06:51:20 pm
content: B.T.W., the 74121 and 74123 one shot devices have hysteresis on their 'B' inputs eliminating the need for the 7414. The pulsed 38Khz suggestion is probably getting more involved than what you want or need. If you can get the TTL cookbook (Howard Sams publishing, written by Don Lancaster) there is a wealth of knowledge in that book and a huge learning experience for your journey. It covers everything for your need and explained in detail yet simple enough for a beginner to build the examples and see them work. Best wishes with your project. Remember with logic I.C.'s, good power supply regulation (You can use a 7805 for your project) power supply filtering and bypass capacitors near each I.C. are a must. And properly terminate unused inputs!! Cheers!!

author: james_s
author_rank: Super Contributor
timestamp: March 04, 2023, 07:00:28 pm
content: Quote from: WB8PFZ on March 04, 2023, 12:38:28 pmHall sensors are simple, you can get them that have a digital output, you supply power and the output goes active in the presence of a magnet.

author: jbeng
author_rank: Regular Contributor
timestamp: March 05, 2023, 06:21:07 pm
content: If you want to use the 74-compatible logic series, I'd probably recommend 74HC14 instead of LS. You can easily use them to create one-shots by connecting them as shown in the right ride of the image below.When I'm using phototransistors, I usually connect them so they are current sinking instead of sourcing. Of course, in that configuration, their output is inverted, that is, it goes logic HIGH when the light path is blocked. See below, left side.