Pelco KBD300A to Kerbal space program controller (part 2, hardware design)

Now that we’ve seen what we need to talk to, let’s get on to the business of actually doing that. 

The schematic is largely a combination of other chunks I have used and validated elsewhere all stuck together so let’s see what each of them do. 

This one’s actually new. I haven’t designed anything with a usb-c port before, but I like this one for hand-soldering. I got it from a fork of the IBM Model H project that I still have yet to get working, but the port is sourced from LCSC and I chose to use it on this project. 

Behind that usb port is a CH340E usb to serial converter. I don’t know why I have these things other than they’re tiny and cheap. I’d say they are just OK for this project because they lack the specific serial flow control lines that let me program this thing over USB automatically. I broke out the control lines that do exist to headers and added serial LEDs and a voltage jumper in case you want to use this part of the board without populating the 3.3v only microcontroller. 

The power section is super simple and stolen from the power section of most of my esp8266/esp23 boards. I like this LDO and package so much I’ve started stocking those parts despite still salvaging whatever bigger ones come off scrap parts. The capacitor values were a ‘shoot from the hip’ thing years ago and they have been sufficient so far, the resistor for the LED is a good, safe starting point but can be tuned based on the LED type and desired brightness used. 

This section I added because the microcontroller I based this on is wireless. I have 5v input, 5v output, and a cut-able jumper so I can separate those and insert a lithium battery charge circuit and boost converter so this project can be battery powered and wireless. I could have added those components to this board, but I like this as a modular solution so I could even choose to use alkaline batteries without charging them if I want to. 

All that content boils down to this small corner of the board. I used solder jumpers with pins already connected in the copper layer so I don’t have to bridge anything for my initial use case, but for future changes they’re labeled and easy. I could have used SMD capacitors for the smoothing caps on either side of the LDO, but I have so many surplus electrolytics that I decided to use those up. The rectangular outline is the placement that the original RJ45 jack took up and helps me line up where the opening in the back of the case is. The LEDs are all visible through this hole even though they are a little obscured. I made sure to use distinctive colors for each to make it unambiguous. You can see I stitched a lot of ground plane around my signals, this board is so big I was concerned about interference caused by large unconnected ground planes and using mostly surface mount components I don’t get any of that for free. You’ll also notice I cut off some ground planes to avoid any issues with EMC. I picked this up at Nidec and it sort of stuck even though this design never needs to be certified. 

Here is what I got. Sometimes it’s hard to visualize what the final board will look like with all the layers turned on. The quality is great. So far I only go down to TSSOP sized chips to solder by hand and this really shows the size difference between that and 0.1″ dip spacing. All the traces are well formed, the vias are all covered with soldermask. The one thing I would call an error on my part is that little whisp of ground above the Rx LED. On the render it shows a connection, but just barley, less than the width of a trace and that narrows around the thermal relief of the usb connector. In the future I’ll start cutting off any copper pours that are so miniscule. This picture also clearly shows that if you can solder TSSOP then you can solder usb-c connectors. Judging from this I could also have tightened the radius of that trace under the connector without any concern, one of these days I’ll have to start caring about trace length but I guess that’s not today. 

The next section I have is this i2c isolation chip. I’m using it as a level converter, even though it is also useful as a protection chip. Looking back at this now I would like to have used one between this board and any external facing i2c ports (which I did not do) but I’m not overly concerned about shorts or high voltage damaging anything. 

This is and remains my go-to i2c off-board connector. It’s compatible with sparkfun, adafruit, and I have breakouts to make anything else compatible with it. 

This is the 3.3v section of i2c on the inside of the module. I have 3 external connectors for off-board sensors or indicators and one internal. I can always add a splitter, but this hopefully gives me enough that I don’t have to. 

These are super simple, just the reset and programming buttons that are required if we need to program the device over USB. 

If you have a dedicated programmer, this is the standard socket used to program the esp32 without going over USB. 

Here’s the remaining pull down resistor and the esp32. I used the esp32 without a built in antenna because this is a metal box and I need a rubber duck antenna on a pigtail to make wireless work at all. 

All that content is right in the middle of the board here. This is pretty close to the minimal configuration I use for esp32 board designs (if I don’t intend to program over USB I’ll omit the buttons). 

You can see the distinct size difference in the pitch between the CH340E and the esp32 pins. The castellated pins of the esp32 or esp8266 are really not bad to hand solder even if you’ve only done through hole before. Here you can also see that what looks quite busy next to the program button is pretty barren when you see the final product. I could have moved the silkscreen value of that capacitor to the right side and scooted it much closer. I have my traces/vias for the i2c lines labeled but when I was making this board I didn’t realize I was going to order it with the vias covered in soldermask. I envisioned those as sort of test points but at least if I rip that connector off the board I know which signals go where when I scrape some of the soldermask off to repair it. 

You can also see the different size traces I used for data earlier in my design. The two thicker traces going up and to the left from the esp32 transition into thinner traces as they traverse the board. Note the slightly different size of footprint for the 0603 resistors than the 0603 capacitors. I assume that’s because capacitors tend to be taller and there’s different dimensions to assist with reflowing, but for my purposes it’s a curiosity. 

This is the little bit extra that I usually add even though I haven’t used it more than to prove it works. The JTAG header is useful for in-circuit debugging and setting breakpoints in the code. This is a huge upgrade over debugging using LEDs or serial print statements, but it does take a bunch of pins which caused problems with this design if populated. 

I only added the silkscreen after some debugging about what the resistors were doing to the data lines. You’d think 10k is not very much, but I believe it made a sort of voltage divider with pull ups in this design and caused all sorts of havoc. It’s still on the board if you intend to use this board in another use case, but it’s not appropriate to use it on this particular implementation. 

