So, I tried to automate as many of these small tasks as possible in the simplest design I could think of - a USB cable tester PCB.
Please share your thoughts, ideas, criticism - I'm looking forward to hearing any feedback from the HN community!
So, I tried to automate as many of these small tasks as possible in the simplest design I could think of - a USB cable tester PCB.
Please share your thoughts, ideas, criticism - I'm looking forward to hearing any feedback from the HN community!
Real world board designs usually have critical placement, mechanical, EMI, test, assembly, anti-RE, supply-chain or other business-level constraints.
Without evolving the fundamental requirements definition to a language that holistically allows the parametric expression of these factors, generated designs are unlikely to meet real world needs in most real world (non-trivial) use cases.
In most cases the "fiddly things humans" do appear more in more complex design. Keyboards and LEDs matricses like this are kinda edge case, in most if you have that many parts you have to be careful, especially if it is mixed analog/digital design.
The tricky part of PCB design is getting the right data: pre-made footprints are wrong more often than not, and automatically retrieving things like a LED's forward voltage or current are just a pipe dream.
Doing the actual calculation takes you all of 10 seconds, and you only have to do it a few times for basically any board. Writing the shown code would probably take me longer.
To address a few points and how software-defined electronics actually does make sense for it:
> critical placement You can use a `place` command to exactly place things wherever you want.
> mechanical Use board outline functions, `place` commands, arbitrary shapes, 3D component shapes, etc. to meet these needs. You can export a STP and send to your mech team for validation.
> supply-chain Parametric search query function allow designers to specify only as much information as they need about a component (e.g. 0402 10k, but not MPN) and the system can pick the best component at compile time that is in stock with necessary quantity available.
Or if it is connected to some live signal the signal itself might be with different voltage range
Some cables just connect the bare minimum for USB connectivity - +5V/GND. I've seen that one on vape charger cables. Others go a bit further and add the USB 2.0 D+/D-.
Further, all LEDs have different responses to current (as LEDs are non-linear components and thus ohm's law doesn't apply) and thus usually require different current limiting resistors to achieve similar brightness or in some cases color.
Also, switching LEDs on an off will affect the cathode net and anything connected to it, so it'd also affect the other LEDs in parallel depending on which are on and off at any given point.
Code for the LEDs is here: https://github.com/JITx-Inc/jitx-cookbook/blob/main/usb_c_ca...
And yeah, cables are that bad. Can't tell you how much time is lost to figuring out why your device won't enumerate on USB and then finding the cable was the culprit.
Pick a switch footprint and add diode footprint to it, save as new footprint.
Keyboards are rarely fully grid-like, so you have to take into account that there is a row/column shift. Modern keyboards have features like per-key RGB and hotswap sockets, which eat up a lot of valuable space. And then you also have to fit half a dozen traces in between two switches for the key matrix connectivity.
An approach like that might work for a trivial macropad, but it quickly falls apart on a full-size keyboard.
It takes an evening or two to manually route a big battleship board, when you're not worried about RGB or having to do clever stuff with USB.
> And then you also have to fit half a dozen traces in between two switches for the key matrix connectivity.
...I guess you never designed a PCB? there is loads of space on keyboard sized design.
can the script bundle the LEDs together to make it easier to visually grok the results? e.g. this bundle of LEDs lit up means it's a usb3 compliant cable, this bundle lit up means the cc resistors are proper, etc
the brightness may be a good thing, if you add a faceplate to diffuse the LEDs (and add proper labels/branding). I've been meaning to find a good application for a PCB faceplate... https://hackaday.com/2022/08/17/circuit-less-pcb-featured-as...
First pass would be to bundle the LEDs based on their type - just change the ordering from an ordering based on physical position to an ordering based on the logical meaning of each connection.
In the second pass, you could have a separate LED bank with LEDs marked USB3, USB2, etc. Hook those up to a couple of logic gates so that the LED turns on when it detects the USB3, USB2, etc. configuration.