How to measure rectified AC with a PIC using isolation

Thread Starter

Futterama

Joined Aug 25, 2013
4
Hi forum,

I'm designing a motor controller for a PMDC treadmill motor rated 180V and 2HP. The motor needs to run very smoothly as an accelerometer is connected to it to measure vibration.
The motor housing has an earth lead attached to it's outer casing so I assume it's safe to run it from mains, please tell me if I'm wrong!

I have attached a schematic.

The mains is fused with a 5x20mm glass fuse, F1. Then full bridge rectified with B1. From here the voltage will be around 325Vpp.
When turning ON the motor controller, SW1 is pushed for a second or so to pre-charge the smoothing capacitor C1 and film capacitor C2 through R1. When the voltage reaches a setpoint (which I haven't determined yet) a PIC MCU will switch ON relay K1 to bypass the pre-charge circuit. When the PIC MCU is told to turn OFF, it releases the relay and the capacitors are discharged through R2.

The N-ch MOSFET T1 will be PWM controlled by the PIC MCU through an isolated MOSFET driver. D1 is a flywheel diode for the motor and C3 is a film capacitor to help with the voltage peaks until D1 starts conducting.

Since the motor load can reach 11A (from what I can tell), the DC bus voltage will not be constant, but has a large voltage ripple reaching 110Vpp at full load. To avoid this influencing the motor voltage, and creating torque ripple, I was planning to alter the PWM duty cycle according to the voltage on the DC bus, so the motor will see a constant voltage.
But this, along with the pre-charge circuit, requires me to sample the DC bus voltage. How would you do that and keep isolation to the PIC MCU?

I see 2 options:
1. Use a linear optocoupler. I have not used one before so this is new to me.
2. Use a high voltage linear regulator to feed a small PIC MCU with internal ADC, which measures the voltage from a resistor divider and sends this as digital values through a regular high-speed optocoupler to the PWM MCU.

Regarding isolation, when can you regard a whole circuit as proper isolated? Because some components will have to stay on the mains side. How do you determine which components can stay on the mains side and which should be isolated?

Are there any other reasons to keep certain components isolated than shock hazard?

I'm all in for isolation, and I know it's a hot topic here, I hope my post doesn't break any of the isolation rules here, if it does, I'm very sorry, that was not intended.

Best regards,
Futterama
 

Attachments

Last edited:

MaxHeadRoom

Joined Jul 18, 2013
30,680
For general answers, I use the MOC8106 for isolation between Pic and Mosfets.
The motor powers supply can be mains powered as it was in the T.M. The motor frame should be earth grounded also.
The Pic can be fed from an isolated supply and also you can get smooth control with PWM without going to linear control.
Any reason you are not using an original T.M. controller?
Max.
 

Sitara

Joined May 2, 2014
57
From your schematic its unclear what is being switched by relay K1. If the switch pivots about point P, and if point O is the starting position, then
pushing SW1 for a second or so will dissipate 385 watts through R1 & R2 and likely fuse them. A low ohmic resistor, say 0.1R between the mosfet source and ground will measure the current across the motor which will be proportional to its speed. Amplify this using a non-inverting op-amp and you should end up with a usable signal with which to control the pwm duty-cycle.
 

Thread Starter

Futterama

Joined Aug 25, 2013
4
The Pic can be fed from an isolated supply and also you can get smooth control with PWM without going to linear control.
Any reason you are not using an original T.M. controller?
Can you elaborate on the part I marked with bold?

I got the motor as a new spare part, so I don't have access to a treadmill controller. I also don't like that they are probably triac controlled, making some torque ripple at 100Hz, I'm afraid it will affect my accelerometer readings.

From your schematic its unclear what is being switched by relay K1. If the switch pivots about point P, and if point O is the starting position, then
pushing SW1 for a second or so will dissipate 385 watts through R1 & R2 and likely fuse them. A low ohmic resistor, say 0.1R between the mosfet source and ground will measure the current across the motor which will be proportional to its speed. Amplify this using a non-inverting op-amp and you should end up with a usable signal with which to control the pwm duty-cycle.
Thanks! You are absolutely correct, I did not see that regarding the relay. It does indeed pivot around point P. I would have to use an extra relay for this or a single DPDT relay.
Regarding current measurement, I was thinking of using the ACS712/ACS722. But I was not considering using it for motor control, just as an overcurrent safety measure.

I was thinking of measuring the DC bus voltage during a half-wave, lets call this 1, and then assume that the DC bus voltage would be almost the same the next half-wave, 2, and then calculate the PWM ahead of time from the DC bus voltage measurements, so I have measurements from half-wave 1 to calculate the needed PWM to keep a steady motor voltage during half-wave 2. Does that make sense?
 

MaxHeadRoom

Joined Jul 18, 2013
30,680
Can you elaborate on the part I marked with bold?

I got the motor as a new spare part, so I don't have access to a treadmill controller. I also don't like that they are probably triac controlled, making some torque ripple at 100Hz, I'm afraid it will affect my accelerometer readings.
Many are PWM now.
What part?
Max.
 

Sitara

Joined May 2, 2014
57
If you want an easy life, then off-the-shelf solutions are the way to go, for example: https://uk.rs-online.com/web/c/auto...F746F7220636F6E74726F6C6C65727326&r=f&sra=oss
Or, if you prefer a more hands-on approach then solutions based on dedicated motor control ics would be easier to implement than using general purpose microcontrollers : https://uk.rs-online.com/web/c/semiconductors/power-management-ics/motor-driver-ics/

But, if your heart is set on using PICs then this may be helpful: https://www.microchip.com/design-centers/motor-control-and-drive
Take your pick!
 

Thread Starter

Futterama

Joined Aug 25, 2013
4
Max, I did not understand the part regarding linear control.

Sitara, thanks for the links. I did consider an off-the-shelf solution, but I like to build things myself and challenge myself to learn new things. But if I eventually fail, this seems to be usable: https://uk.rs-online.com/web/p/dc-motor-controllers/1977456/

For some reason I just don't really like those motor controller ICs, I don't know why, but they don't really appeal to me.

I have previously built a motor controller for a windshield wiper motor. That was pretty straight forward. Then I have started a build of a high-current brushless motor controller (50V 200A) with the help from a forum in the e-bike community. This has given me much better understanding of building this kind of thing even though the project has been on hold for some time now. Stuff like DC link capacitors, inductance, voltage spikes at MOSFET turn-off, isolated MOSFET drivers with desat detection, MOSFET gate charge and miller plateu ect. now all makes sense to me.

I have some changes to my schematic, I'll post them when I have made the changes in my editor.
 

IamJatinah

Joined Oct 22, 2014
136
PMDC motor control/regulation is best done via formal feedback thru encoders or other sensors. DC_Bulk voltages on most available controllers are stabilized leaving spin/speed control to the PWM manager/controller and varying PWM duty-cycle for intended speeds. Half-Wave rectifying leaves AC component on a DC_Bulk which is unhandy. Triac and SCR-fired rectifiers are filthy with AC components unless filtering very well. A controller for 50v at 200A sounds a bit odd, higher currents require larger conductors when most go the other direction, higher potentials mean lower operating currents, lowering costs.
Current sense can be done via Inductive-coupling but I have seen that act slow compared to a pick-off of that motor current sense resistor which is most common.

Thoughts? Good luck ;0)
 

Thread Starter

Futterama

Joined Aug 25, 2013
4
IamJatinah, thanks for your comments.

The controller for 50V at 200A is for large scale RC cars, they carry 10-12 series LiPo cells of 10000mAh. The motor I have is only rated for 38V and 193A but I need a controller with some headroom. And yes, that is a beast of a brushless motor at 7kW and 30000 RPM.

I plan to use an ACS712 for current monitoring. I use the ACS758ECB-200B-PFF-T for the 50V 200A controller.
 

IamJatinah

Joined Oct 22, 2014
136
IamJatinah, thanks for your comments.

The controller for 50V at 200A is for large scale RC cars, they carry 10-12 series LiPo cells of 10000mAh. The motor I have is only rated for 38V and 193A but I need a controller with some headroom. And yes, that is a beast of a brushless motor at 7kW and 30000 RPM.

I plan to use an ACS712 for current monitoring. I use the ACS758ECB-200B-PFF-T for the 50V 200A controller.
WOW.... that must rock!
 
Top