This is my 4 channel analog input chip, I broke out the address jumpers in case it would conflict with a less configurable i2c device on the bus (looking at you NAU7802). I decided to run this at 5v, I didn’t have to since I control the rails the potentiometers are connected to. Higher voltage gives me more noise immunity for the analog section, so I went with as high a logic voltage as there is on this board. 

This is the pinout for the factory connector for the joystick, which I kept. I would have switched the connector on the board and on the cable, but since it was there I kept it. That just means future uses of this board have to use a pigtail or this pitch connector. I also broke out the 4th analog pin to another header so it could be used with ease. 

I have one 5v qwiic connector inside the enclosure for future development. All the peripherals on the front panel run at 5v, so perhaps I’d encounter another device that wants 5v and soldering to these tiny parts does not sound like fun so I have a connector for that. 

Here’s that implementation. I try my best to not make traces weave around too much, and I’m designing for hand assembly so stuff doesn’t have to line up on a nice grid, but keeping the analog signals short here was a priority. There’s more ground islands that are staked down that don’t exactly have to be but it makes me feel better and the boards cost the same. I’ve also taken to using a technique I see people who design for automated assembly avoid: vias inside pads. For me it makes no difference except to make the design smaller and cleaner, but if you’re dispensing solder paste I hear it can suck up more into the via causing bad joints. Lucky for me I just add solder until I see a nicely shaped joint. 

The traces in this area are even finer than most of the board because they need to fit through 6063 resistors. I tried to keep all the traces short as well as all the power traces large. This is the best place to look at my vias inside pads, it really cleans up the design and allows for more unbroken ground planes. I’m glad I can get them done here though and they always work out just fine. 

Here’s the keypad matrix connector. I just ran all the pins straight back to the esp32, but there’s an issue. Several of these pins are shared with the JTAG header so those pull down resistors were messing with the scanning of the matrix so I had to remove them once I identified the offending pins. 

I labeled both the pins on the esp32 and the function of the pin on this project so I could debug it more easily. This matches the paper documentation I wrote earlier. 

This is the i2c IO expander (PWM LED driver) I used to drive the 7-segment LEDs. I also used two of the outputs for a couple of the indicator LEDs but I was still short one pin so that one is controlled individually with a low side drive N-FET. The majority of this circuit is the address for the chip so you can string 2^6 of them on one bus and still control them all with a broadcast address if needed. This one also runs at 5v so the top board doesn’t have to be modified. Since the esp32 is supposedly 5v tolerant I don’t think I had to use the 2n7002 to switch the LED, but I wanted to be safe so it’s there. 

Here you can see this corner of the board. I laid out the pins for the LED driver according to what was easiest to route, but it basically makes sense in code too. You can see the thick trace to the right going up to a power bus, that’s the 5v I missed for powering the LEDs. The boards I have fix this with a jumper. In retrospect I could have labeled all the LED segments and IO driver locations on the header, but it didn’t seem important at the time. 

I like labeling everything with its function, but sometimes I have trouble realizing what’s going on if the design is too busy. Keeping the silkscreen in line with the component is an absolute must (this has caused problems before) but I think I’ll go smaller with the text next time. Ordering stuff at PCBWay works out perfectly fine at this resolution but I think I can go smaller and still make it readable. Not that this board design has any problems with me writing “GPIO pin 25” there to clarify, but other boards do have problems with space and being able to shrink the font may help a bunch. More of those vias in pads here and honestly I could have cut off all those ground slivers into the traces there. You can see I haven’t completely bought into this technique with the 2n7002 over there but I’m sure it’d work fine. Everything came nice and crisp and the board fit the existing enclosure perfectly. That wouldn’t have been an issue with a different design where I’m 3d printing the case, but I really needed it with this one. 

This is the latest version of the board as a whole, I added a couple little traces and some silk for clarification but it’s basically the board I have assembled. The holes are for potentially adding things inside (I sized them for zip ties). Should you want to add batteries that’s how I suggest you secure them. 

Here it is all assembled. The jumper wire I described a couple of times is on the other side of the board and my latest design also involves some silkscreen changes but I think this turned out great. Up next will be the building and testing of the actual hardware functions and by then I think I’ll have a pcbway project set up so you can order this board populated or not. 

5 Responses to “Pelco KBD300A to Kerbal space program controller (part 2, hardware design)”

  1. Pelco KBD300A to Kerbal space program controller (part 1, reverse engineering) | Evan's Techie-Blog Says:

    […] up so expect it to come in 4 parts. This one is the reverse engineering, the next will be the hardware design, then software and troubleshooting for interacting with all the board segments, then the software […]

  2. Pelco KBD300A to Kerbal space program controller (part 3, code to exercise the hardware) | Evan's Techie-Blog Says:

    […] Hacks, repairs, arcade games, sci-fi, and some very bad ideas with possibly humorous consequences « Pelco KBD300A to Kerbal space program controller (part 2, hardware design) […]

  3. Pelco KBD300A to Kerbal space program controller (part 4, interface to KSP) | Evan's Techie-Blog Says:

    […] that I have the hardware and software to interface the controller with its controls, how do we get it to talk to Kerbal Space […]

  4. esp32 button/LED board (esphome) | Evan's Techie-Blog Says:

    […] esp32, the programming and JTAG headers, the 3.3v power supply… All that is identical to my most recent esp32 project, so you can see my descriptions there. This does predate my usage of USB-C and qwiic […]

  5. esp32 alarm panel board (esphome) | Evan's Techie-Blog Says:

    […] esp32 uses the standard circuit I copy and paste everywhere, I have a write up on the kerbal space program controller. I left a cutout for the esp32 module with built in antenna, but since this one is going in a […]

Leave a comment