DC Motor PWM Speed Controller (PCB Design and Testing)

by PSEM in Circuits > Microcontrollers

1297 Views, 4 Favorites, 0 Comments

DC Motor PWM Speed Controller (PCB Design and Testing)

E2K0F_AXMAEyCQ7.jpg
IMG_9255.JPG
IMG_9256.JPG
IMG_9257.JPG

This project was created in the scope of the Greenpower F24+ competition.
Previously, our team (PSEM) used a pre-made controller which imposed some limitations, so this year we decided to build a PWM PCB controller from scratch to fit our needs.
The PCB was supplied by JLCPCB, a high quality, low cost PCB manufacturer (https://jlcpcb.com/RAT)

PCB Design

schematic1.png
schematic2.png
schematic3.png
3182091627035699263.png

The software KiCad was used to create the respective PCB, due to it being open-source and easy to use.
The first step was to create the schematic symbols corresponding to each component of the circuit, some already existed (like resistors, capacitors, diodes and MOSFET's), and others were created from scratch (like gate drivers, motor, batteries, voltage regulator and all the 2, 3 and 6 pin connectors). Due to its size, the following schematic will be divided in 3 parts (first 3 images).

In the first image we see the microprocessor used (ATmega328P-PU) and its connections to both gate drivers. The signals exiting gate drivers 1 and 2 through resistances R2 and R3 will enter the MOSFET's gates, in image two.
To force the microprocessor frequency to be 16MHz we use a small external crystal.

In the second image, we see the main motor-battery circuit, where the motor has two flyback diodes in parallel (to avoid the negative effects of EMF when the circuit is suddenly opened) and two MOSFET's, which act as switches to close and open the circuit.
We also have two small circuits for two LED's, one of which turns on when the batteries are connected to the PCB, and the other when the microprocessor sends a 5V signal to its respective connection. These LED's allow us to troubleshoot problems more easily.

In the third image we see, on the top side, all the connectors used. Most are used to send important data to our data acquisition system, but two 3 pin connectors are used to receive data relative to the current measured vehicle speed, measured with a Hall sensor, and the current desired vehicle speed, which our pilot adjusts with a potentiometer.
On the bottom side we see our voltage regulator, it takes in 24V from both batteries in series, requires two resistances (200Ohm and 600Ohm) to adjust the output voltage to 5V, and capacitors of various values (10micro Farad and 0.1micro Farad) on the input and output to filter any noise the signals may carry.

With this schematic in hand, we need to create the necessary footprints to assemble the PCB layout. Just like the component schematics, some footprints already existed and were used and others were created from scratch (using the component datasheets as reference for the dimensions and pin placements).

In the last image, we see the entire PCB layout.

The red connections represent traces on the top layer and the green connections represent traces on the bottom layer. One feature that stands out is the width of the green traces on the right side.
These traces connect both MOSFET's and both diodes to 24V and to the motor negative. Since a relatively large amount of current will run through these components (between 20A and 25A, in nominal conditions), these traces need to be as thick as possible on the PCB. To aid his, they are uncovered so we can solder copper wires on top of them, this way we reduce the strain the high currents will inflict on the PCB.

Experimental Setup and Tests

IMG_9689.jpg
diagrama_montagem.jpg
Captura de ecrã 2021-07-23 131342.png

In order to test the controller design, assuring the safety of the driver and the car, the whole system was recreated in a laboratory, as shown in the first image. A diagram explaining this setup can be found in the second image as well.

Firstly, we have the two 12V batteries in series connected to the PWM controller, which is powering the DC motor on the left with an equivalent DC voltage V₁ (proportional to the duty cycle).

This motor is coupled to the second one on the right mechanically, making the angular velocity of both shafts the same. Since the second motor is not powered electrically, it is serving as a generator, imposing the voltage V₂ on the three rheostats which imposes a current back on the DC motor generator.

The current forced by the rheostats is interpreted by the left DC motor as a torque load. In other words, by increasing the equivalent resistance of the parallel of the three rheostats, we are requiring the DC motor to use more current, giving us the ability to choose how much current runs through the PWM controller. This way, by adjusting this resistance, it is possible to simulate racing conditions, considering the only external variable on the DC motor is the torque applied on E₁.

The system of equations in the third image describes how the mechanical component interacts with the electrical in a DC motor.

Matching the torque and velocity on each motor (using the coupler), and knowing the constants R, L, k, J and B for both cases, with just a few measurements, of the system, it is possible to calculate all the relevant information.

For example, imagining we know the torque the car and the driver apply on the motor on a certain point of the track, by adjusting the rheostats, we are able to obtain the current draw curve on the controller for variable speeds under those conditions.

Since we are dealing with currents around 25A or 30A, both the motors and the rheostats are working near their limits. To mitigate any possible damage to the equipment, the temperature of both motors is monitored closely, as well as the current on each rheostat, to ensure the load is distributed equally. As for the controller, the PWM signal generated is observed on an oscilloscope and the temperatures of the diodes and MOSFETs are recorded as well.