monnie
Newbie level 3
- Joined
- Aug 18, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 70
About the Project:
My software colleague and I (as the hardware guy) are working on a circuit to control a simple Brushed DC Motor. It's rated at 24 Volts, and it will be powered with a 24 Volt power supply, but it needs to be ran at about 12 Volts to run at the desired speed. To achieve the correct speed of the motor we are PWMing it at 50% Duty and at 7.2 KHz (Low Side Switching with a MOSFET). Also, the circuit controls four relays used as VFC (Volt Free Contacts). One powers a "Running" light, another powers a "Fault" light, and the other two are spares for future expansion.
At the beginning of a cycle the "Running" relay turns on, which lights a lamp and indicates a cycle has began. At the same time, the motor starts turning, PWMed at 50% Duty. The motor cycles through 6 positions (approximately 50 degrees apart) , dwells at each position for a few seconds, and then goes "home" using feedback from an infrared LED, a photo-transistor, and an encoder disk with 7 holes (6 positions and "home"). When the motor reaches its "home" position, the controller turns the motor off, and turns the relay off at the same time. This repeats at a specified time in software, or can be triggered using a button on the user interface.
Problem We are Having:
Sometimes, at some point in the middle of it's cycle, the controller either resets, or goes crazy. By "goes crazy" I mean the LCD displays funny characters (indicating the EEPROM has probably been corrupted), and the controller stops controlling the motor. sometimes the motor continues to PWM until the power is cycled (since we are using the built in hardware in the ATMEGA32A microcontroller), and sometimes the motor sees a full 24 Volts until a power cycle. If the controller resets, it works normally again. If it "goes crazy" it requires to be reprogrammed to reinitialize EEPROM to the correct values.
The problem we are having is hard to deal with because it is seemingly random, and hard to pinpoint when it exactly happens. Sometimes it runs perfectly fine for 30 or 50 cycles, then it runs a single cycle where it glitches and runs fine again for 30 or 50 complete cycles. There is nothing for me to trigger on, since most of the time the PWM just continues forever. It seems like the glitch always occurs either when the motor is running, or just as it turns on. I'm not sure since I can't trigger on the event.
Things I've checked/tried:
I checked 24 V supply at the motor, and it only dips a couple of volts when the motor turns on.
I am measuring the current in the motor with a current probe, and it spikes to about 6.5 Amps in about 2.5 ms, and then decays to 300 mA in about 30 or 50 ms.
I measured the 5 Volt supply and the reset line right at the microcontroller pins, with the scope ground also at the microcontroller pin. Both are stable and don't drop out when the glitch occurs.
I added 470uF at the motor positive to the Source of the MOSFET. It didn't stop the problem.
I disabled the relays (by shorting each of the bases of the BJTs that control them to it's emitter). The problem still happens.
I can't remove the motor, because the microcontroller does a fault check. If the motor doesn't start moving within 1 second it stops the motor and sets a fault.
ANY IDEAS! Is it hardware related, could it possibly be software related (maybe some overflow in some cases depending on current/voltage feedback)?
My software colleague and I (as the hardware guy) are working on a circuit to control a simple Brushed DC Motor. It's rated at 24 Volts, and it will be powered with a 24 Volt power supply, but it needs to be ran at about 12 Volts to run at the desired speed. To achieve the correct speed of the motor we are PWMing it at 50% Duty and at 7.2 KHz (Low Side Switching with a MOSFET). Also, the circuit controls four relays used as VFC (Volt Free Contacts). One powers a "Running" light, another powers a "Fault" light, and the other two are spares for future expansion.
At the beginning of a cycle the "Running" relay turns on, which lights a lamp and indicates a cycle has began. At the same time, the motor starts turning, PWMed at 50% Duty. The motor cycles through 6 positions (approximately 50 degrees apart) , dwells at each position for a few seconds, and then goes "home" using feedback from an infrared LED, a photo-transistor, and an encoder disk with 7 holes (6 positions and "home"). When the motor reaches its "home" position, the controller turns the motor off, and turns the relay off at the same time. This repeats at a specified time in software, or can be triggered using a button on the user interface.
Problem We are Having:
Sometimes, at some point in the middle of it's cycle, the controller either resets, or goes crazy. By "goes crazy" I mean the LCD displays funny characters (indicating the EEPROM has probably been corrupted), and the controller stops controlling the motor. sometimes the motor continues to PWM until the power is cycled (since we are using the built in hardware in the ATMEGA32A microcontroller), and sometimes the motor sees a full 24 Volts until a power cycle. If the controller resets, it works normally again. If it "goes crazy" it requires to be reprogrammed to reinitialize EEPROM to the correct values.
The problem we are having is hard to deal with because it is seemingly random, and hard to pinpoint when it exactly happens. Sometimes it runs perfectly fine for 30 or 50 cycles, then it runs a single cycle where it glitches and runs fine again for 30 or 50 complete cycles. There is nothing for me to trigger on, since most of the time the PWM just continues forever. It seems like the glitch always occurs either when the motor is running, or just as it turns on. I'm not sure since I can't trigger on the event.
Things I've checked/tried:
I checked 24 V supply at the motor, and it only dips a couple of volts when the motor turns on.
I am measuring the current in the motor with a current probe, and it spikes to about 6.5 Amps in about 2.5 ms, and then decays to 300 mA in about 30 or 50 ms.
I measured the 5 Volt supply and the reset line right at the microcontroller pins, with the scope ground also at the microcontroller pin. Both are stable and don't drop out when the glitch occurs.
I added 470uF at the motor positive to the Source of the MOSFET. It didn't stop the problem.
I disabled the relays (by shorting each of the bases of the BJTs that control them to it's emitter). The problem still happens.
I can't remove the motor, because the microcontroller does a fault check. If the motor doesn't start moving within 1 second it stops the motor and sets a fault.
ANY IDEAS! Is it hardware related, could it possibly be software related (maybe some overflow in some cases depending on current/voltage feedback)?