Comments wanted: Designing a Gadgeteer input/output module

I wanted to try out ordering a PCB on seeedfusion and had some space left on the standard 10x10 board size. So I came up with the idea of creating a simple pushbutton input / led output gadgeteer-“compatible” module. In my recent projects I had used a couple of MaxOs, liked them and thus decided to take that as a starting point and add input myself using the “dual” of the 74HC595, namely the 74HC165 for that purpose.

This is not my first PCB design, but I am far from experienced and would feel a bit better if someone who has experience could have a look on my design. And maybe point out some things that I should avoid or do differently?

It seems I cannot upload PDF files here, so I’ll have to link it. Hope that’s okay: Dropbox - InOutModule.pdf - Simplify your life . (I could also provide gerber files if needed). If you look at it, on the left you will see the inputs, on the right the outputs, on the bottom the “upstream” gadgeteer connector (towards the SPI master - mainboard), on the top the downstream gadgeteer connector.


What I am looking forward is to get comments about the layouting/tracing in general, and maybe have a close look at the ground plane as well (first time I used it).

Some points/“requirements” worth mentioning - if you ask yourself why the heck it looks the way it does:

  • The module should be a) chainable with another of the same or b) with MaxOs (I typically have many more outputs than inputs)
  • The push buttons will connect to ground, so a pull-up resistor on board is needed for every input
  • I don’t have easy access to gadgeteer sockets but i intended to use those mini breakouts together with a 10 pin male header as a replacement
  • It needs to be hand solderable given my moderate soldering skills and tools (i.e. no hot air station), therefore I chose to use through hole components for the ICs. I have already successfully soldered 0603 so those are alright for me, but if it has it’s legs too tight together I won’t be able to catch it
  • The module will use only 5V and that’s intended. The MaxO powers its output from 3.3V and it’s a bit hard to find the right leds cheap given the preinstalled 330 ohm series resistors. Besides, 5V comes directly from the external supply and thus does not have to be linearly regulated down and produce heat
  • I applied the default settings for trace width/distance that I used on my previous boards. seeed probably can deal with a lot thinner traces but it’s ok for the moment like that
  • I use Target 3001 which has some quirks and does, in my view, not use good fonts for PCB printing. It’s anyway better to not look at the silkscreen layer yet as I have not put much effort into arranging component texts
  • The final board will have 32 inputs and 32 outputs, that is, I will repeat the 74HC595/74HC165 “stage” two more times then

I would really appreciate any feedback!

First I would definitly use SMD-components, SO-ICs are very easy to solder by hand, even TSSOPs are possible if you don’t have two left hands :slight_smile:. So maybe you can get all I/Os onto the same PCB. Also I’d try to bring all components to the top-layer, I think that makes it easier to get the right allignment of your components and prevents soldering-errors.
The Gadgeteer-Sockets are those e.g.: 20021521-00010T4LF Amphenol FCI | Mouser Deutschland
I suppose you are in germany ;), I think Reichelt and/or Völkner does these also have in their shops (I think I ordered some from there some time ago). The SMDs are also easy to solder by hand, but I’m sure you can also get some TH-Sockets.
Is everything based on 5V? If you use 5V supply-voltage and 3.3V logiclevels for SPI, that can cause problems, because the 3.3V may be not enough to be a safe high-level for the IC.
I don’t know what exactly you want to do, but especially for the inputs I would think about another solution, maybe a MCP23017 (I2C) or MCP23S17 (SPI) those are 16-bit I/O-expanders, that even have configurable pullups and interrupts on the inputs, so you wouldn’t have to get the status of your buttons continuosly. The IC would just notify your MCU that there has been a button pressed, it can ask which one and so it’s job instead of reading and writing all the time, maybe it would have something better to do :slight_smile:. Those ICs are also configurable, so you are more flexible, e.g. you could use 8 inputs and 24 outputs with two ICs and with the programmable pullups you could save some resistors (space on your board). Those would be the pros, one of the cons would be, that it isn’t really chainable, but the I2C-versoin has a configurable adress, so you can use 8 of them on the same bus (8x16 would be 128 configurable I/Os). Also a con would be the higher programming-effort.

The answer is a bit longer than I thought :smile:, and answers a bit more than you asked :thinking:

glx, I highly appreciate your long answer! My question was longer than I intended it to be as well.

