1 Attachment(s)
screening / glitchy operation - sanity check
I'm using a HBS86 + 8Nm motor with a 68VDC supply and driving this with a PIC based uC system via a PWM output. I've coded up a ramp start function, which generates a PWM with a variable frequency to ramp the motor up from 60RPM to 240RPM. On the scope all looks good, on the motor it works, but I can hear the motor sometimes glitching, as if it's loosing steps. I've even seen a 'positioning error' once on the driver, it needed a power cycle afterwards to get things going again. I'm using screened cables, but currently haven't got the screens connected, so I thought maybe this is the reason. Here's how it's connected:
Attachment 10858
I've numbered the screens, should all 1-3 be connected to 4 - E(arth) / chassis? I'm guessing I need to put a link between the E(arth) terminal and the chassis as well to get the whole chassis earthed?
Thanks in advance for any suggestions.
Regards,
dsc.
Re: screening / glitchy operation - sanity check
This is most likely to be a software problem. In what language have you programmed the PIC? If you don't mind posting the code then I'll have a look at it for you. I expect it'll be the PIC not outputting pulses with a smoothly changing frequency, e.g:
Instead of,
|_|_|_|__|___|____|____|____| ...
Something like,
_|_|_|____|__|___|____|____|____| ...
This can be caused by things like stopping the output (briefly) whilst calculating the period which would introduce an additional delay. Are you using the hardware PWM module, or doing it 'manually' with a loop?
Re: screening / glitchy operation - sanity check
Thanks Jonathan, on the scope it looks like the top example from your reply. I can post a scope recording if I figure out how to record with the fancy model I've borrowed from work. The function for the slow ramp is below, coded in C:
void slow_ramp(void)
{
//PWM code for slow ramp start
CCPR1L = 0b00000010; //set to 2, so pulse width is 2 x 16 = 32 with 16 prescaler
while (PR2 != 18) //ramp up speed slowly from 60RPM [PR2 = 77] to 240RPM [PR2 = 18]
{
while (TMR2IF == 0) {} //wait for overflow
PR2--;
__delay_ms(5);
}
}
Using the hardware PWM module on the PIC.
Regards,
dsc.
Re: screening / glitchy operation - sanity check
Quote:
Originally Posted by
dsc
I've numbered the screens, should all 1-3 be connected to 4 - E(arth) / chassis? I'm guessing I need to put a link between the E(arth) terminal and the chassis as well to get the whole chassis earthed?
Yes I would connect them all together but each cable screen should be earthed at one end only, the other ends should be insulated with some heat shrink sleeving for example.
should TMR2IF be cleared at each loop ?
2 Attachment(s)
Re: screening / glitchy operation - sanity check
I've connected the screen (one end, the other is tied back) for the PUL / DIR inputs into the E(arth) on the PSU, not much difference though, here's a shot before the screen got connected:
Attachment 10861
and here's after:
Attachment 10862
Minimal difference, although there's a lot of noise on that line (that's the PUL- / GND scopped). Not sure what it is, or how to get rid of it. On the other hand, the proto board is a mess full of breadboard wires, so isn't exactly super noise resistant.
I can't capture a long scope, I can only do a print screen kind of capture which isn't good enough to show how the PWM frequency changes. I can see a rolling effect ie. frequency increasing on the scope when the motor starts, but I don't know what causes the glitches on the motor. It stopped again with a positioning error today, don't know why though.
EDIT: here's a video, although it's hard to hear the glitches: https://vimeo.com/80205760
Regards,
dsc.
3 Attachment(s)
Re: screening / glitchy operation - sanity check
I've done some further testing on this, here's my findings:
1) as soon as I plug the DC supply in, there's noise on the PIC lines. It doesn't matter if the PIC lines connected to the driver or not, the noise is still there:
Attachment 10865
It's periodical, with a period of 11.5us, which gives a frequency of around 87kHz.
2) plugging the PIC control lines to the driver, causes the low levels to jump up by around 100mV, I wasn't expecting that to be honest:
Attachment 10866
3) there's loads of spikes on top of the PWM signal, see here:
Attachment 10867
Not sure this makes a lot of difference, the high level trigger for the HBS86 is > 3.5VDC and low is < 0.5VDC, so it should behave itself.
Any ideas on how to tame this? screening to earth doesn't seem to affect the noise at all. I've also tried ferrites, with not a lot of luck.
Regards,
dsc.
Re: screening / glitchy operation - sanity check
Chances are it's a switch mode dc supply, in cases like this I used to connect the circuit to batteries as this eliminates a lot of problems straight away and indicates where the main problem lies.
Re: screening / glitchy operation - sanity check
Cheers EddyCurrent, I was thinking it's something to do with the plug-in DC power supply I'm using for the PIC circuitry running in parallel with the big 68VDC PSU. I will try a 9VDC battery and report back.
Regards,
dsc.
1 Attachment(s)
Re: screening / glitchy operation - sanity check
I've switched to a 9VDC battery, not much difference, after which I've earthed the driver chassis, which dropped the noise levels significantly. Comparison between a battery supply and plug-in DC supply with the driver chassis earthed:
Attachment 10868
I'll stick with the plug-in supply and keep everything earthed.
Regards,
dsc.
Re: screening / glitchy operation - sanity check
That's good, the main thing with trying a battery is to remove that doubt so at least now you know the PSU is okay.
So with noise levels dropped has it improved the operation ?