Saturday, February 12, 2011

Stand Alone

Yepp, I've pretty much decided that I will be creating the pinball for standalone use. The old plans with a PC-centered machine is now gone. I will use the PC while developing to read logs etc, but the final version will run on it's own. You can't argue with 3 sec boot time.

Arduino - you handsome beast!

But there's a little speed bump....
I'm think about using shift registers to control the lights instead of directly using the pins on Adruino. Why, you say?  Simple reason: I want to be able to use multiball features!
The original plan was to use bitwise operations to get more inputs, based on the fact that a ball rarely (i.e never) touches multiple switches at the same time - like this:

Input:
1.................. to 16 = 16 inputs total
1 + 2 ........... to 16 = 16 + 15 inputs total
1 + 2 + 3 ..... to 16 = 16 + 15 + 14 inputs total

You get the picture.
But when using multiple balls it may be possible to hit multiple different targets at once - thus registering faulty hits with said method above. Not good.

So I got more or less a couple of options:
A) Get more Arduino units and let them do different tasks - one for input, one for output etc. They would be communicating internally via serial ports to exchange data.
This may be a feasible solution as it also gives me "dual core" capabilites, like not relying on a single loop for game features, simultaneous updates etc. But it's not very cheap.

Pro's: Dual cores, load balancing, dedicated tasks. Free's up system resources since a lot of the code can be moved to the other cpu.
Con's: Somewhat expensive.

B) Use shift registers for lights.
This allows me to get more lights by sacrificing a couple of pins to gain 8-16 more (depending on chip). The chips retain their status so I can fire&forget the lighting states and the chip will continue to do its thing on its own. It is also possible to link multiple shift registers together for additional ports WITHOUT using more pins on the Arduino itself. And the chip itself costs 1$. Sweet!

Pro's: Cheap.
Con's: Slightly more challenging to control lights. Ok, I lied. A lot more challenging. No load-balancing or dual cores.


Currently I'm leaning towards a second Arduino (possibly a smaller version even).
I think the current input/output requirements was around 95 outputs and 50 inputs.
So I need at least 40 more I/O's - unless the playfield changes.

And once I start adding graphics and sound, I'm not so sure one single Arduino will do the trick...

No comments:

Post a Comment