HPWM Motor Control


Closed Thread
Results 1 to 8 of 8
  1. #1
    hughgoodbody's Avatar
    hughgoodbody Guest

    Default HPWM Motor Control

    I am using the two HPWM channels of a PIC 18F452, one to control a motor and one to control a proportional solenoid. The HPWM motor control is new to the circuit. I have been operating the solenoid from HPWM and it works fine. Having just added the motor to the other channel it seems to affect the solenoid.

    The motor speed is to change when a pot is adjusted and the solenoid should only adjust by small amounts in relation to a temperature. However as the pot is adjusted, the solenoid seems to open and shut erratically, and it should remain at a constant position. Both motor and solenoid have suitable flyback diodes installed.

    Is there any reason for this? Is it a hardware or software problem. I would be most greatful for any insight into this.

    hugh

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    mmm, could be hardware and software... my assumption is hardware first.

    Can you provide any schematics ?!?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Hugh,

    H>>However as the pot is adjusted, the solenoid seems to open and shut erratically, and it should remain at a constant position. Both motor and solenoid have suitable flyback diodes installed.<<

    I agree with Steve... I place my bet on hardware...this pot you are talking about... Can you verify it is a linear pot that is not erratic itself to some degree? Dirt etc will cause erraticness. Can you post a schematic?

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  4. #4
    hughgoodbody's Avatar
    hughgoodbody Guest


    Did you find this post helpful? Yes | No

    Default

    The pot is linear yes. When only one HPWM channel is used, the system works fine ie. as the pot is adjusted the motor speed increases as expected, likewise, if the motor is disconnected the solenoid works fine. But as soon as both are required to function together that is when it messes up.

    It seems as though the Duty variable that is being sent to the motor is also being sent to the solenoid, but the solenoid has a completely seperate duty value of its own.

    I shall try and post a schematic.

    Hugh

  5. #5
    hughgoodbody's Avatar
    hughgoodbody Guest


    Did you find this post helpful? Yes | No

    Default Attached Schematic

    I enclose an attached schematic of the circuit i am using.

    Below is some of the code i am using:

    The following are the declarations for the set up:

    Device 18F452
    XTAl = 20

    'CCP Module configuration for HPWM
    DECLARE CCP1_Pin PortC.2 'HPWM Set up for Channel1
    DECLARE CCP2_Pin PortC.1 'HPWM Set up for Channel2

    To output the PWM I am using:

    HPWM 2, Alpha, 1250
    HPWM 1, Bravo, 1250

    Where alpha and bravo are declared variables.

    I am also using an AD converter on port A, using the FRC oscillator, could this be interfering with the CCP module?

    I look forward to hearing any suggestions
    Attached Images Attached Images  

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    5 volts / 100 ohm= 50ma. Max Io=25ma. What about if you change your resistor to lets say 200-300 ohms? Case you can't change the resistor value, you can insert a buffer between PIC and MOSFET and see if there's any difference.

    Can also be caused by a sorta ground loop.

    BTW, if you remove all the sourounded stuff (MOSFET, MOTOR,SOLENOID) and monitor your output of the PIC with a scope, do you have great results ?

    Can you post your whole code?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    obewan's Avatar
    obewan Guest


    Did you find this post helpful? Yes | No

    Default

    As Steve said,increase the 100 ohm resistors to 330 or 470
    allso add 22k resistors between gate and ground.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Is the main supply line and 5 volt stay clean and at the same voltage when motor/solenoid are needed.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  4. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 03:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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