4 ms·
For solenoids, sure, though some of them (the flipper solenoids) need to be PWMed to vary their strength; you do a full-strength pulse at the beginning to drive
by lambda 13y ago
For solenoids, sure, though some of them (the flipper solenoids) need to be PWMed to vary their strength; you do a full-strength pulse at the beginning to drive the flipper with a good amount of force to hit the ball, but when you hit the end of the stroke, there's a switch that tells you to switch to PWM with a low duty cycle so you avoid overheating the solenoid but can still hold the flipper up to trap the ball. So you need at least the ability to PWM that. Sure, I could probably build a little timer circuit to do that, but it would be convenient if I could just bit-bang a GPIO pin instead of building more hardware.
For driving a few dozen RGB LEDs with PWM to control brightness on each of the three channels, you're very quickly going to reach the limits of what you can do with a standard PIC. Or even if not driving the LEDs directly but using something like these: http://www.adafruit.com/datasheets/WS2812.pdf http://www.adafruit.com/datasheets/WS2812.pdf you need to be able to produce a fairly high precision 800 khz serial signal with no clock.
Between the number of inputs and outputs needed (lots of switches and sensors on the playfield, lots of solenoids to kick out balls and control various toys, lots of LEDs), and the high-speed output needed to drive the LEDs, I'm not sure a standard PIC is going to cut it, though I haven't actually sat down to calculate out the precise number of I/Os and speed that I'll need so I may be wrong. I'm more looking for a ballpark of what I should get a dev board for and start playing around with, I may wind up changing my mind and switching to something else later.
- ers35 13y agoTake a look at XMOS: http://www.xmos.com/ http://www.xmos.com/
- lambda 13y agoCan you tell me a little about it, and why I should prefer it over a GA144, FPGA, or Propeller? I have a lot of options already, I'm looking to narrow them down, not expand the list to have even more to consider; but if there's a compelling reason I'll take a look.
- digikata 13y agoYou might look into an io expander chip to hook to your pic via I2C or some other protocol. Many of them also have a few PWM outputs. 4, 8, or 16 additional GPIO's are pretty common, and higher pin count expanders are out there, but they get a bit more specialized as the counts go up.
- sehugg 13y agoFor the LEDs and solenoids I'm guessing the PWM frequency is in the sub 1 kHz range, so you should be able to bit-bang perfectly well with even a low-powered uC. Timing precision for those shouldn't be very strict. As for the WS2812, that's annoying :) It would be nice if it could use SPI or a UART. I see the NeoPixel library uses bit-banging with interrupts disabled and relies on instruction timing, yuck. But hey, it might work. I've seen single-wire stuff work on Windows CE, for crying out loud. AFAIK you don't need a continuous 800 kHz signal, you can just send it when you want to update.
- lambda 13y agoYeah, the WS2812 does have a fairly unique interface, but at 45¢ for an RGB LED with a built in constant current driver, it's pretty much the cheapest option per LED. Other options I've seen like the A6281 are $2 for just the driver itself, without the LED. Since there are probably going to be at least a few dozen LEDs, the per LED cost can add up quickly, so I'm fine with spending a bit more on a more powerful microcontroller or FPGA and learning a new system. And of course, part of the goal is to learn new things and have fun with the project, so some of these new highly parallel microcontrollers like the GA144, Propeller, XMOS, or even an FPGA would be more interesting to work with than a standard PIC, even if they may technically be overkill. This is the first time I've done hardware hacking in a while; the last time I did it I used a 68008 as my microcontroller. So I'm hoping to find something that will be interesting to learn, not too hard to use, and capable of everything I'm going to throw at it, so I don't have to go through several iterations of buying expensive development boards only to discover that I can't drive my dot matrix display or I can only drive half of the playfield LEDs that I need or that interrupts from the flipper buttons cause my LED color fades to flicker since they screwed up the timing of my signal to the driver or something of the sort. One of the problems is that since there are so many choices, and I haven't done hardware hacking in a while, I don't have a good sense of what I'll be able to do yet. Maybe I should start small, with an Arduino or a PIC or something of the sort, and move up if I discover that that can't do something that I want.
- mindslight 13y agoComing back into the hardware world after being away for several years, I find the ARM Cortexen pretty damn compelling for the possibility to do the high level programming in something besides C. And a STM32F4 Discovery board is only ~$15. (And yeah, I feel dirty for blowing up a GreenArrays thread with a suggestion for a more traditional microcontroller, especially not having really studied the GA chip.)
- mindslight 13y agoWhat you're describing seems comfortably doable with a mid-range PIC with a lot of I/Os, but it really depends on how you're looking to program this (and how complex your game logic is going to be). For example, bit banging all of the PWMs can be done from one timer interrupt, but you need to be clever so that it doesn't use too many cycles. Keep in mind at this level, C is considered a high level language. A FPGA is extreme overkill for this, and keep in mind that you still need some CPU to drive the logic (which could be on the FPGA chip itself, but I don't think this class of FPGA is reasonably priced). A CPLD is still overkill, but at least you don't need to futz with separate configuration memory. And you'll still be doing low-level programming for reconfigurable logic, just in Verilog instead of assembler. Your level of parallelism isn't actually very high, and I suspect a large single-thread 32-bit microcontroller will do you just fine unless you're looking for an excuse to play with something else.
- cpuguy 13y agoYour design would be made vastly simpler by using LEDs that have the PWM built in. Then your MCU only needs to write to them when the settings need to change. Adafruit also carries this type. I've tried them and they are very easy to use. The interface is essentially a SPI bus. So, can I assume you're not willing to pay the extra cost for built-in PWM?