incPID Routine - Help Needed


Closed Thread
Results 1 to 40 of 64

Hybrid View

  1. #1
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    "#*&@"!!!!!

    I don't think I could have worked that out in a month of Sundays! - Thanks Ioannis.

    As Henrik stated, the 16F1825 is pin compatible with the '684 that I am currently using but your "head start" on setups will be invaluable in my future endeavours.

    Henrik also asked the question
    Why do you need me for this ? ;-)
    I think the answer to that is now self explanitory...

    Thanks for all your help guys. I am sure I will be back with more questions very soon

    Cheers
    Barry
    VK2XBP

  2. #2
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Hi All,

    I have had a bit of time to think about where I am going with this project and what my ultimate goal is.
    As stated in my original message

    The end use for this project is to re-power my 9x20 lathe using a treadmill motor (180Vdc 2HP).
    I could spend time tweaking the current system, change the PIC (along with the extended learing curve associated with the new settings) but is it really worth it? At this stage I have proved the concept using the 24Vdc motor; proved it well enough to move forward to the final platform. I have decided to take the plunge and jump straight to the full blown design. Yeah, scary huh!

    The final system will require forward and reverse motor operation. This will be achieved using four IGBT's configured in an H-Bridge arrangement. The IGBT's will be fired by dedicated high-side and low-side gate drivers. All control circuitry will be isolated from the power circuit by opto-isolators (5kV isolation). Forward, reverse and stop (emergency) functions will be performed by switches on digital I/O lines, speed to be set by ADCin via a pot, feedback via photo-interrupter/shaft encoder wheel with an interrupt driven counter (eg. TMR0 and TMR1). As in the prototype system, gain terms will be set via individual pots with ADCin routines. Settings to be displayed on a serial LCD.

    I have searched the Microchip website for an appropriate device and decided on the 18F2431. Quite a powerful device with lots of in-built functions dedicated to motor drive applications.

    I now have lots of new information to try and get my head around. The 18F2431 datasheet is mammoth! I plan to piece the circuit diagram together, lay out a new pcb and then begin to learn the ways of driving the 18F2431. This won't happen overnight - but it will happen

    Thanks to all those who have helped me get to this stage. I am sure I will be calling on you again in the very near future.

    Any recommendations, suggestions or comments on what I am trying to do, before I embark on this adventure, would be greatly appreciated.

    Cheers
    Barry
    VK2XBP

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Hi Barry,
    The 18F2431 is a wonderful device (a bit expensive but there's really no alternative in the 8bit line-up of PICs) and it is the chip I personally use with the PID routine (for info please see with a bit of "bench test demo".

    I haven't used the PCPWM module in full bridge mode but I think there's a post somewhere around here, made by Bruce, with a nice example. Apart from that I know the 2431 pretty well so you won't be alone.

    Keep it up!
    /Henrik.

  4. #4
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Hi Henrik,

    Nice to know I won't be flying blind with my choice of PIC. I am really getting in WAY above my head with this beast but what the heck - it only set me back $10
    I will send you a copy of the new circuit diagram once I have finished it. Hopefully the pin-out for my needs should be relaitvely straight forward.
    I will also do some forum searches on the 2431 and see what I can find.

    I was very impressed with your Youtube video. Nice bit of motor control. Once I get my 9x20 lathe re-powered I will be looking to do a CNC conversion on my X2 mill. So much to do, so little spare time available...

    Onwards and upwards

    Cheers
    Barry
    VK2XBP

  5. #5
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Hi Henrik,

    It has been quite some time since I last posted on this subject. A lot of water has flowed under the bridge since then but I am pleased to advise that I have my 1500W H-Bridge power board up and running via PIC18F2431 in PCPWM mode.
    I have forward, reverse and emergency stop functions operating on a test motor (24V 200W scooter motor) and nice clean rotary encoder signals from a home made encoder wheel and IR photo-interrupter - 60 steps per revolution.
    My next stage of the project is to try and implement your incPID routine.
    My question is this: Should I take the approach you outlined above (ie use DT-Ints to set up a timer interrupt at around 100Hz and then feed the pulses to another timer/counter) or would there be a better way of doing it on the 18F2431 using some of the available Motion Feedback modules?

    Your advice and direction would be greatly appreciated.

    Cheers
    Barry
    VK2XBP

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Hi Barry,
    Either is fine - whatever works....
    Since you're only looking for velocity and not position (right?) you could either use the motion feedback module in Velocity Mode (something I've never done myself) or use a standard timer/counter as outlined earlier.

    As for the timer interrupt... A neat feature of the PCPWM module is that you can use IT (or rather its timer) to generate an interrupt every Nth PWM cycle. That's what the PostScale setting is for. But the available post scale ratios are limited so if your PWM frequency is high and you're looking for a low(ish) interrupt frequency it might not be the best to use.

    Again, either works.

    What's the lowest speed you expect to run the motor at?

    /Henrik.

  7. #7
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: incPID Routine - Help Needed

    Thanks for the feedback Henrik.

    The PCPWM frequency is 8kHz and I would like to be able to slow the motor down to 60rpm (1 revolution per second) if possible. This would allow me to perform threading operations on my lathe at a safe speed (the ultimate use for this project is to re-power my 9x20 lathe).

    I also need a way of determining and displaying the rotational speed. I know this is possible by manipulating the data from the counter/timer but would it be simpler to use the period measurement function (input capture mode) of the Motion Feedback Module on the 18F2431? Have you, or any of the other forum members, had any experience using the period measurement function?

    Cheers
    Barry
    VK2XBP

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts