I'm embarking down the road (I hope) of building a pinball machine. I'm planning on using a Teensy 3.6 as the heart of the project. I've never done something as complex as this before though and could use some advice on potential pitfalls or better solutions.
So, first of all, the general requirements:
- Play two .WAV files simultaneously. One is the music (couple minutes), the other is sound effects (couple seconds).
- Drive a DMD (Dot Matrix Display). For pinball, this is a 128x32 monochrome display that is driven similar to a video feed. There is no memory and no buffer. You have to refresh the display constantly at a rate of 70+ Hz. It is not a 'standard' interface (as far as I know) like I2C or SPI. See Vishay part number LEE-128G032B-1 if curious. Part of it does look like SPI, but I don't know if I could sync up all the other signals up to using the built-in SPI modules.
- Read in an 8x8 switch matrix. The simple way would be just a shift register setup. However, it's important that switch closures never get missed. I'd love to offload this to a TCA8418 ... but I'm unwilling to go down the road of soldering QFN's. There are other chips that are similar (like TCA8418E) but they're BGA's which I'm also not going to touch. Surprised I can't find anything similar in a QFP.
- Drive an 8x8 LED matrix. These will likely be > 3.3V in order to get the brightness needed to show up through the playfield inserts. That means high side and low side transistor switching. Like the switch matrix, probably use shift registers to drive power FETs.
-Drive solenoids. 50V, high power solenoids. Probably at least 16 of them, but I'm not sure if I'll need that many. Still, again, probably shift registers driving power FETs.
That's mostly it, I think.
I've already played with and have working a sketch that plays two wav files off the built-in SD card going to an I2S audio chip.
For the DMD I'm concerned though on the feasibility of the Teensy being able to handle everything. This seems like it would be the most processor intensive of the tasks. Or is it a lot easier than I'm picturing? I'd plan on storing bitmaps on the SD card and reading them in. Animations would be a series of bitmaps played at a relatively low framerate (but the display still needs refreshed at 70+ Hz). I'd also have to create an alphanumeric font.
The other thing I worry about is reading the switches. You really can't afford to miss any switch reads. They'll also be pretty 'quick', at least in human terms. Millisecond range? Plus also have to deal with switch bounce.
I've thought about 'offloading' one or more of these functions to either a co-processor or an FPGA. Digilent makes a nice Spartan 6 FPGA in a DIP form factor. Think of a Teensy, but with an FPGA instead of an Arm (but no easy to program software like Arduino). It would be great if I could keep it in one chip though.
The coils also have to be treated with respect. They absolutely need to be turned off in a short period of time (milliseconds) or they'll burn up. I'll probably enable the watchdog timer.
Anyways, any glaring red flags or things I can look into that may simplify implementing these features?
So, first of all, the general requirements:
- Play two .WAV files simultaneously. One is the music (couple minutes), the other is sound effects (couple seconds).
- Drive a DMD (Dot Matrix Display). For pinball, this is a 128x32 monochrome display that is driven similar to a video feed. There is no memory and no buffer. You have to refresh the display constantly at a rate of 70+ Hz. It is not a 'standard' interface (as far as I know) like I2C or SPI. See Vishay part number LEE-128G032B-1 if curious. Part of it does look like SPI, but I don't know if I could sync up all the other signals up to using the built-in SPI modules.
- Read in an 8x8 switch matrix. The simple way would be just a shift register setup. However, it's important that switch closures never get missed. I'd love to offload this to a TCA8418 ... but I'm unwilling to go down the road of soldering QFN's. There are other chips that are similar (like TCA8418E) but they're BGA's which I'm also not going to touch. Surprised I can't find anything similar in a QFP.
- Drive an 8x8 LED matrix. These will likely be > 3.3V in order to get the brightness needed to show up through the playfield inserts. That means high side and low side transistor switching. Like the switch matrix, probably use shift registers to drive power FETs.
-Drive solenoids. 50V, high power solenoids. Probably at least 16 of them, but I'm not sure if I'll need that many. Still, again, probably shift registers driving power FETs.
That's mostly it, I think.
I've already played with and have working a sketch that plays two wav files off the built-in SD card going to an I2S audio chip.
For the DMD I'm concerned though on the feasibility of the Teensy being able to handle everything. This seems like it would be the most processor intensive of the tasks. Or is it a lot easier than I'm picturing? I'd plan on storing bitmaps on the SD card and reading them in. Animations would be a series of bitmaps played at a relatively low framerate (but the display still needs refreshed at 70+ Hz). I'd also have to create an alphanumeric font.
The other thing I worry about is reading the switches. You really can't afford to miss any switch reads. They'll also be pretty 'quick', at least in human terms. Millisecond range? Plus also have to deal with switch bounce.
I've thought about 'offloading' one or more of these functions to either a co-processor or an FPGA. Digilent makes a nice Spartan 6 FPGA in a DIP form factor. Think of a Teensy, but with an FPGA instead of an Arm (but no easy to program software like Arduino). It would be great if I could keep it in one chip though.
The coils also have to be treated with respect. They absolutely need to be turned off in a short period of time (milliseconds) or they'll burn up. I'll probably enable the watchdog timer.
Anyways, any glaring red flags or things I can look into that may simplify implementing these features?