Unlimited I/O pins

I would like to make a shield that will use 2 4051 multiplexers and 1 tlc5940 led driver

The tlc5940 is awesome because it has a serial output and serial input pin. By connected the serial output to the serial input of the "next" tlc5940 you can daisy chain them together to create as many pwm digital outputs as you like.

The 4051 allows you to select one out of eight inputs using 3 digital selection inputs. It also has an enable pin. The output of this device can be fed directly into one of the arduino analog inputs (say a0).

The tlc5940 has 16 outputs, but 3 of those will be fed into the 2 4051s to select which input is desired, 2 more tlc5940 outputs will used to populate the enable pins on the 2 4051s allowing us to inhibit one or both of them. This leaves 11 pwm outputs which can be used to drive external components.

So each shield will give you 11 additional pwm digital outputs and allow you to read 16 additional analog inputs.

By connecting the serial output of the tlc5940 to a jumper wire connected to a male header, you can use this "optional" pin to connect to the next shield in the stack. Each shield must have serial input broken out as a female header. The first one in the stack however, will gets its serial input from the arduino (D?). I think this should be accomplished by a dip switch to connect the serial input to the Arduino digital output.

So n shields should be stackable allowing for n11 additional digital outputs and n16 additional analog inputs.

Schematics and code will follow. This will be totally open.

Schematics and code will follow.

Look forward to criticising commenting :slight_smile:


Rob

Here is a link to the schematic and board.

http://atmega.site40.net/default.php?bookmark=#Unlimited IO Give it a minute to load...it is slow

I haven't ordered a board from the schematic yet. The board fits within 5cm x 5cm, even though the arduino pins are slightly bigger. This keeps the board cost down to $14.00 for 10, from www.iteadstudio.com.

Please start throwing stones comment.

Much appreciated....

Paul

Hey grey nomad, I checked out your website...retired at 45...impressive :slight_smile: I already missed that mark

retired at 45...impressive

He he, not hard to do if you don't have kids, do well in the IT industry and live frugally.

Re the board, I don't see a tlc5490, where is that?

What are the two headers on the right?

There are no component designators on the PCB so it's hard to determine what headers are what.

Apart from that the board looks OK, you web site skills need some work though :slight_smile:


Rob

I was able to find a real eagle definition of a tlc5940 from their user posted libraries. I replaced the 2 x 16 connectors with the actual tlc5940. I also downloaded the latest eagle 6.2.0 so this schematic will only load in that latest version. Going to order a board today. Where do you think I should put the eventual library. SourceForge, Github, or just keep it in a .zip file until its ripe mature?

Thanks

By the way the web-page is actually a wiki which allows an author to update the page online, and tailored to show parts/prices/datasheets and where to get them. So its rather fancy under the hood, although what is displayed to the user is kind of primitive. Going to speed it up soon.

If anyone would like to help with the library, I can mail out a free shield pcb. You will have to come up with your own 4051s (about 45 cents each at mouser) and tlc5940 (about $4.00 ouch at mouser...cheaper in groups of 5 in ebay). I should have 9 extra pcbs when the order arrives in about 3 weeks.
Thanks

I replaced the 2 x 16 connectors with the actual tlc5940.

Then we can hardly comment on the PCB design eh? And it's also not in the schematic I think.


Rob

Please check it again, you can see from the board picture, it has changed...thanks

I see you are using D11 for serial, that is also MOSI and so will stop this shield from being used with many other shields.

I hope you are using the auto router as no human could do such a crap job of running the traces :slight_smile:

I get that you want to daisy-chain the 5940s by passing the serial up the stack, but I'm not convinced your circuit does that.

SERIALIN and SERIALOUT of all boards are simply connected together, throw that DIP switch and all SERINs are connected to D11.

Normally with this setup you offset the signals, eg JP3:1 is SERIALOUT on a bottom board and SERIALIN on the board above it. This cannot be achieved with a backplane that uses PTH sockets because that forces every signal to be the same on every board. You need to use surface mount headers so pin X on a bottom board has a different signal to pin X on a top board.


Rob

Made a mockup to explain use of dip-switch on D11. Inputs and outputs are in the horizontal plane (disregard "vertical" in video)

The tlc5940 has 16 outputs, but 3 of those will be fed into the 2 4051s to select which input is desired, 2 more tlc5940 outputs will used to populate the enable pins on the 2 4051s allowing us to inhibit one or both of them

that is not going to work. The outputs of a TLC chip are PWM current sinks, these are not sutiable for feeding into 4051.

  1. Thanks for your insight. Is there a way to connect something to the 5 outputs of the tlc5940 that would make it compatible with the 4051?

  2. I noticed that the tlc5940 is rather pricey. Is there another led driver or digital output/io expander that I could use that:
    a) cheaper
    b) has a serial out/serial in so that I can daisy chain them
    c) be suitable to drive 4051.

  3. Or alternately is there another mux or analog input expander besides the 4051 that I could use that could be connected to the tlc5940?

  4. Or last question: I read in a forum that the tlc5940 can also be used as a mux. If I want to daisy chain shields together, do you think it would be possible to configure tlc5940 has analog inputs and pwm outputs?

Thanks.

Just maybe the 5490 will provide a stable output on your MUX control pins if you set a pin's grey scale to 0 or 4095. It's not spec'd one way or another in the data sheet though so I wouldn't make a PCB on that assumption. Even if there are small glitches you may be able to filter them out.

There are lots of IO expanders that will do similar but I don't know if many to the PWM bit though. Is PWM important?

What about the daisy-chaining, are you happy that will work?


Rob

PWM is nice, not essential.
Not sure if you are asking me or Mike about the daisy-chaining. I believe it will work and is essential to make the shields stackable. Unless you have a better idea :slight_smile:

PWM is nice, not essential.

Then there are 100s of IO expander chips, start by looking at the MCP23017.

about the daisy-chaining

I went on at some length about it in post #8 and I may be wrong, but if you're happy then so am I :slight_smile:


Rob

The video describes why Serial IN/OUT should work.

Between the tlc5940 and 4051 could you place a pnp transistor? Attaching the tlc5940 output to the base of the pnp transistor. When tlc5940 is sinking current, pnp transistor would allow current to flow and could generate a '1' for the 4051. In other cases would need a pull-down resistor when tlc5940 is not sinking current?

Or alternately connect tlc5940 to an inverter like SN54F04, whose output is then passed to 4051

Just maybe the 5490 will provide a stable output on your MUX control pins if you set a pin's grey scale to 0 or 4095

No you always get pulses, that is why there is a problem with inverting the drive sense, you can never turn the LEDs fully off. You don't notice that they are never fully on as one missing pulse in 4096 can't be seen.

Basically it is the wrong chip for the job, use normal shift registers if you want to drive a mux, don't waste the constant current drive on logic output.

The video describes why Serial IN/OUT should work.

OK, I didn't watch it because I don't have a lot of spare bandwidth for videos.

So you're using a flying lead, that gets around the problem. You could make it neater and automatic by using SMD headers if you can find some to match the Arduino ones in height.


Rob

Awesome. This 74HCT164N shift register looks cheap and should do the trick (its TTL rather than CMOS)?http://www.mouser.com/ProductDetail/NXP-Semiconductors/74HCT597N652/?qs=me8TqzrmIYXsoVpDH8r27nNtid1WYGOfPlFDvyOkLAs%3D

Looks like there already is a library for the 74HC595 (http://arduino.cc/playground/Main/ShiftOutX). Maybe I should go with them. Or perhaps the library for the 74HC595 would work with the 74HCT597. Mouser has 74HC595s for cheap alsohttp://www.mouser.com/ProductDetail/Toshiba/TC74HC595APFM/?qs=8GnAp0dDS0K%2fhdSuI3LXvWdzW04m25vQzTPL7BkTbzc%3d

I see that an smd header is slightly offset: Is this what you are referring to? In this way the lower serial out could connect to the upper serial in. I could add another dip switch for the first shield or just not populate the smd header for the first shield.

Many thanks

If you are happy with standard shift regs have a look at the TPIC6B595, same functionality and pinout as the 74HC595 but a lot more drive capability, 150mA per pin or about 1W+ for the pack at 25C.

Speaking of which you may have trouble with 20 of these all sinking a lot of current as the backplane GND pins may not be rated that highly.

The headers and socket strips I'm talking about are vertical SMDs. Because the header is on one side of the PCB and the socket strip is on the other you can daisy-chain a signal up the stack. You can do that with a single pin although I doubt they make them in 1-pin sizes.

Samtec have them as do many other connector manufacturers.


Rob