Optical sensors and a pinball project

Hello, all! I'd like my Arduino to know what the score is on a 1970's pinball machine. I think I've got the right idea, but if anyone has any input, I'd love to hear it.

This pinball is so old it uses mechanical reels to display the score. Four of them, to be precise, each one powered by a single step-up coil that runs at 40v AC.

(everything inside this machine runs at 40v AC. Apparently having Frankenstein's Lab levels of lightning arcing inside as it's running is just fine and expected for a machine of this age.)

I want my score to be mirrored on an LCD or e-paper display connected to the Arduino, so that I can add high-score functionality and enable scoring higher numbers too (a lamp comes on once you pass 100,000 points, but when you get to 199,990 points, it just cycles back around to 100,000 points again).

At first I thought about sensing the voltage sent to the score reel step-up relays - but there are two problems with that. First, it's 40v AC, so I'd be looking at a step-down transformer for every reel, and that just doesn't sound like fun to me. Second, more crucially, sometimes two pulses are sent in rapid succession to a score reel, and the mechanical reel itself doesn't have time to register both - it's more important to me that the readout on the Arduino reflect the readout on the reels than that the Arduino reflect what the player's score should be.

So, after a bit of dillydallying, I'm leaning towards an optical approach. I'm going to print out some strips of paper with ten different shades of grey, and affix them to the inside of each score reel. Black will be at the nine position, white at zero, and everything in between will be a shade of grey. Then I'm going to use some sort of photoresistor-and-LED kind of setup, to have the Arduino sense the position of the reels by evaluating the light coming back off the strip of paper. I figure I can take care of calibration in software - since the reels reset by stepping to zero and only counting up, I can get a baseline from a routine that watches for a big, sudden difference between white and black.

One wrinkle is that there are also flashy lights in the backbox where the score reels go, so we need to isolate the photoresistor from that light, or compensate in software.

I would like to find a package that has a photoresistor and LED (and preferably some sort of shading arrangement to make it so that only light reflected from the LED itself is registered) in one thing, so as to simplify the circuit, but I'm having problems finding an appropriate component. If anyone can help, or if anyone has a better idea, I'd love to hear it. :slight_smile:

Thanks!

-CavemanJoe

Can you not use Infra Red instead of visible light?
Instead of different shades of grey, print a barcode type system (using only black bars) printed on those A4 plastic sheets meant for laser printers.

I believe that the toner used in laser printers will not allow Infrared light to pass thru.

IR may get you less inteference from ambient light.

Google for Line detection IR sensors - used with robots that follow lines.

Another approach, would be to attach small magnets to each point and use a hall effect sensor.
(not sure about the cost of 50 or so small magnets though)

Instead of paper you could use very small bits of silver foil as a reflective mirror (glued on) to get a better reflected signal.

You will also need a mechanism to detect where you are starting from at power on! You could use the onboard EEPROM.

Finally, it can be a good idea to use a modulated signal to improve resistence to inteference.

PS: Uploading a photo of the problem area might help in getting better suggestions.

First thing - you do not use a transformer to monitor current to a 40V solenoid, you use an opto-coupler. Small and effective, a resistor to limit the current (which is minuscule compared to the solenoid current) and a diode (1N914) in reverse across the LED in the opto-coupler to protect it from the alternate half cycles.

This will of course, require software de-bouncing - but so will any sensor you use. You might also want to use an opto-interrupter to check the zero position of one or more reels.

Thanks for the replies, everyone. :slight_smile: Here are a couple pictures of the score reels themselves:



There are notches in the sides of the reels, which interface with the step-up solenoid - I thought briefly about just having those pass through a slotted optical switch and counting up, but in that case we'd need a method to detect the zero position. Also, if the score reel advances halfway, jiggles a bit, and then slaps back into position, the Arduino would still think it'd advanced.

I'm looking for a solution wherein the reels present their position to the arduino, rather than having the arduino deduce the position of the reels via counting-up from zero. As in, you should be able to clear the Arduino's RAM and have it immediately know the positions of the reels. I Googled about as per AnalysIR's suggestion for infrared sensors/emitters, and found these, which look promising: Infrared Emitters and Detectors - SEN-00241 - SparkFun Electronics

The idea of using magnets and hall effect sensors intrigues me, but would that be more reliable than infrared looking at ten different shades of grey?

Seems to me you are making this way too complex. I cannot see any reason why yould would not want the Arduino to be powered at the same time as the machine and simply count how often the solenoids are pulsed.

On further consideration, the zero reset or sensing should not be a problem in any case - as the machine already has a mechanism to reset the counters to all zero - does it not?

If this were in my hands, I would first try to make it work by only using the 'units' wheel to increment the count and not bother to read any other the other wheels. That should mirror the score on the wheels. I suspect that the way the machine works is to detect when the previous wheel has gone to zero and fire a solenoid to increment the next 'place' wheel. It's the same way C++ "increment" operator in decimal counting works. If the counts do not mirror each other (suspect machine error), then I would procede to monitor the other wheels to keep the scores the same consistently. The zero position of each wheel could be detected with a unique tab read by a photo-interupter and that 'place' count incremented by tabs at each digit on the wheel.- Scotty

Scottyjr - nice idea, but the tens, hundreds and thousands relays are driven by playfield and score motor switches in addition to switches on the preceding reel. Only the 10,000-unit reel behaves as you describe. If we counted up the 10's reel to give 5,000 points, the player would end up waiting a long time. :slight_smile:

Again, the reason I'm not taking zero as a baseline and then just counting pulses is because one electrical pulse does not equal one step on the reel. They don't work like that. They're supposed to, but they don't, because they're 42 years old. :sweat_smile:

Paul__B, thanks for the tip about the opto-coupler. That's gonna make detecting game-over and reset conditions a lot more straightforward! :slight_smile:

The opto couplers sounds like a good approach.

For the 'line' sensing I was thinking more of a matched pair like the package on this board Pololu - QTR-1RC Reflectance Sensor (2-Pack)

There are a whole series of matched pairs like this available, generally in black packages (also referred to as reflectance or proximity). You dont need to buy the one above, as the actual sensors should be cheaper. Based on the photos you uploaded you will get a unique pattern as each number passes by the sensor and as a check you also know that the numbers vary by one. Mounting at the rear, means you just have to adjust the number accordingly.

cool project btw 8)