Wednesday, June 10, 2020

DC motor controller

Hi!

This time I'd like to focus on a project I have made for a class at my university. It's a DC brushed motor controller. It is actually a part of a bigger project - an autonomous quad bike. Guys working at the mechanical aspects of the robot needed some powerful servos for operating the cluth, trottle, breaks and of course turning. They tested that the windshield wipers motors' have enough torque to move the mechanical components controlling the vehicle. I volunteered to design the control electronics board for such a motor and here I'd like to document the build with some photos and a few words of description.

I think the hardest part was to design the power supply section. The assumption was that the board should be able to be powered with voltages ranging from 12 to 24V. Actually the design can withstand voltages as high as 30V, because the acid batteries can exceed the 24V nominal voltage value by a few volts. The device needs a 4 different voltage levels to operate correctly. I think the diagram below explains the situation in a most explicit way:

Different supply voltages 
As can be seen on the above picture there are quite a few devices to power. There is a main DC/DC converter making a 5V output that powers the CAN transceiver. The LDO takes 5V and converts it to 3.3V for the STM32 microcontroller and the encoder. 15V power supply for the MOSFET drivers is outputted by an LDO. This was quite a tricky part of the design as I thought it could get hot due to the big voltage drop and some current flowing trough it. Running a simple simulation in LTSpice showed that the drivers can consume up to 40mA RMS, which would correspond to about 0.5W dissipated by the IC. Even though it would still operate in it's nominal conditions (about 100*C on the junction) I expected the power consumption to be much lower (as I simulated the worst scenario). I added some ceramic capacitors in close proximity to the LDO and the overall temperature is low enough to touch with a finger (<50*C). Finally the 30V is fed to the H bridge.

The device has a shunt resistor for current sensing. I thought about using the current measurement as a low resolution encoder. Below you can see an image of the motor current (blue waveform). The idea was to apply a low-pass filter and read the peaks as impulses, as they occur regularly. I imagine this regularity can be affected by the motor wear after some time, but it may still be an interesting source of motor position information.
Motor current waveforms - shunt voltage drop - purple, amplifier output - blue. 
The communication is performed using CAN bus, and for now it supports only one data frame with desired angular position. Maybe in the future the command list it will be expanded. Besides I think the rest is quite straightforward, so I'll just skip to the interesting part - the prototyping process and photos:

Planning the table

First layer

Milling process completed 

Milling some mild steel with a 6mm 4 flute milling cutter

Prototype mounted on the motor gear case.
 The prototype took me about three hours to make, but it allowed to find some bugs, like no op amp biasing, and poor performance of the way it was mounted on the motor. During the testing I set the current to 10A and voltage to about 28V and moved the motor each way with 90% PWM duty. My colleques stopped the shaft and we observed for extensive heating or any other signs of poor performance under load. After a few cycles the motor ran only in one direction while the other seemed to short the power supply. I suspected that we reached the limit of the MOSFETS, but it was kind of weird as they were cool to touch. The cause of this problem was the motor itself. Inside it has 3 brushes on the commutator for different operating velocities. The unused brush, although earlier dissconnected from the case potential, caused a short between one of the motor terminals and the case, to which the pcb was connected. After removing the brush everything was functional again. This situation, and the requirement of the controller to be water-resistant, dictated the shape of the PCB. Now it is rectangular and fits in a 3D printed case (for now).

JLC PCB board 

Almost finished 
One cool solution is the usage of the motor's built in limit switch. It is used for finding the zero position, when the encoder is in the incremental mode.

Next time I'll write a short description of the milling machine Z axis replacement, as the linear rails have arrived.



No comments:

Post a Comment