Email or username:

Password:

Forgot your password?
Top-level
niconiconi

Bang-bang voltage regulation for the 1000 V power supply is working. The set point and hysteresis just need a little adjustment... #electronics

Oscilloscope traces of the comparator output and the high voltage output. When the output voltage goes down due to leakage current, the comparator enables high-voltage switching, and when the voltage goes up, switching is disabled. This creates a regulated output with a sawtooth wave, moving from 906 V to 944 V, over the duration of 1000 milliseconds.
37 comments
niconiconi

Impulse generator has been upgraded, now it can switch 1000 volts. I also noticed that the measured ratio between capacitor and output peak voltage is within 0.05% of the theoretical calculation by coincidence... ​:blobcatsurprised:​ The math says 108.2%, I measured 108.256%, unbelievable. #electronics

niconiconi

Success. My 1.2/50-8/20 μs impulse generator breadboard prototype now can generate 1000 V surges, and its waveform conforms to IEC 61000-4-5. For better project reproducibility, I also replaced the solenoid with air-core toroid inductors using "Material #0" plastic cores. This design is ready for a real circuit board. #electronics

Open-Circuit Voltage:
- 1.02 kV, Front time: 1.42 μs, Duration: 58.90 μs
Short-Circuit Current:
- 496 A, Front time: 7.93 μs, Duration: 22.27 μs

A homebrew perfboard with four huge HV capacitors, some large HV power resistors, a few air-core toroid inductor coils (wrapped on plastic cores), and a thyristor at the center (in Super-247 package). At the left, there's a big red button, galvanic isolated from the HV power domain, for triggering the surge. At the leftmost side is a HV power supply circuit board prototype.
A comparison of my oscilloscope traces and the standard 8/20 μs impulse voltage waveform in IEC 61000-4-5.
A comparison of my oscilloscope traces and the standard 8/20 μs impulse current waveform in IEC 61000-4-5.
niconiconi

Destructive surge testing of a 47 Ω through-hole resistor, using the new impulse current generator I've just built. Dielectric breakdown and arc flash occurred at 954 volts. The instantaneous power into the resistor was 19364 watts, or nearly 20 kW. ⚡💥 #electronics

Two photographs of the arc flash of the resistor, on the camera shows a bright flash, the second photo also shows a piece of flashing debris ejected from the resistor and falling to the circuit board.
A photograph of the test setup before arcing. It shows a test PCB fixture and an oscilloscope probe connected across the resistor for measurement.
Oscilloscope trace of the voltage waveform. The impulse voltage reaches 954 V after 1.3 microseconds. At approximately 11.25 microseconds, the waveform shows a steep decline of the waveform due to dielectric breakdown and arcing.
niconiconi

Time to transfer the impulse generator prototype to a real circuit board. It's really a deceptively simple circuit. Just a capacitor, a switch, an inductor and two resistors. But practical implementation problems are many... #electronics

A circuit schematic of the impulse generator. A high-voltage power supply charges a capacitor bank, a thyristor switch discharges the output to a resistor-capacitor pulse shaping network. A isolated gate driver provides the necessary floating gate drive to the thyristor to make it a high-switch switch. The gate driver is activated by a pushbutton.
niconiconi

I really don't want to use a microcontroller in this high-voltage power supply. Pure analog control is entirely sufficient without the complexity of software or computers. Unfortunately, to meet 1.5 kV reinforced insulation safety requirement, it needs some very unusual and expensive optoisolators. To minimize the use of isolators, the most reasonable option is sending commands via a one-wire serial port with microcontrollers. #electronics

niconiconi

Proposed block diagram of the revised high-voltage impulse generator. Now with 1500 V reinforced insulation to ensure the high voltage impulse will never be backfired to the operator. #electronics

Circuit block diagram. The "fire" pushbutton signal goes into the "LV control" module with galvanic isolation, the output is a digital serial control signal, which is then transmitted into the "HV control" module. Simultaneously, the power from the low-voltage side also goes into an isolated DC/DC module, and is supplied to the HV PSU module. The HV PSU also accepts two additional control signals from the "HV control" module: VMON (voltage monitor) and CHRG (charging enable). Finally, the "HV control" module can turn the thyristor on (via an additional "gate driver" module) and deliver the high voltage impulse to the output.
niconiconi replied to niconiconi

A little bit of progress on the IEC 61000-4-5 high-voltage surge generator. Now with a safety crowbar feature to short the capacitor bank to ground immediately. The special high-voltage FET is a default-on JFET, so the capacitors can be discharged even when all power and control signals are lost. #electronics

Circuit block diagram. The "fire" pushbutton signal goes into the "LV control" module with galvanic isolation, the output is a digital serial control signal, which is then transmitted into the "HV control" module. Simultaneously, the power from the low-voltage side also goes into an isolated DC/DC module, and is supplied to the HV PSU module. The HV PSU also accepts two additional control signals from the "HV control" module: VMON (voltage monitor) and CHRG (charging enable). Finally, the "HV control" module can turn the thyristor on (via an additional "gate driver" module) and deliver the high voltage impulse to the output. The new feature is the HV control has additional SAFE_G and SAFE_S output, which is used to turn on a JFET and quickly discharge the capacitor bank for safety.
niconiconi replied to niconiconi

More progress on the IEC 61000-4-5 high-voltage surge generator. Finished designing the high voltage control subcircuit. This PIC microcontroller is quite featureful, it has a built-in analog comparator with raw hardware output, keeping the high-voltage supply under control without relying on software. Reference voltage is software programmable via a DAC. An additional Cuk DC/DC converter chip generates the negative bias voltage for the fail-safe, normally-on FET crowbar. The MCU can enable or disable it by toggling the ENABLE pin of the DC/DC chip. #electronics

More progress on the IEC 61000-4-5 high-voltage surge generator. Finished designing the high voltage control subcircuit. This PIC microcontroller is quite featureful, it has a built-in analog comparator with raw hardware output, keeping the high-voltage supply under control without relying on software. Reference voltage is software programmable via a DAC. An additional Cuk DC/DC converter chip generates the negative bias voltage for the fail-safe, normally-on FET crowbar. The MCU can enable or disable...

Schematic of the high-voltage control subcircuit. A PIC microcontroller can regulate the output voltage by sensing VMON and feeding it into an internal analog computer to generate the CHRG signal for bang-bang control. In addition, it also has a Cuk converter to generate the crowbar FET bias voltage, which can be turned on and off via the microcontroller. Finally the microcontroller also generates the fire signal to start the impulse.
niconiconi replied to niconiconi

Completed the first draft of circuit schematics (many obvious mistakes, including wrong power supply labels, but it's just a draft). Now moving to the next stage with more difficulties: circuit board design. Nearly every single component needs a custom PCB footprint. #electronics

Schematics for the top-level diagram, low-voltage control subcircuit, and high-voltage control subcircuit.
Schematics for the isolated power supply subcircuit, high-voltage power supply subcircuit, and isolated gate driver subcircuit.
niconiconi replied to niconiconi

Output stage layout of the high-voltage surge tester. The capacitors, inductors, resistors are all huge... The capacitors in particular are already underrated (otherwise the cost and size would be truly prohibitively), still, the size is huge. They're metalized polypropylene (MKP) caps, this is the standard technology for pulsed power, but these particular models are designed for filtering, not pulses. I expect a rather short service life. If I can get 10,000 firings, it would be already extremely impressive. #electronics

Output stage layout of the high-voltage surge tester. The capacitors, inductors, resistors are all huge... The capacitors in particular are already underrated (otherwise the cost and size would be truly prohibitively), still, the size is huge. They're metalized polypropylene (MKP) caps, this is the standard technology for pulsed power, but these particular models are designed for filtering, not pulses. I expect a rather short service life. If I can get 10,000 firings, it would be already extremely impressive.

An unfinished circuit board layout with huge resistors, capacitors and inductors, size 155 mm x 90 mm.
niconiconi replied to niconiconi

More PCB layout progress... The sheer size differences between the huge capacitors & inductors and the tiny DC-DC converters, gate driviers and microcontrollers is giving me a bit of cognitive dissonance... #electronics

A large circuit board with huge capacitors, resistors and inductors, but now also with huge transformers, TO-264 transistors, and tiny SMD chips and microcontrollers.
niconiconi replied to niconiconi

There must be a 24 mm creepage distance between the LV and HV side, leaving a large gap. I'll just spam some high voltage warnings here as placeholders... #electronics

work-in-progress PCB layout, component placement on the high voltage is roughly complete. At the gap between the low and high voltage side, the high voltage symbols and warnings are repeated many times in a row to fill the gap.
niconiconi replied to niconiconi

The original layout sucks and I just started over again. Now it looks slightly better... #electronics

3D view of rearranged circuit board components.
niconiconi replied to niconiconi

#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...

niconiconi replied to niconiconi

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 layout in 2D CAD view.
niconiconi replied to niconiconi

PCB design of my high-voltage surge tester is almost finished. #electronics

3D view of the PCB layout.
niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

Only 20 connections to go, the end is near... #electronics

3D view of a circuit board layout.
niconiconi replied to niconiconi

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

Title block section of the schematic:

License: CC-0, "No Rights Reserved"
To the extent possible under law,
the designer has waived all copyright and related or neighboring rights
https://creativecommons.org/publicdomain/zero/1.0
Copyright (C) 2022 niconiconi

Sheet: /
File: cwg1000.sch
Title: Main Schematic - CW01000 Combination Wave Generator
Size: A4 / Date: 2022-10-11 / Rev: 0.00
KiCad E.D.A kicad 5.1.12-1.fc33
id: 1/6
Six pages of schematics in tiny preview size.
niconiconi replied to niconiconi

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

3D view of the work-in-progress circuit board layout.
niconiconi replied to niconiconi

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

3D view of a circuit board.
niconiconi replied to niconiconi

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

3D view of a finished circuit board layout.
niconiconi replied to niconiconi

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

Photo of a large and empty circuit board, with lots of jumper wires and probes, and with four LEDs turned on.
Oscilloscope trace of the LED driving waveform, it's a 3.3 V toggling at 20 kHz.
Low Voltage Programming with VPP at 3V3

Separate data I/O connections (only supported option)

BAITE Cp2102 module               PICMicro
===================               ========

3V3 to VDD

GND to VSS

TX (RXD) to VPP

RTS to PGC

DTR via 1000R resistor to PGD and back to CTS.
niconiconi replied to niconiconi

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:​

"I'll just warn you now. I don't know how to use a computer."
niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

Now the firmware is finished, it's time to test the analog electronics. The circuit board is starting to look nice after the high-voltage supply and all surrounding analog components are soldered. Unfortunately I immediately found the entire board must be scrapped and revised (it's v0.00 for a reason...). The old prototype used a charge pump voltage doubler to bias the gate drive, which was deleted in the new design, and it was a fatal mistake.

The new high voltage's power supply is derived from an 1:2 isolation transformer and it already doubles the voltage, which was why I deleted the charge pump doubler. But it's an unregulated supply implemented by a quick and dirty push-pull driver chip. When the high-voltage is turned on, the voltage drops back to 5 V, causes the flyback chip to malfunction and stops switching. Worse, its gate drive actually get stuck on, turning the MOSFET into a permanent short circuit / dummy load. The fail-safe logic I programmed into the firmware saved everything from burning up by switching the power off after a timeout.
#electronics

Now the firmware is finished, it's time to test the analog electronics. The circuit board is starting to look nice after the high-voltage supply and all surrounding analog components are soldered. Unfortunately I immediately found the entire board must be scrapped and revised (it's v0.00 for a reason...). The old prototype used a charge pump voltage doubler to bias the gate drive, which was deleted in the new design, and it was a fatal mistake.

The new high voltage's power supply is derived from...

A large circuit board with many parts soldered on, including large transformers and capacitor banks.
Oscilloscope screenshot of the faulty waveform, it shows that, as the isolated supply voltage drops from 10 V to 5 V within 1750 microseconds, the flyback chip's gate drive stops switching and stuck on.
/*
 * High-voltage and short-circuit timer interrupt handler.
 *
 * It's used to start the short-circuit timer when the target voltage
 * is unreached, stop the timer when the target is reached, and turn
 * off the high-voltage supply when the short-circuit timer expires.
 */
static void high_voltage_isr(void)
{
        if (C1IF && C1OUT) {
                /*
                 * Rising edge. Target voltage is unreached, comparator
                 * has started high-voltage charging. Start a 10-second
                 * short-circuit protecion timer.
                 */
                TMR1H = ((65535U - 38750U + 1U) & 0xFF00U) >> 8;
                TMR1L =  (65535U - 38750U + 1U) & 0x00FFU;
                TMR1ON = 1;
                C1IF = 0;
        }
        else if (C1IF && !C1OUT) {
                /*
                 * Falling edge. Target voltage is reached, comparator
                 * has stopped high-voltage charging. Stop timer.
                 */
                TMR1ON = 0;
                C1IF = 0;

                /*
                 * The ARMED light is already on, the READY light is on
                 * when the target voltage is first reached.
                 */
                LED_READY = LED_ON;
        }
        else if (TMR1IF) {
                /*
                 * High voltage has been ON for 10 seconds yet the target
                 * voltage is still unreached. Must be a short-circuit
                 * failure!
                 */
                TMR1IF = 0;
                fault();
        }
}
niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

Confirmed what I was worrying about. This flyback high-voltage power supply circuit I hacked together inherently uses low repetition rate but huge current to pulse the flyback transformer, creating up to 1200 V output. The I_peak is around 3-4 A, well beyond the 1 A rating of the isolation transformer (not the flyback transformer) and its driver.

Only this isolation transformer has the necessary safety rating and certification for reinforced isolation at this voltage. If I can't get away by reducing the peak current, the only solution is stepping the voltage up at the primary for more power at the same current, and stepping it down again at the seconary. Overloading the transformer is possible, since it's only momentary. But it's a critical safety component, I don't want to risk that...
#electronics

Confirmed what I was worrying about. This flyback high-voltage power supply circuit I hacked together inherently uses low repetition rate but huge current to pulse the flyback transformer, creating up to 1200 V output. The I_peak is around 3-4 A, well beyond the 1 A rating of the isolation transformer (not the flyback transformer) and its driver.

Only this isolation transformer has the necessary safety rating and certification for reinforced isolation at this voltage. If I can't get away by reducing...

niconiconi replied to niconiconi

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

Oscilloscope trace, one trace shows the ramp up of the 1000 V capacitor bank. Another trace shows the bursty power supply voltage due to frequency drops every time the flyback converter is started.
10 V power supply voltage waveform, showing periodic (88.65 Hz) voltage drop every 10 milliseconds, to as low as 5.28 V.
niconiconi replied to niconiconi

Voltage regulation at 500 V is even better than my expectation. 2% within theoretical 536 V set point. #electronics

Oscilloscope screenshot, showing the high-voltage trace and the input power supply drop at the time of switching.
niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

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

Oscilloscope screenshots showing the ON signal and the regulated output voltage. The flyback converter is turned on in small 50 milliseconds bursts. The output voltage is a 550 V sawtooth waveform with 10 V ripple above and below the set point.
niconiconi replied to niconiconi

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

Photo of the same circuit board, now with huge capacitors, inductors, resistors, and huge banana socket connector installed.
niconiconi replied to niconiconi

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

niconiconi replied to niconiconi

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

Surge waveforms are compliant to IEC 61000-4-5's 1.2/50 μs & 8/20 μs requirements.
Open-Circuit Voltage:
- 1.02 kV, Front time: 1.33 μs, Duration: 53.60 μs
Short-Circuit Current:
- 484 A, Front time: 7.53 μs, Duration: 21.51 μs

Photo of the PCB prototype.

On the left there's a 120x160 LCD screen, four pushbuttons. USB power connector, a debug header, a microcontroller.

At the middle there's an isolation barrier, separating the low-voltage side and high-voltage side by a few centimeters for reinforced isolation. An isolated optocoupler and a isolation transformer are used for signal and power transmissions.

On the right there are various subcircuits. Most visible ones are a thyristor, massive capacitors, resistors, two toroidal inductors, and two large banana connector / binding post. Other supporting components includes a microcontroller, a flyback high-voltage power supply, a normally-on high-voltage SiC FET transistor for safety discharge, a floating high-side gate driver, among other things.
Oscilloscope screenshot of the output voltage and current waveform, showing the device is in conformance to the IEC 61000-4-5 requirements.
Comparison of the old and crude hand-built perfboard prototype and the new fancy PCB prototype.
Go Up