6 ms·
When I started designing PCBs a few years ago (after some years of electronics prototyping and software engineering) I was somewhat shocked by the manual, repet
by caydenpiercehax 3y ago
When I started designing PCBs a few years ago (after some years of electronics prototyping and software engineering) I was somewhat shocked by the manual, repetitive tasks I kept doing.
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!
- hakfoo 3y agoI wanted to do a custom keyboard, at one point I tried to write some PHP code to parse a JSON definition of the layout, and generate a disposable Python script to feed into the KiCAD console to position the switches and diodes to order. (Mostly because I far comfier with PHP tooling) It sort of fell apart because I couldn't quite get the diodes to lay out where I wanted them.
- ilyt 3y agoThere is extremely lazy way to do it. Pick a switch footprint and add diode footprint to it, save as new footprint.
- crote 3y agoThe problem is that this often isn't physically possible. 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.
- LeifCarrotson 3y agoKeyswitches are like 20x20mm...there's an abundance of room for a little ~2x1mm diode within the footprint.
- hakfoo 3y agoIt's a bit harder if you go through-hole. When you can't fit it "under" the switch footprint, it becomes harder to auto-route it-- there might not be a space specifically where you want-- maybe you want to move some diodes around to shave a couple millimetres off the PCB footprint to save a nickel, or maybe you need to rotate a switch (for example, the + and enter on the numeric pad) and end up with the 'standard' position fouling some other part of the layout. 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.
- ilyt 3y agoRight. We're talking about someone making a one off that's simple enough to mostly auto place with a script. > 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.
- DHaldane 3y agoThe interesting thing about scripting layout is how quickly you need an autorouter. There's usually plenty of room, but if things aren't laid out extremely regularly with no variation, it rare to be able to just write out the correct component positions and copper shapes.
- contingencies 3y agoA very simple thus unconvincing demonstration. 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.
- mschuster91 3y agoYeah, but it's a good starting point for an MVP that reduces a lot of the tedious bullshit (like calculating LED resistor values). You can always re-route paths and replace components when you're going from MVP to product based on your constraints.
- ilyt 3y agoRight, if it was a part of an existing design tools, but this appears to be entirely separate thing ? 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.
- crote 3y agoI am not convinced that it is actually faster, though. 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.
- caydenpiercehax 3y agoThanks for the feedback. There's definitely a lot more that goes into a serious design. I purposefully chose a simpler design to experiment with automating the easy but repetitive stuff. 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.
- spuz 3y agoNice project. I'm interested in the cable tester itself. Why does each line require a different resistor? Also, in the gif at the top of the page, it looks like some of your cables only light up 5 LEDs. Are some cables out there really that bad?
- Evidlo 3y agoIf LEDs share a resistor then they dim as more LEDs are turned on.
- spuz 3y agoI meant to say why does each LED require a different resistor value?
- dfox 3y agoBecause different colors usually mean different semiconductor material and thus different forward voltage of the junction which in practical terms leads to different brightness if the same resistor value is used.
- ilyt 3y agoDifferent color have different forward voltage and luminosity per mA. Or if it is connected to some live signal the signal itself might be with different voltage range
- mschuster91 3y ago> Are some cables out there really that bad? 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-.
- junon 3y agoIf an LED fries out, then the current will change across the other ones. If they're all going through a single current limiting resistor, then the current across the other LEDs will change, potentially frying them all out due to overcurrent scenarios. This is the case for many different areas of PCB design. 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.
- ta988 3y agoYour website on my phone cuts the text on the left with Firefox. Even zooming in/out doesn't allow me to see it, only desktop mode.
- RobotToaster 3y agoShame it's using a proprietary SaaS. An electronics version of openSCAD sounded interesting.
- jareklupinski 3y agothis is something I could use with my box of cables, I like the idea of the battery onboard and just leakage current when off 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-faceplate-for-a-digital-clock/ https://hackaday.com/2022/08/17/circuit-less-pcb-featured-as...
- DHaldane 3y agoThat's a cool idea. Can confirm that this brightness is good if you need to check cable quality in full outdoor sun.
- caydenpiercehax 3y agoGreat idea. Yeah, that could be done. 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.