Shop OBEX P1 Docs P2 Docs Learn Events
Motion control — Parallax Forums

Motion control

edited 2014-02-12 06:35 in Robotics
At this moment we have a motion control PCB powered by 5V and some inputs for HCT logic. Can we use the 5V of our PCB to power the Propeller Mini board on the 5V output (without blowing up the LM2937-5.0)? Are the I/O's of the Propeller 5V tolerant?

To be more clear... At this moment we control a Maxon-RE35 servo motor with a HEDS5540 shaft encoder by xPC (Matlab/Simulink) equipped with two PCI-boards.

The planning is:

1. First to use the Propeller Mini as a transparent interface for the H-bridge an the shaft encoder to the xPC target (on command base over RS232) for system indentification.

2. Second to integrate the found control algorithm (speed, position and cascade) in te Propeller Mini.

Regards...
Wijnand

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-10-24 13:34
    The Propeller I/O pins need current limiting resistors when used with 5V logic. I usually use 10K resistors on 5V lines but anything above 3K should be fine.

    Most 5V devices will use 3.3V logic signals without a problem. There are lots of exceptions to this. You may need some sort of level shifter if the Prop is going to be controlling 5V devices. I've only had to do this a few times myself usually the 3.3V logic works fine.

    I bet you'd be fine powering the Propeller Mini from your other board. I've got a Propeller board in front of me running on four cogs and with few LEDs. The board is drawing 100mA of current. The amount of current the Propeller pulls will depend a lot on how many cogs are active, how fast it's running, and what you have connected to it drawing additional current (LEDs, etc.).
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2013-10-24 13:35
    Hello Fontys ME Venlo NL,

    You must be one of our instructors from last week's course in Utrecht, Netherlands. Welcome to the Parallax forums!

    Ken Gracey

    Utrecht3.jpg
    1024 x 768 - 109K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-10-24 13:36
    Welcome to the Forum!

    I would apply the +5V to Vin just to be on the safe side. It will have to go through the 5V regulator, but it's of the low-dropout variety, so the +5V won't get reduced by much. Besides, the Prop Mini does not use 5V; it's reregulated down to +3.3V.

    As to 5V tolerance on the Propeller pins, no, they're not. (Search the forum for this topic: you'll find plenty.) But your device's 'HCT inputs will work just fine with 3.3V logic.

    -Phil
  • edited 2013-10-24 13:51
    Thanks... Yes Ken, the guy with the white t-shirt looking to the camera.

    Regards...
    Wijnand
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2013-10-24 14:33
    Thanks... Yes Ken, the guy with the white t-shirt looking to the camera.

    Regards...
    Wijnand

    Now that you point yourself out it appears this is your photo. You are the only person looking at the camera!

    And of course we're in contact via e-mail as well. Do let us know if you need any specific support.

    Ken Gracey
  • edited 2013-12-01 04:51
    First: the person "Fontys ME Venlo NL" (university) is the same as "w.nijs@alf4all.demon.nl" (privat). Maybe it is somewhat confusing, but it is the result of mixing your work with personal interest.

    The steps to make the project working are:

    1. Realize a Command Line Interpreter that makes it possible to communicate via a serial (uart) interface (cable or wireless) on string basic with Labview, MatMatlab/Simulink.or another remote system. The command string contains a command (i.e. DRV) with 0..n params. The params are also strings representing any kind of type (int, float). Its the task of the specific command function to convert the string to used types.

    2. Realize the software to control the output. Possible power electronics are H-bridge (PWM and direction) or amplifiers with a analog input.

    3. Realize the software for the feedback comming from an incremental shaft encoder.

    4. Realize a realtime log facility to analyse the respons of the open system

    5. Put 1..4 together to make system indentification possible in Labview or Matlab/Simulink (or other system)

    6. Realize the software for a PID controller with remote setup posibilities for Kp, Ki and Kd

    7. Put 5 and 6 together to make system verification possible in Labview or Matlab/Simulink (or other system)

    Regards...
    Wijnand
  • edited 2013-12-02 14:04
    The Command Line Interpreter works. Maybe someone has a nicer idee, let me know.
    /*********************************************************************
     * Include section
    *  Add all #includes here
    *********************************************************************/
    
    #include "simpletools.h"                      // Include simpletools
    #include "abdrive.h"
    
    #include "cli.h"
    
    
    /*********************************************************************
    * Type definition section
    *  Add all type definitions here
    *********************************************************************/
    
    struct cmdcase {
       char*        string;
       void        (*func)();
    };
      
    
    /*********************************************************************
    * Globals
    *********************************************************************/
    
    extern fdserial *term;  // declared in main
      
    
    /*********************************************************************
    * Command function section
    *  Add all command functions here
    *********************************************************************/
      
    /*****************************************************************//**
    * \brief    FuncAdd
    *
    * This command function add the two params.
    *
    * \author   W.Nijs.
    * \date     01/12/2013
    * \param    
    * \param    
    *********************************************************************/
      
    void FuncAdd(char* param1, char* param2) {
       int i,j;
      
       i = atoi(param1);
       j = atoi(param2);
       dprint(term, "%d + %d = %d\n", i, j, (i+j)); // debug
    };
      
      
    /*****************************************************************//**
    * \brief    FuncSub
    *
    * This command function subtrackt the two params
    *
    * \author   W.Nijs.
    * \date     01/12/2013
    * \param    
    * \param    
    *********************************************************************/
     
    void FuncSub(char* param1, char* param2) {
       int i,j;
      
       i = atoi(param1);
       j = atoi(param2);
       dprint(term, "%d - %d = %d\n", i, j, (i-j)); // debug
    };
     
    
    /*****************************************************************//**
    * \brief    FuncDrv
    *
    * This command function drives the two ActivityBot motors
    *
    * \author   W.Nijs.
    * \date     01/12/2013
    * \param    
    * \param    
    *********************************************************************/
    
    void FuncDrv(char* param1, char* param2) {
       int i,j;
    
       i = atoi(param1);
       j = atoi(param2);
       drive_goto(i, j);
    };
    
    
    /*********************************************************************
    * Command lookup table
    *  Add all tokens and functions here
    *********************************************************************/
    
    struct cmdcase cases[] = {
       {"add", &FuncAdd},
       {"sub", &FuncSub},
       {"drv", &FuncDrv}
    };
      
    
    /*****************************************************************//**
    * \brief    CliSwitch
    *
    * This function splits the command line in a command and 0..2 params
    * and calls the concerning function. 
    *
    * \author   W.Nijs.
    * \date     01/12/2013
    * \param    command_line    pointer to the command line
    *********************************************************************/
    
    void CliSwitch (char* command_line) {
    
       struct cmdcase* index;
       char *cmd, *param1, *param2;
    
       cmd    = strtok(command_line," ");    // split command from command line
    
       param1 = strtok(NULL," ");            // split param1 from command line
       param2 = strtok(NULL," ");            // split param2 from command line
    
       // lookup and call the function with pointers to the params
    
       for (index = cases; index != (cases + sizeof(cases)/sizeof(cases[0])); index++) {
         if (0==strcmp(index->string, cmd)) {
           (*index->func)(param1, param2);
           break;
         }
       }
    }
    

    The third function is used to control the ActivityBot from the course. Next I wil test it with bluetooth.

    Regards...
  • edited 2014-02-12 06:35
    control.jpg
    Our motion control lab set-up with a H-bridge PWM controlled Maxon RE35 servo, a HEDS5540 incremental shaftencoder and of course the Propeller (Mini). The Command Line Interpreter (with Labview, not yet with xPC) and the PWM and direction control of the H-bridge works fine. Only the shaftencoder (500 pulses/r at 6000rpm -> 200000 events/sec) is a problem. I found different incremental encoder solutions in this forum but in assembly or spin.Has somebody a nice solution in propeller C for two encoders?
    Regards...
    Wijnand
    400 x 491 - 82K
Sign In or Register to comment.