I’m sure I will climb that ladder, and probably it won’t be too hard, but not at this moment. I need to upgrade my toolchain first and I’m not mentally ready yet.
I will get the 32 ins and outs on one PCB, though. It’l make it longer but I intended it to be like that (and it should fit in under 10cm). I just did this “half” version in order to be faster and get some “early” feedback on my layouting.

It’s good to know they are available. They cost a bit too much for my purposem though. I’m not willing to spend 1.31 CHF (you did guess almost correctly :wink:) per single piece of connector… I have a stock of those tiny breakouts and that’ll do. By the way, do you know of any cables that fit these connectors and are not the original gadgeteer ones?

Oh, you have a very interesting finding here. Let me tell you why I am so keen on using 5V here. I had some brightness issues with some of my leds and I could not find affordable ones that match the 3.3V/330 ohm setting. I looked up the datasheets of the ICs on the MaxO (the '595 ones) and saw that they are 5V capable, so I fed 5V instead of the 3.3V into the MaxO chain and it worked beatifully. Of course, now that I make my own circuit, I could use other resistors than 330 ohm and resolve the brightness issue. But that puts stress on the regulator, especially if you power over 100 leds.

When I look at the datasheets of both ICs now, if I get that right, they state that at 4.5V VCC they have a minimum V_IH of 3.15V… I guess i was pretty lucky it worked with 3.3V CLK/MOSI when powering at 5V.

So I’m a bit torn here… From the microntroller’s point of view these were outputs only, and the MaxO worked. But now I have the MISO line going back, so I need to make sure that this pin is 5V tolerant. Otherwise, do you have a suggestion on how to translate between the voltage levels? Down is a resistive divider, but up? A quick google said BSS138, is that any good? Or should I just slap a transistor/pulldown pair at it?

Those are shiny things, yes, but I really like the simplicity and elegance (add cheapness) of the 165/595. Plus, they really are chainable, and not just using programming and adresses. In my last project I used 3 MaxOs giving a total of 96 leds, and it was not enough so I had to use some breakout pins as well. The leds all need to be controlled individually, so it’s not possible to use less outputs (I could use a logic combination to “compute” some leds from others, but that adds complexity again that I don’t like). If you’d like to know: The leds are the illumination of active routes on a model railway control panel (“Fahrstrassenausleuchtung auf einem Modelleisenbahn-Stellpult”).

Why don’t you just adjust the resistors to match your LEDs to 3.3V? :thinking:
The needed resistor is calculated with the needed voltage-drop and the current flowing through the LED.

If you drive your LEDs with 10mA and a LED-forward-voltage of 1.7V (3.3V of 5V are “removed” by the resistor) you get your 330R-resistors.
3.3V / 0.01A = 330R
So if you use that calculation with only 3.3V, you get 1.6V voltage-difference at 10mA :arrow_right: 160R.
1.6V / 0.01A = 160R
:arrow_right: What leads to the same brightness of your LEDs and you can just drive everything with 3.3V :slight_smile:.
(If you use your 330R-resistors with the 3.3V you get only about 5mA through your LED, what maybe not enough to let it light up nicely)

Or you can use a level-shifter IC (I like e.g. the TI TXB0104 for SPI), but I would say adjusting the resistors is the easier way :wink: (and the cost next to nothing).

The cable-connectors are those: https://www.mouser.de/ProductDetail/Amphenol-FCI/20021444-00010T1LF/?qs=sGAEpiMZZMs%252bGHln7q6pmwodwKqstCemCvTFo6oTTpk%3D
Cables can be e.g. these: https://www.voelkner.de/products/223217/Flachbandkabel-10polig.html

I hope direct-links are allowed :thinking:

Yes, sure, I could do that. But then since I want to extend the output chain using regular MaxOs I’d either have to switch the MaxO to 5V as I did last time or I’d need to replace the built-on 330ohm resistors, which is cumbersome. Besides, if I drive 1A (100 leds * 0.01A) from the 3.3V line this will exceed the limits of the LDO on the mainboard.

For now I think I’ll stay on the 5V rail and deal with the translation. I’ll probably order the board ignoring voltage issues and see if the ordered 165/595 behave the same way as the ones present on the MaxO, i.e. work with the lower digital input levels…

…and if not, I can still insert a small translation board between mainboard and the chain. I think, given the way I will use SPI (separate MOSI and MISO), it should suffice to do unidirectional voltage translation?

Again, wow, at $2.64 per piece they are expensive. I think staying on the gadgeteer cabling standard costs more now than it is worth.

But, erm, I also asked about layouting/traces and such, and the ground plane. Do you or does anyone else have any comments on that specifically?