603,311 active members*
2,121 visitors online*
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > Open Source Controller Boards > Finished, working, PIC PID controller: Open Source and Kits
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    1397

    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
    https://youtu.be/TjflUkI--Sw


    Large DC motor with ENC1 run with BOB PID from RAMPS/Marlin.
    https://youtu.be/rnwYqGB3bXw
    James hosts the single best wiki page about steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

  2. #2
    Join Date
    May 2005
    Posts
    1397

    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 steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

Similar Threads

  1. WORKING: Non-contact encoder / PID controller. Open Source. Kits available.
    By James Newton in forum Open Source Controller Boards
    Replies: 1
    Last Post: 06-04-2016, 02:01 AM
  2. Open Source - Welded VS Extrusion kits?
    By Litemover in forum Open Source CNC Machine Designs
    Replies: 8
    Last Post: 07-01-2012, 11:45 PM
  3. Working on a new open source 3D CAM program
    By galacticroot in forum OpenSource Software
    Replies: 25
    Last Post: 11-19-2007, 03:28 PM
  4. Open Source CNC Controller Specification
    By gregmary in forum DIY CNC Router Table Machines
    Replies: 28
    Last Post: 12-05-2005, 04:58 AM
  5. BEST Open source Controller ?
    By Seventeen in forum Open Source Controller Boards
    Replies: 12
    Last Post: 09-22-2005, 12:27 AM

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
  •