The original layout sucks and I just started over again. Now it looks slightly better... #electronics
Top-level
The original layout sucks and I just started over again. Now it looks slightly better... #electronics 24 comments
High-voltage section is fully routed. Traces are ugly since it's just a trial to verify component placement, to be redone later. I should be able to complete it by tomorrow. #electronics PCB design of my high-voltage surge tester is almost finished. #electronics Now the problem is whether I can drive this 128x160 screen from a microcontroller with only 7 KiB of ROM. It's possibly more than enough if you use some extreme space-saving techniques. But the point of this prototype is testing the analog electronics. It's NOT the time to be nerd-sniped into a pointless programming exercise. Perhaps it's a good idea to add a large EEPROM chip here, at least as a temporary solution during prototyping. #electronics The circuit board still needs more routing, but at the schematic level, this whole design is now completed. P.S: For a finished project, always remember to fill the title block section of the schematic with some words to make it look nicer, otherwise it's just an empty box... I always use a copyright notice if I don't have something else to show. #electronics Once again scrapped the finished circuit board layout and started over... The original component placement simply couldn't meet the high voltage electrical spacing requirements. Technically, there is no regulation on electrical spacing for non-safety, purely functional insulation. But I'd still like to leave a bit of margin here. #electronics My third circuit board layout attempt is almost finished. A component rearrangement solved the high voltage electrical spacing problem, it also made the circuit layout flow much better (instead of squeezing everything into whatever space that happened to be there). #electronics Number of unrouted connections: 0. Still needs some tuning, including electrical spacing and looking for a suitable banana connector. But it's basically done. #electronics Circuit board arrived. I found my PIC programmer is 5 V only and cannot be used on this 3.3 V chip, then I found a great project called Pickle which can do serial port bitbanging for a makeshift programmer. Just turned my LEDs on, ready to start firmware development... #electronics Wasted an hour trying to set up a timer on the PIC microcontroller. The frequency was always wrong by an order of magnitude, I kept fiddling with the clock generators, PLLs, prescalers, and fuses. Only an hour later I found the real problem... I simply forgot that a 8-bit timer has 256 counts, not 1 count. :blobcatwoozy: Just finished the high-voltage controller firmware in 500 lines of C. It's mostly just housekeeping tasks. The actual interesting part of the circuit board is the analog circuitry under control, which I finally can start testing tomorrow... The low-voltage controller also needs a firmware, but for now I can simulate that using a stub program on the computer... #electronics I just figured out the failure mode of the malfunctioned flyback chip. The flyback controller turns the transistor on, wait for inductor current to ramp up, and turns off the transistor only after the peak current comparator trips. If the power supply drops out after an overload, the original peak current target is never reached, now the transistor is permanently on! It's not that the gate drive malfunctioned and stuck high, it's actually working exactly as designed. #electronics I wonder if my fatal analog design problem can be "fixed in software" and suddenly had an idea... Instead of turning the flyback converter on continuously, I changed the firmware to run it in small 1-millisecond bursts per every 10 ms, allowing the 10 V isolated power supply to recover and recharge between pulses. Unbelievable, this hack worked! It successfully charged the capacitor bank to 1000 V... ⚡ #electronics Voltage regulation at 500 V is even better than my expectation. 2% within theoretical 536 V set point. #electronics Setting up the fail-safe crowbar and watchdog timer early on before debugging other parts of the high-voltage circuit turned out to be really worthwhile. Now I love how I can physically discharge the dangerous capacitor by just pressing Control-C in my Unix terminal emulator. #electronics Trap for young players... If you're disabling another interrupt within an interrupt, that disabled interrupt source may have already set its flag just before you've disabled it, causing a TACTOU situation. When the ISR returns, that supposedly-disabled IRQ is immediately invoked. I just spent an hour trying to debug a strange problem because of this race condition... :woozy_baa: #electronics Success. High-voltage supply and regulation are now fully functional. My fatally flawed analog power supply problem has been fixed in software. The burst-ON hack turned out to not "just a software hack" but kind of an optimal solution given the circuit components constraints. If I need a real hardware solution I'd just implement exactly the same control with RC timers and AND gates instead of an interrupt service routine. #electronics More progress on the high-voltage impulse generator. The huge capacitors, resistors and inductors for pulse shaping are now installed for testing. They mostly work. But this test uncovered a serious problem - each time the circuit fires, I can hear an arcing noise, the oscilloscope also shows a weird glitch, likely caused by arcing. The generator is supposed to destroy the device-under-test, not itself! Now my suspect is the isolated DC-DC module. Just ordered a better one for another try... #electronics Problem solved. The "arcing" sound during the impulse current discharge is NOT a fault. It's actually a common phenomenon in all high-current pulse circuits. The "snap" noise was caused by sudden physical deformations of the circuit board itself, due to Lorentz force from the intense current. #electronics Success! My first circuit board prototype of the IEC 61000-4-5 Combination Wave Generator (aka Lightning Surge Generator, aka Impulse Generator) is working after a month of development. This PCB has greatly improved safety and usability compared to the original perfboard. #electronics |
#TIL I just realized SMD parts still have their merits even in high-voltage power electronics circuits. Components and traces on the same PCB layer (top/bottom surface) have strict electrical spacing rules because of dust contamination and surface tracking. But circuits on the opposite sides of the board only need to obey the "distance through solid insulation" rules, and it's just 0.4 mm. Through-hole parts always have vias at both sides, but surface-mount parts only have copper at one side. One can use this regulatory fact to significantly shrink the size of the circuit. #electronics
#TIL I just realized SMD parts still have their merits even in high-voltage power electronics circuits. Components and traces on the same PCB layer (top/bottom surface) have strict electrical spacing rules because of dust contamination and surface tracking. But circuits on the opposite sides of the board only need to obey the "distance through solid insulation" rules, and it's just 0.4 mm. Through-hole parts always have vias at both sides, but surface-mount parts only have copper at one side. One...