Finished, working, PIC PID controller: Open Source and Kits

Results 1 to 2 of 2

Thread: Finished, working, PIC PID controller: Open Source and Kits

  1. #1
    Registered James Newton's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    1397
    Downloads
    0
    Uploads
    0

    Default Finished, working, PIC PID controller: Open Source and Kits

    The BOB PID is a very low cost, but quite capable, PID servo controller.

    Serial and step / direction inputs.
    - The serial interface, via any TTL to USB adapter, allows for easy tuning of the P.I.D. constants and setting options like the polarity of the output direction signal. It also supports a bootloader for future firmware updates and new abilities / optimisation.
    - The step / direction input allows its use in any application where a standard servo driver was intended. There is a Pololu adapter cable to make plugging it into a RAMPS / GRBL or pretty much any other motion controller very easy.

    Position input comes from a standard quadrature type position encoder connected to the motor shaft. Up to 73,000 edges per second or 18,000 lines per second are supported with the current 0.93 firmware. That supports up to 1,100 RPM with a 1000 line (4k quad) encoder, or well over 10,000 RPM with our 360 quad ENC1.

    The output is PWM speed and direction suitable for any standard "H-Bridge" motor driver.

    All the details are here:

    techref.massmind.org/techref/io/SERVO/BOBPID.htm


    Source code is here:
    https://github.com/JamesNewton/BOBPID

    Couple of videos of it working:

    Small DC motor with HID encoder run by BOB PID



    Large DC motor with ENC1 run with BOB PID from RAMPS/Marlin.


    Similar Threads:
    Last edited by James Newton; 07-10-2016 at 08:45 PM. Reason: Forgot to add the videos.
    James hosts the single best wiki page about motors for CNC hobbyists on the net:
    http://techref.massmind.org/techref/io/motors.htm Disagree? Tell him what's missing! ,o)


  2. #2
    Registered James Newton's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    1397
    Downloads
    0
    Uploads
    0

    Default Re: Finished, working, PIC PID controller: Open Source and Kits

    A customer tells me he has a motor driver that needs two separate PWM inputs... one telling the motor to go forward, and another telling it to go backwards. I've never heard of such a thing! Has anyone else seen that?

    If so, the BOB PIC firmware should be able to support it as follows (Note: this code is NOT tested):

    The P1C signal from the PIC on pin RC3 comes out to the A axis Direction line on the BOB PCB, so that can provide the second PWM output.

    In
    github.com/JamesNewton/BOBPID/blob/master/main.c

    Update SetPWM to add the following to the start.

    Code:
    if (MOTOR_DIRECTION) { // could also use if (PIDOutput > 0) {
    	PSTRCONbits.STRC = 1;	//drive the output to A DIR, RC3, P1C
    	PSTRCONbits.STRD = 0;	//NOT to P1D, RC2
    	}
    else {
    	PSTRCONbits.STRD = 1;	//steer the output to P1D, RC2
    	PSTRCONbits.STRC = 0;	//NOT to A DIR, RC3, P1C
    	}
    In the main setup code, you will need to tris (tristate) RC3 as an output. Right after:
    Code:
    	TRISCbits.TRISC2 = 0;	// Set pin C2 1=input / 0=output motor PWM
    Add:
    Code:
    	TRISCbits.TRISC3 = 0;	// Set pin C3 1=input / 0=output motor PWM2
    If anyone needs that, I can add it fairly easily.

    James hosts the single best wiki page about motors for CNC hobbyists on the net:
    http://techref.massmind.org/techref/io/motors.htm Disagree? Tell him what's missing! ,o)


Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Finished, working, PIC PID controller: Open Source and Kits

Finished, working, PIC PID controller: Open Source and Kits