Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: PWM gaps? Post ReplyPost New Topic
<< Prev Page of 8 Next >>
Author
Message << Prev Topic | Next Topic >>
Azure
Guru
Guru
Avatar

Joined: 09 November 2017
Location: Australia
Online Status: Offline
Posts: 435
Posted: 07 August 2018 at 9:32am | IP Logged Quote Azure

I am not sure what that first long pulse is from, it should be the same as the ones after it.

At 1249Hz the pulses are about 0.8ms, so there are about 5 pulses before it changes to 1250Hz which is right where the second glitch is. Then 1250 to 1251 looks smooth (5 more pulses each with a clean tranistion.



Back to Top View Azure's Profile Search for other posts by Azure
 
Malibu
Regular Member
Regular Member


Joined: 07 July 2018
Location: Australia
Online Status: Offline
Posts: 79
Posted: 07 August 2018 at 10:24am | IP Logged Quote Malibu

Quote:
I am not sure what that first long pulse is from, it should be the same as the ones after it.

Agreed... I presume it's how the register is first loaded and the way the PWM is initialised.

Run this code,
BaseHz=1000'1249
  for j = 1 to 500
    for i = BaseHz to 1300'(BaseHz+20)
      pwm 1, i, 50
      pause 5
    next i
    pwm 1, stop
    pause 10
  next j
  pwm 1, stop
  pause 1000

... and you get this...


When it periodically shows up, it's always a wide pulse on the first cycle (similarly at the other end, there's often a narrow pulse on the last one - presumably that's depending on when the PWM is turned off).
The set frequency is perfect from the falling edge of the wide pulse to the next falling edge.

Not a big deal for my situation, but could be an issue trying to control servos when they need a precise mark/space.

__________________

John
Back to Top View Malibu's Profile Search for other posts by Malibu
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2403
Posted: 07 August 2018 at 4:53pm | IP Logged Quote Geoffg

This is interesting. When I first implemented PWM I was thinking that it would only be used for generating a voltage or sound. But driving a stepper is a valid application and it needs to be done right. I don't have a stepper to test so thanks John.

I can see three issues:
- the first pulse is double width.
- there is a glitch at 1250Hz.
- the last pulse (at shutdown) can be short.

I have ideas for fixing these. Let me have a play and I will get back to you.

Geoff
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
Malibu
Regular Member
Regular Member


Joined: 07 July 2018
Location: Australia
Online Status: Offline
Posts: 79
Posted: 07 August 2018 at 5:32pm | IP Logged Quote Malibu

Thanks Geoff
I was starting to feel guilty that I was putting you through all the bother!
The reason I pounced on the MM system is specifically the PWM. Most PWM driving has a set frequency and the duty cycle is changed (ie: servo's), which is useless for driving steppers - your design can change frequencies and keep the duty cycle constant and as it turns out, that's perfect for driving STEP/DIR stepper systems. It's especially good with the driver chips that are out there now (Like the DRV8825, DRV8885 & bunches of others)

(I started typing a whole <blah-blah-blah> on your 3 issues, but I'm sure you've got it all covered )
Although, one possible future idea for the firmware could be a stepper function.

Quote:
Let me have a play and I will get back to you.

No worries, let me know and I'm happy to run it through its paces on my test rig...



For your interest, so far this stepper has been running a continual [ramp up-ramp down] cycle since around 9:00am and hasn't skipped a beat.

__________________

John
Back to Top View Malibu's Profile Search for other posts by Malibu
 
Azure
Guru
Guru
Avatar

Joined: 09 November 2017
Location: Australia
Online Status: Offline
Posts: 435
Posted: 07 August 2018 at 6:52pm | IP Logged Quote Azure

I am interested in both the stepper driving and the project you are trying to build (coil winder). I might have to get some extra hardware to get hands on with it and not just watch a PWM pulse train
Back to Top View Azure's Profile Search for other posts by Azure
 
Malibu
Regular Member
Regular Member


Joined: 07 July 2018
Location: Australia
Online Status: Offline
Posts: 79
Posted: 08 August 2018 at 3:52pm | IP Logged Quote Malibu

Quote:
I might have to get some extra hardware to get hands on with it and not just watch a PWM pulse train

Go for it!
It's always more fun getting things happening than trying to figure out problem!

__________________

John
Back to Top View Malibu's Profile Search for other posts by Malibu
 
KeepIS
Senior Member
Senior Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 209
Posted: 08 August 2018 at 8:22pm | IP Logged Quote KeepIS

FYI I'm currently driving 3 stepper motors with an MM plus @ 120 MHz. I'm using two PWM outputs and ramping up / down driving the Pulse pin of two Stepper driver modules. It's a closed loop system in that the position of the steppers is determined by two sets of digital slide scales, I'm also reading / decoding the scales directly with the MM. It's likely the reason that I don't have an issued with or even noticed any PWM glitch. Running the PWM from 50 up to 6000 Hz and always a constant 50 duty cycle. Both scales and 3 motors are running what could be basically described as a dual axis CNC. Resolution and accuracy down to 0.01 mm, more that enough for this hobby application. Love the MM plus with a 7" touch screen for applications like this. All credit to Geoff for his brilliant design and MMBasic.

Edited by KeepIS on 08 August 2018 at 8:23pm


__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
Azure
Guru
Guru
Avatar

Joined: 09 November 2017
Location: Australia
Online Status: Offline
Posts: 435
Posted: 08 August 2018 at 9:02pm | IP Logged Quote Azure

@KeepIS

Sounds like a great setup.

What modules are you using for the stepper motors drivers and any more details on the digital slide scales?
Back to Top View Azure's Profile Search for other posts by Azure
 
KeepIS
Senior Member
Senior Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 209
Posted: 09 August 2018 at 9:16am | IP Logged Quote KeepIS

Hi, I'm using two DM542T Digital stepper drives in the system, one unit is driving two Steppers in parallel, and no, I don't have any real issues with driving two in parallel, I have to keep the maximum speed down slightly though, and even that is due to driving two motors at half current. Using Nema 23 425oz-in 4.2A steppers and a 400 Watt 36V SMPS.

The Slide scales are from the low cost iGaging Easy-View DRO series. You likely know of them, they come with their own small Display head controller, I don't use the supplied small control head, I clock and read them directly. Using low cots Bearing rails and steppers are connected to Screw and Ball nut drives.

Edited by KeepIS on 09 August 2018 at 9:17am


__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
Malibu
Regular Member
Regular Member


Joined: 07 July 2018
Location: Australia
Online Status: Offline
Posts: 79
Posted: 09 August 2018 at 5:54pm | IP Logged Quote Malibu

Sounds like an interesting project KeepIS!
I checked out the Stepper drives you mentioned and yeah, there's plenty of similar and all are really good (I run Gecko drives on my CNC and they are fantastic!)
I looked into the option of some of the Gecko drives for what I'm doing, but it adds to the cost, so for 5 bucks on e-bay... the 8825's win the day
The Easy View system looks pretty good! Typical of that linear encoder systems for use on milling machines - always a good way to get readings... I like 'em, I'll have to keep them in mind, thanks
Quote:
I don't have an issued with or even noticed any PWM glitch

It's interesting you didn't have any problems, and also interesting that Azure didn't either.
When I tweaked the code so that the PWM had feedback to an interrupt pin so the PWM value ONLY got changed after the pulse occured, my problem cleared up as well. I guess I created a closed-loop by doing that as well, so you could be right in your assumptions.
Eventually, I'll be using a quadrature encoder on my steppers, so it will become a closed loop as well.
(Right now, I'm trying to settle down the reading from the pot to get a nice steady RPM's... Arrrgh!, I hate noisy pot wipers!)

Thanks for the extra ideas

__________________

John
Back to Top View Malibu's Profile Search for other posts by Malibu
 
KeepIS
Senior Member
Senior Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 209
Posted: 09 August 2018 at 7:25pm | IP Logged Quote KeepIS

Hi John, I'm assuming that you have a cap from the wiper to either side of the pot, but thought I'd mention it just in case. That's also another reason why I hate low cost mechanical encoders, trouble is good quality optical encoders are expensive, well at least for me. I using two encoders for micro adjustments of the drives in manual mode, most of the time you just punch in the position or offset on the MM screen and press go. I do have a couple of quality Encoders for motor shaft or similar mounting, which is what you intend to do with the feedback loop, but they are hard to mount / use in my current situation, so a couple of Jaycar low cost mechanical specials are in there. I'd better let the thread get back on track.

Cheers

Mike.

__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2403
Posted: 10 August 2018 at 10:45pm | IP Logged Quote Geoffg

Another update for the beta version (it is now at beta 7).

This fixes the double width pulse when the PWM starts and the short pulse when it is stopped.

It also fixes the short pulse that occurred when changing the frequency from <1260Hz to above (and vice versa). The only problem is that when this is done there is one missing pulse. I have worked on this but it seems to be a "feature" of the PIC32 timer and compare modules which generate the PWM stream.

The new beta can be downloaded from: http://geoffg.net/micromite.html#Downloads
Look for "Micromite Firmware V5.04.10 Beta Test Version"

Let me know if you find anything else (fingers crossed again).

Geoff
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 


<< Prev Page of 8 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1133 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11