Author Topic: Home brew slot car lap counter  (Read 1371 times)

0 Members and 1 Guest are viewing this topic.

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Home brew slot car lap counter
« on: March 03, 2023, 04:35:45 pm »
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
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2038
  • Country: is
Re: Home brew slot car lap counter
« Reply #1 on: March 03, 2023, 06:11:45 pm »
How about a schematic? How about driving a one shot 74121 etc so you don't get multiple hits for a single event?
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #2 on: March 03, 2023, 06:20:46 pm »
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
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 916
  • Country: ca
Re: Home brew slot car lap counter
« Reply #3 on: March 03, 2023, 08:25:44 pm »
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.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #4 on: March 03, 2023, 10:10:27 pm »
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
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 916
  • Country: ca
Re: Home brew slot car lap counter
« Reply #5 on: March 03, 2023, 11:04:00 pm »
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/
« Last Edit: March 03, 2023, 11:34:47 pm by pqass »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Home brew slot car lap counter
« Reply #6 on: March 03, 2023, 11:32:48 pm »
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.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #7 on: March 04, 2023, 12:11:59 am »
This is the circuit I am using for the sensor. I am going to order some SN74LS14's.  Hoping that does the trick.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #8 on: March 04, 2023, 12:17:08 am »
Thanks for all the help. I think I am on the right track. Mike
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2038
  • Country: is
Re: Home brew slot car lap counter
« Reply #9 on: March 04, 2023, 12:25:39 am »
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.

 
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #10 on: March 04, 2023, 12:54:26 am »
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.
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 916
  • Country: ca
Re: Home brew slot car lap counter
« Reply #11 on: March 04, 2023, 01:10:15 am »
This is the circuit I am using for the sensor. I am going to order some SN74LS14's.  Hoping that does the trick.

Oh!
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).
« Last Edit: March 04, 2023, 01:31:18 am by pqass »
 

Offline geggi1

  • Frequent Contributor
  • **
  • Posts: 442
Re: Home brew slot car lap counter
« Reply #12 on: March 04, 2023, 09:49:56 am »
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.
 

Offline WB8PFZTopic starter

  • Contributor
  • Posts: 47
  • Country: us
Re: Home brew slot car lap counter
« Reply #13 on: March 04, 2023, 12:38:28 pm »
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
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2038
  • Country: is
Re: Home brew slot car lap counter
« Reply #14 on: March 04, 2023, 01:50:11 pm »
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.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Online Terry Bites

  • Super Contributor
  • ***
  • Posts: 2517
  • Country: gb
  • Recovering Electrical Engineer
Re: Home brew slot car lap counter
« Reply #15 on: March 04, 2023, 02:17:45 pm »


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 LED

void setup() {
  pinMode(ledPin, OUTPUT); // declare the LED pin as an output
}

void loop() {
  digitalWrite(ledPin, HIGH); // turn the LED on
  delayMicroseconds(13); // delay for half the cycle (1/76 Hz = 13 microseconds)
  digitalWrite(ledPin, LOW); // turn the LED off
  delayMicroseconds(13); // delay for the other half of the cycle
}
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2038
  • Country: is
Re: Home brew slot car lap counter
« Reply #16 on: March 04, 2023, 06:51:20 pm »
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!!


 
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Home brew slot car lap counter
« Reply #17 on: March 04, 2023, 07:00:28 pm »
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

Hall 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.
 

Offline jbeng

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Re: Home brew slot car lap counter
« Reply #18 on: March 05, 2023, 06:21:07 pm »
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.
"It's such a fine line between stupid and clever" - David St. Hubbins
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf