Week 8 : Electronic Design



Summary

This week I designed the electronic board for my high-voltage generator (see final project), and produced it for testing. The images are not exactly the same, but some variations have been made between the design and production of the PCB.

PCB_Final
Soldering_3

Assignments

Group Assignment

Individual Assignments


Sending a PCB to a Board House

This part was done in group and is accessible on the group page.

How to Use Test Equipment

This part was done in group and is accessible on the group page.

Context of the Week

Part of the Final Project

This week, assignment is part of my final project. As a reminder, I’ve decided to develop a plasma generation prototype for an advanced disinfection application. To do this, I need a very specific power source by means of a high-voltage AC generator. I therefore decided to integrate the creation of the power supply into the project. A high-voltage AC generator can be subdivided into several functional blocks comprising a DC power supply, power electronics to transform it into AC voltage, and a transformer block to increase the voltage. The focus here is on power electronics, i.e. the basic function of generating AC voltage.

Operation of the PCB

The PCB receives a DC voltage and transforms it into an AC voltage. There are several ways of doing this, two of which will be considered here, although only one will be realized in fine.

Different topologies exist and are used in industry, but here I’m going for the simplest, using two transistors that open desynchronously to alternate the current path and create this alternating voltage. This is the “push-pull” topology.

To control the opening of the MOSFET transistors I’ve studied two ways: one digital using an RP2040 microprocessor, and a second analog using a TL494.

In addition to this power electronics function, I’d like to add the possibility of I2C communication with an LED display, which will be integrated at a later date.

I’d also like to consider the use of potentiometers to adjust the frequency and amplitude of the signal generated, but this will be considered at a later date.

In any case, a microprocessor will be necessary, although its function will be different.

How to generate PWMs to control MOSFETs ?

Using TL494

The TL494, a widely-used PWM controller in switch-mode power supplies, finds significant application in push-pull configurations for generating high-frequency alternating voltages. Featuring two operational amplifiers, two hysteresis comparators, and a PWM control circuit, the TL494 facilitates precise PWM signal generation crucial for efficient transistor switching in push-pull setups. By alternately switching two transistors across a transformer, controlled by the TL494’s PWM signals, it enables the production of high-frequency alternating voltages at the transformer output. This output is subsequently rectified and filtered to yield regulated DC voltages. Implementation of such a system requires careful component selection, particularly in transformer design, switching, and filtering circuits, to ensure optimal performance. In conclusion, the TL494 serves as an effective and versatile solution for generating high-frequency alternating voltages in push-pull configurations, offering superior voltage regulation, energy efficiency, and compatibility across various high-frequency applications.

Using RP2040

In addition to the TL494, an alternative approach to generating high-frequency alternating voltages involves utilizing a microcontroller such as the RP2040 by XIAO Seeed, paired with the assistance of a gate driver like the MCP1416. The RP2040 microcontroller offers programmable flexibility, enabling customized PWM signal generation suitable for push-pull configurations. When combined with the MCP1416 gate driver, which provides high-speed and efficient switching capabilities, the RP2040 facilitates precise control over transistor switching, essential for generating high-frequency alternating voltages. This alternative approach allows for greater versatility and adaptability in voltage generation applications, leveraging the RP2040’s programmability and the MCP1416’s efficient gate driving capabilities to achieve desired performance. Additionally, it provides the opportunity for advanced features and functionalities through software control, making it suitable for a wide range of high-frequency applications requiring tailored voltage generation solutions.

This second alternative will be chosen to explain what follows, although the TL494 alternative has also been realized on KiCAD.

Using KiCAD

The first thing to do is to open KiCAD and create a new project.

KiCADMain

From here I need to do two things: edit the schematic, and then edit the pcb by importing the elements from the schematic.

Editing Schematic

When I get to the blank schematic page, I have to start adding the various elements that will make up my pcb. First of all, there’s the RP2040 microprocessor, but the two gates drivers and two mosfets are the most obvious elements.

KiCADSchemaBlank

Unfortunately, when I press add elements, they are not found in the suggested libraries. So I have to go online to find them and then import them into KiCAD. To do this, there’s the SnapMagic site, for example, or directly on the vendor or manufacturer websites (this is the case, for example, with the SeeedRP2040 microcontroller).

When I’ve found the symbols and fingerprints I need, I add them by returning to the main window, in Preferences :

A new window opens in both cases, I go to “Project-specific library” and press +. The next step is to choose a name for the library and the access path.

KiCADLib

So I can now add the main elements.

KiCADMainParts

Now I’ll have to make my schematic by making the appropriate connections. I need to add snubber circuits to prevent charge accumulation when the MOSFETs open. Two snubber circuits are therefore needed. I connect my load to the mosfet drain and earth on the other side.

KiCADMosfetsSnubbCirc

My gate drivers are connected to the gates and powered by the 5V from the microcontroller (as well as connected as input to the PWM pins on the microcontroller). I also added a 4 pin connector for a future LED panel addition.

KiCADMicroCGateDriver

Finally I also added two terminals, one for the DC voltage input, and one for the AC voltage output.

KiCADTerminals

About circuit snubbers. This is a DRC snubber circuit that I designed by setting the minimum frequency and capacitance to be able to determine the appropriate resistor to reduce overshoot to 5% of the observational voltage at the MOSFET terminals when it opens, as presented in a Texas Instrument document.

I now need to make sure that the elements are numbered, as well as assigning them an appropriate footprint. To do this, in the top bar, there is a button to initialise the referencing, and another to assign the footprints.

FootPrintAssignation

I assign an appropriate footprint to each element, so I have to search the libraries each time and then select the right footprint. Generally speaking, I’m sticking with an SMD format to simplify my life during manufacture (I’m going to stick with a copper layer), and I’m choosing hand-solderable 1206 as my size (also to simplify manufacture).

FootPrintAssigned

For the microprocessor, I’ve chosen to create a new cavity to put two 1x7 connectors in place of the microprocessor (so I can easily remove it from the PCB).

So I open the print editor and create a new print. I copy and paste the SeeedRP2040 footprint to create a canvas, and also import a 1x7 header, where each pin is 2.54mm apart. I was able to find out this information by measuring the SeeedRP2040 footprint. I position the two headers so that they are centred on the microcontroller pads.

CleanFootPrint
PinModif

I then measure the distance between them and reposition them in the same way without the SeeedRP2040 footprint. My result is a print of two 1x7 headers at the right distance. Finally, I have to reassociate the pin numbers so that they match those on the microcontroller.

CleanFootPrint
PinModif

Now that I’ve finished with the schematic…

SchemFinal

I can move on to the PCB.

Editing PCB

Now that I’ve finished with the schematic, I can move on to the PCB. When I open the PCB editor from the main window, I get to the blank pcb editing window.

PCBBlank

I have to press the update button to make the link with the schematic. This adds the various elements of the schematic by importing their footprints.

PCBAddParts

Next, I’m going to try and arrange the different pieces in a row. I’ll use the lines linking the pads that need to be linked for this arrangement. I try not to waste too much space.

PCBArrangment

I can now add the tracks. But before I do that, I add a rule in the ruler editor to make the traces 0.6 mm thick, a simpler thickness for manufacturing. I then add the traces, as I had trouble not isolating the ground. If I completely surround a pad, I can’t connect it to the others. After several attempts, I finally arrived at the result shown below.

PCBTraceRule
PCBAddTraces

In the image above, you can see that the ground tracks are not connected. This is because I’ve planned to add a ground zone, meaning that the grounds will be linked to the background surface, and not to a trace like the other pads. To do this I use the “add a zone” tool and draw the zone all around my pcb.

PCBAddZone
PCBAddZone2

Finally, I add a rectangle which will be the cut outline of my pcb. Selecting the rectangle tool automatically changes the layer I’m working on, so I can draw the cut contour. I also use the “fill zone” function to make the connection between the grounds.

PCBAddEdge
PCBFillZone

Before finishing with the PCB design, I use the “Design rules check” tool to check that there are no errors. These errors can be: forgetting to connect a pad, traces that aren’t connected to anything, grounds that aren’t in the zone, grounds that don’t have room to make their connection with the zone, and so on.

PCBCheckRules

After all that, I’ve finally got my final PCB and can move on to manufacturing.

PCBFinal

Files

Producing my PCB

I had to make a few modifications between the previous stage and production, as some improvements were made to the design, such as enlarging the traces, or adding capacitors to filter the signal at the inverter output.

To produce the PCB, I need to export the file to gbr, using the export to manufacturing file function. A configuration window opens up, but I don’t touch it much apart from the included layers. Here I only have the top copper layer (F.Cu) and the cutting cut (Edge.Cuts). I plot both files and also generate drill files.

ExportGBR
ExportConfig

Then, as described in week 4, I import the file into the Bantam software connected to the machine and mill the pcb. Unfortunately here, I forgot to make the holes with my drill files, but they’re optional.

PCB_Machine
PCB_Clean

I can now weld the various components together. The result is shown below!

PCB_Soldering_1
PCB_Soldering_2

I had a problem with the 3 input terminal, I made a mistake on the order. So I had to solder the wires directly to the board to be able to do the tests.

Testing my PCB

Now that everything is welded to my board, I’ll be able to test it. I start by adding the RP2040 that will be used.

PCB_Soldering_3

To test the board, I decided to work with MicroPython and Thonny. The code imported on the microcontroller will therefore be in Python.

Programming the Inverter

Testing the board means programming the RP2040 to convert its DC input voltage into AC output voltage. In practical terms, this means sending PWM signals to the gate driver so that it activates the MOSFETs correctly.

Before developing the code, I need to prepare the ground for using python with the Seeed RP2040.

Flashing MicroPython onto the RP2040

I followed the tutorial on the official Seeed Studio website. Here’s what I did:

  1. Install Thonny Editor: I visited the official Thonny and downloaded, and install, the latest software version.

  2. Setting Up Thonny: Then in the application, I went to “Tools -> Options” and chose the “MicroPython(Raspberry Pi Pico)” interpreter, as well as selecting the port with “Try to detect port automatically”.

  3. Flashing the Firmware: Next, hold down the BOOT button to connect the microcontroller in boot mode. The firmware will be sent automatically by Thonny by pressing “Install or Update MicroPython” in the bottom right-hand corner of the window opened in the previous step.

    The Seeed RP2040 is ready to receive python code.

Coding the Python Programm

Now it’s time to code the program that will control the MOSFETs.

I thought it was going to be simple using the PWM objects in the machine library. It turned out to be more complicated than expected, as the PWMs work synchronously. In other words, it’s not possible to delay the start of one pwm relative to another (between two output pins). So I have to go for “manual” control using the RP2040’s PIO. I therefore work with a state machine, associating it with a function called square, which generates desynchronized square signs on two output pins. The square program is an assembler program.

from machine import Pin
from rp2 import PIO, StateMachine, asm_pio

# Parameters
frequency = 30_000
count_TOT = 40
FirstPin = 26

# PIO function - PWM generation 
@asm_pio(set_init=(PIO.OUT_LOW,PIO.OUT_LOW))
def square():
    set(pins, 0b0000)  [1]   # Deadtime
    set(pins, 0b00001) [19]  # HalfPeriod
    set(pins, 0b0000)  [1]   # Deadtime
    set(pins, 0b00010) [19]  # HalfPeriod

# Création d'une StateMachine pour générer les signaux en phase et en opposition de phase
sm = StateMachine(0, square, freq= count_TOT * frequency, set_base=Pin(FirstPin))

# Activation de la StateMachine
sm.active(1)

So there are 4 assembler steps: two outputs off, one on, two off, and the other on.

The frequency at which the state machine must run is that of the signal frequency multiplied by the number of steps in the square code.

Testing & Measuring Signals

For the tests, I test the microcontroller on the board and measuring the signals at various points.

The measurement setup includes an oscilloscope and a test bench.

TestSetup

And with the oscilloscope I look at different places to see what the signal looks like. I get signs that correspond to what is expected.

Oscillo1
Oscillo2

Here you can see the two square signs at the microcontroller output, as well as the signs at the gates driver output (higher voltage). The shape of the gate driver signal is expected, given that the signal is high-frequency, and the gate driver rise time is noticeable.

A design error stopped me from testing further. I’ll test this again in a future iteration, as it’s for my final project.