Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: Weired torque senor reading

  1. #1
    Junior Member
    Join Date
    May 2017
    Posts
    4

    Weired torque senor reading

    Hello folks,

    We are using a torque senor (TRT-500, reaction torque sensor) to measure the torque produced from our motorized knee exoskeleton. Our motor system uses maxon motor and gearbox and is coupled with external bevel gears. We are now just testing its system response. The motor system is controlled using the current controller mode of maxon motor drive board (ESCON 50/5). We are using Teesy 3.2 as our microcontroller.

    Now one task is that we are commanding the motor system to produce 2A current that is equivalent to 10Nm torque (based on our setup) at a fixed position. The reading from torque sensor is 10Nm when the microcontroller sent the instant command of 2A current to the motor system. The strangest thing is that the reading from torque sensor would be only 6Nm when the microcontroll send the command that ramps up the current to 2A in a short time (lets say in 1 second). This problem has been consistent. It happens to the other torque levels as well. We checked that the current to drive the motor is same during the instant case and ramping case.

    We are bothered by this issue for a few weeks. Please let us know if you have any ideas. Thank you so much folks.

    The portion of code for instant current and ramping current are as below.
    Code:
    if (option_motor == 'instant current') {      
          allprintln("\n\nYou selected send one current command...");
          allprint("Enter Torque (in Nm) you want to apply: ");
          while ((!Serial.available()) && (!BLE.available())) {}
          digitalWrite(onoff, LOW); analogWrite(motor, midpoint);
          float torqs = 0.0;
          update_float(torqs);
          allprintln(torqs);
          float bits_to_write = map((torqs/(0.0136*3*51*1.4)), -5.00, 5.00, 0.0, 4096.0); //##** if change from -5 to 5 change the -7,7 here   ... 1.0 value is efficiency.... dunno if we need it
          allprintln(bits_to_write);
          int bits_written = int(bits_to_write);
          if (bits_written > 4096) {
            bits_written = 4096;
          }
          else if (bits_written < 0) {
            bits_written = 0;
          }
          float volts_written = map(float(bits_to_write), 0., 4096., 0.0, 3.3);
          float current_written = map(volts_written, 0, 3.3, -5.00, 5.00);  //##** if change from -5 to 5 change the -7,7 here
          allprint(bits_written); allprint(", "); allprint(volts_written); allprint("V, "); allprint(current_written); allprintln("A");
          digitalWrite(onoff, HIGH);
          unsigned long timer_test = millis();
          analogWrite(motor, bits_written);
          while (entry != STOP) {
            if (millis() - timer_test > print_freq) {
              float current = map(float(bits_written), 0.0, 4096.0, -5.00, 5.00);
      //        allprint(x); allprint("\t");
              allprint(current);// * .0136 * 3*51); 
              allprint("\t"); allprint(read_torq(torq_pin));
              allprint("\t"); allprintln(motor_angle*motor_angle_conversion);
              timer_test = millis();
            }
            update_char(entry);  //update entry value
            //
          }
        }
    
        if (option_motor == 'raming current') {
          allprintln("\n\nYou selected ramp up to current command...");
          allprint("Enter Torque (in Nm) you want to apply: ");
          while ((!Serial.available()) && (!BLE.available())) {}
          digitalWrite(onoff, LOW); analogWrite(motor, midpoint);
          float torqs = 0.0;
          update_float(torqs);
          allprintln(torqs);
          float bits_to_write = map((torqs/(0.0136*3*51*1.4)), -5.00, 5.00, 0.0, 4096.0); //##** if change from -5 to 5 change the -7,7 here   ... 1.0 value is efficiency.... dunno if we need it
          int bits_written = int(bits_to_write);
          if (bits_written > 4096) {
            bits_written = 4096;
          }
          else if (bits_written < 0) {
            bits_written = 0;
          }
          float volts_written = map(bits_to_write, 0, 4096, 0.0, 3.3);
          float current_written = map(volts_written, 0, 3.3, -5.00, 5.00);  //##** if change from -5 to 5 change the -7,7 here
          allprint(bits_written); allprint(", "); allprint(volts_written); allprint("V, "); allprint(current_written); allprintln("A");
          digitalWrite(onoff, HIGH);
          unsigned long timer_test = millis();
          int x = midpoint;
          
          while (entry != STOP) {  
            delay(1); //delayMicroseconds(75);
            analogWrite(motor, x);  
            if (x < bits_written) {
              x++;
            }
            else if (x > bits_written) {
              x--;
            }
            //for printing torq and testing
      //      allprint("\nTorq (N/m)"); allprint("\t"); allprintln("Angular Velocity (deg/s)"); 
            if (millis() - timer_test > print_freq) {
              float current = map(float(x), 0.0, 4096.0, -5.00, 5.00);
      //        allprint(x); allprint("\t");
              allprint(current);// * .0136 * 3*51); 
              allprint("\t"); allprint(read_torq(torq_pin));
              allprint("\t"); allprintln(motor_angle*motor_angle_conversion);
              timer_test = millis();
            }
            update_char(entry);  //update entry value
            //
          }
        }
    Attached Files Attached Files

Posting Permissions

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