12 pwm outputs on an arduino type model?

I want to make a project that will preferably need 12 pwm capable outputs on an arduinotype chip. The idea is to make a box with twelve polystyrene blocks who move up and down through a pinballstyle mechanic. The polystyrene blocks are attached to metal rods which rest on springs and are pulled down by electromagnets. The magnets are activated in preprogrammed sequence by an arduino-type chip. To make movement smooth I would like to make use of pwm, but I can only find an arduino model with six capable outputs (Arduino Duemilanove), I want to avoid using two of these units. Does anybody have an idea for a work around or an alternative?

-Fietspomp

The TLC5940 IC has 16 channels of 12 bit PWM, and can be controlled with the SPI interface from Arduino.

Datasheet here:

There's an example in the playground, and even a Arduino library for it here:

http://www.arduino.cc/playground/Learning/TLC5940

But you probably need something to go in between the TLC5940 and the electromagnets, something that can handle the required current and voltage.

Thanks for the suggestion, I will have a good look at that model.

In between the chip and the magnets I will set up a stronger current/voltage and add a transistor for each used output, to accomodate the 100 mA needed per magnet.

Yes something like a TIP120 transistor should do it. Don't forget the diode to protect against back emf from the electromagnet.

Yes I found out earlier that pwm and electromagnets in combinantion need some protection from voltage spikes, what diode would you recommend?

Don't forget about the nice little ULN2803 Darlington Array chip. For $2 you get 8 pre-built transistor switches that have built in diode protection. It sure beats wiring up and testing all those transistors. Each channel can handle up to 500mA.

Each channel can handle up to 500mA.

Yes but you can only switch on about 650mA in total at any one time in one chip.
See:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Examples.html

Good point on the total max switchable power. I'll have to keep that in mind.

I have just been using the ULN2803 to replace signal transistors so far, I haven't tried any really big loads.

For this application, I think the load was stated as 100mA per channel with 12 channels. You would need 2 chips anyway since each only has 8 channels, so it sounds like it would be 600mA per chip. Pretty close to the limit. You would want to heat sink them for sure. 3 chips of 4 channels each would probably be better. Since it's PMW, the lower duty cycle might buy you some margin. I'd probably try 2 chips and see how hot they get.

I find it much more fun to connect pins than to wire up a transistor and 2 resistors times 12, so I'd lean towards the chip solution. Others may have more fun building up the discreet components.

Could a basic signal transistor handle 100mA or would you need to go with something larger?

"Could a basic signal transistor handle 100mA or would you need to go with something larger? "

A 2N2222A is a popular and cheap NPN small transistor that would handle that, especially in pulsed PWM service. Good to 800ma in pulse service.

Lefty

Um, the TLC5940 can handle 120mA per channel on its own.

The TLC5940 looks cool. $4.20 from seeedstudio, not carried at sparkfun.

It's still just a DIP style chip with no heatsink, how is it able to dissipate more power I wonder?

You would want to use a heat sink. It also comes in power pad surface mount packages that would be easier to use for high power. It can dissipate up to 3 watts.