Giter Club home page Giter Club logo

usteppers's Introduction

uStepper S

The library contains support for driving the stepper, reading out encoder data. A few examples are included to show the functionality of the library. The library is supported and tested with in Arduino IDE 1.8.11.

For more information, visit www.ustepper.com

!! EEPROM Usage information !!

Please be aware that the uStepper uses the EEPROM to store settings related to the Dropin application. If you are not using this, then this has no impact for your application, and you can ignore this section !

EEPROM address 0 to 15 contains the different settings for dropin. If your application uses the EEPROM, Please use another location than these !

Installation

Installation is split into two parts - Hardware and Library. Both are required to use the uStepper S boards.

Hardware Installation

Instructions for users with the hardware for the original uStepper (the one before S and S lite) installed

To add hardware support for uStepper in the Arduino IDE (1.8.8+) do the following:

  • Open Arduino
  • Go to "Tools->Board->Boards Manager..."
  • Search for "uStepper"
  • Choose the "uStepper" board and press "Remove" button
  • close the Boards Manager
  • Go to "File->preferences"
  • Almost at the bottom there is a field stating: "Additional Boards Manager URLs" replace your currently inserted uStepper URL this URL: https://raw.githubusercontent.com/uStepper/uStepperHardware/master/package_ustepper_index.json
  • Press OK
  • Go to "Tools->Board->Boards Manager..."
  • Go to the bottom (after it has loaded new files) select "uStepper by ON Development IVS" and press install

Instructions for users new to uStepper

To add hardware support for uStepper in the Arduino IDE (1.8.8+) do the following:

You have now added uStepper hardware support and should be able to select uStepper under tools -> boards.

Library Installation

To add the uStepper S library do the following:

  • Open Arduino IDE (Version 1.8.8 or above)
  • Go to "Sketch->Include Library->Manage Libraries..."
  • Search for "uStepper S"
  • Select "uStepper S" and press install
  • Close Library Manager

Documentation

The documentation for this library can be found at the following URL:

http://ustepper.com/docs/usteppers/html/index.html

MAC (and a few Windows) Users:

In order to make the uStepper S show up in the "ports" list, you need to install the VCP driver from the following link: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Known bugs

  • does not properly release motor in dropin mode

Change Log

2.3.2:

  • added new python control example
  • fixed encoder stall examples
  • removed debug setup of pin on portB as output

2.3.1:

  • added 6 new examples

2.3.0:

  • Changed Servo library (uStepperServo.cpp) to use timer PWM instead of polling to control servo motors.
  • Changed the servo library example to use the new servo implementation.
  • Changed the 'stop' method at the uStepperS.cpp to wait until the motor realy stops movement. Thanks to Daniel-Walther for pointing it out.

2.2.1:

  • Added timeout to homing function

2.2.0:

  • Added function to get current driver speed in RPM (getDriverRPM())
  • Fixed "getVelocity()" method of "uStepperDriver" class to use correct twos complement conversion
  • Updated keywords
  • Added two new examples:
    • GYROBalance: Example on how to use MPU6050 IMU with uStepper S
    • SWiFiGUI: Example sketch to control the uStepper S with browser based GUI over WiFi

2.1.0:

  • Fixed checkOrientation to work with Closed loop and dropin modes
  • Fixed stallguard feature
  • Modified examples to library update

2.0.0:

  • Changed name of "brake()" function in uStepper Class to "setBrakeMode()"
  • Implemented "setBrakeMode()" function in uStepper Class to choose between freewheel, braking with low side fets shorted and brake with specified hold current. default = brake with low side fets shorted
  • "setHome" argument of ustepper class "setup" function is now used
  • Implemented "checkOrientation()" function in uStepper Class, to check the orientation of the motor cable, and invert direction if needed.
  • Added 3 moves in "checkOrientation()" function in uStepper Class, to check orientation instead of just 1
  • Removed check for motor cable orientation from "setup()" function in uStepper Class. Users actively needs to call the "checkOrientation" function from uStepper Class, if they need this feature, AFTER calling the "setup()" function
  • Disabled driver on MCU reset while setting up, to avoid the motor spinning on startup if power was removed during motor movement
  • Moved the absolute position counter into the encoder getangle function
  • Added a LP filter on the absolute position data in the encoder function (so, getAngleMoved is filtered)
  • Stall detection removed from timer1
  • Variable filter depending on mode set in setup routine
  • Removed obsolete things in setup routine and timer1
  • Made new velocity measurement for encoder values
  • Made the control threshold for closed loop control variable and intrduced a function for editing it
  • Changed timer1 interrupt frequency to 2KhZ for all other modes than DROPIN
  • Added option to choose how long the "checkOrientation()" function in UstepperS class should move during check
  • Renamed "PID" to "CLOSEDLOOP" to avoid confusing the closed loop position mode with a PID controller. PID keyword is stall accepted for backwards compatibility

1.0.1:

  • Fixed bug in functions to set acceleration and deceleration
  • moved a couple of functions in uStepperDriver.h from public to protected section of class
  • added documentation

1.0.0:

  • Bug fixes
  • New Dropin PID code
  • Added dropin CLI interface
  • Fixed stall detection, and added user sensitivity parameter

0.1.1:

  • Bug fixes

0.1.0:

  • Initial release

Creative Commons License
uStepper by ON Development is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

usteppers's People

Contributors

arantius avatar greyltc avatar lmdhans avatar solidgeek avatar thomasholsen avatar thomassensade avatar ustepperold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usteppers's Issues

Motor holding will sometimes turn off after stepping

Sometimes after stepping forward a few times, the hold will click off then come back on and get into a state where it toggles until the usteper is restarted. Do you know what might be causing this? Here is my code:

#include <uStepperS.h>
  
  uStepperS stepper;
  
  int angle = 10;
  int angles[] = {360, 180, 120, 90, 72, 60, 45, 40, 36, 30, 24, 20, 18, 15, 12, 10, 9, 8, 6, 5, 4, 3, 2, 1};
  int cmd;
  int angle_index = 15;
  
  void setup() {
    stepper.setup(NORMAL,200,0,0,0,16,false, 0,80,80);
    stepper.setMaxAcceleration(5);
    stepper.setMaxVelocity(250);
    stepper.setBrakeMode(FREEWHEELBRAKE);
    Serial.begin(9600);
  }
  
  void loop() {
    if (Serial.available() > 0) {
      cmd = Serial.read() - '0';
      
      switch(cmd){
        case 0:
          stepper.setBrakeMode(HARDBRAKE, 80);
          while(stepper.getMotorState()== 1);
          Serial.write(6);
          break;
        case 1:
          stepper.moveAngle(angle);
          stepper.setBrakeMode(HARDBRAKE, 80);
          while(stepper.getMotorState()== 1);
          Serial.write(6);
          break;
        case 2:
          stepper.moveAngle(-angle);
          stepper.setBrakeMode(HARDBRAKE, 80);
          while(stepper.getMotorState()==1);
          Serial.write(6);
          break; 
        case 3:
          stepper.stop();
          stepper.setBrakeMode(FREEWHEELBRAKE);
          break;
        case 4:
          if (angle_index == 23){
            angle_index = 0;
          }
          if (angle_index < 23){
            angle_index = angle_index + 1;
          }
          angle = angles[angle_index];
          break;
        case 5:
          if (angle_index == 0){
            angle_index = 23;
          }
          if (angle_index >  0){
            angle_index = angle_index - 1;
          }
          angle = angles[angle_index];
          break;
      }
    }
  }

moveAngle v moveToAngle

Hi,

In the class list for the uStepper S there is both moveAngle and moveToAngle.
The descriptions for the two are identical, however the code is not.

Am i right that moveAngle is relative while moveToAngle is absolute based on the initiation of PID and using setHome?

Thanks

USB Communication with HOST PC

Hi! I am using uStepperS instead of an Arduino Uno + PWM Motor. The uStepperS should
receive informations via USB 115.200 Baud. When I start the communication between uStepper and PC Software,
it does a reset on the uStepper. With Arduino Uno, everything works fine. Is for the ustepper another commonication library needed?
As far as I noticed, the uStepperS uses mostly the same CPU as Arduino Uno? (Atmega328)
Pins D0 and D1 are not in use because of RX0/TX0 (USB).
I also have noticed, the uStepper uses a Atmega328PB, which is a bit different...
Thanks for your support! Have a nice sunday evening ;)

Can't get interrupts to work

Hi all,

i am trying to attach a mechanical kill-switch (pulldown) to my setup in order to stop the motor in case my 'platform crashes into an object'.

The code works with an arduino but sadly not with the uStepperS. The digital pin itself works so I guess there is a problem with the interrupts..

Can somebody help :)?

Here is the code:

// Code used to test a kill-switch (pulldown configuration - with an external 10k resistor and the +5V source) with uStepperS
 

//include libraries
#include <math.h>

//Stop-switches definitions
#define stopSwPin 3 // pin with interrupt


//global variables
volatile int stopMove=0;        //stop-switch output
void stop_isr();
void waitForSerial();

//runs once
void setup() {
  Serial.begin(115200); //115200 is baud rate of serial comm

  //setup stop switches
  pinMode(stopSwPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(stopSwPin),stop_isr,RISING);
  stopMove=0;
}

//runs forever
void loop() {

  int i,input_char;

  Serial.println("\nStart test switches? [y/n]");
  waitForSerial();
  
  for(i=0; i<5; i++){

    //check if stop switch was pressed
    if(stopMove==HIGH){
      Serial.println("MOTOR STOPPED");
      break;
    }
    
    }

    Serial.println("\nContinue to next test? [y/n]");
    waitForSerial();

}

//functions

void waitForSerial(){
  char input_char;
  
  while(Serial.available()==0);
  do{
    input_char= (char)Serial.read();
  }
  while(input_char!='y');
}

//stop switch interrupt handler
void stop_isr(){ //keep this function small!
 
  stopMove=HIGH;

}

Help walk me through setting up Ustepper S with 3D printer

Hoping for a walkthrough for using uStepper S boards on the X and Y of a 3D printer.

I'm a beginner. From info on the website, I think right now I have a PID problem. But I don't know how to determine or why to change either of those 3 variables.

I first tried the stock dropin example sketch that had P-75, I-7, D-1 (why is it higher than suggested PIDs elsewhere?)

I changed it to P-0.5, I-0.5, D-0 like the uStepper S product sheet said to try. That doesn't work either.

I don't know where to go from here because I have no idea how to determine what to change them to or why I'm changing them.

I think I set the hardware up correctly according to instructions and I have the latest board and library installed in Arduino IDE 1.8.1.2. I have an SKR V1.4 Turbo printer board with Marlin 2.0.5.2 firmware that was setup and working well. I commented out the drivers for the X and Y axis so it uses default settings for drivers and I can just run enable, step, dir, and ground pins from the driver sockets in the board up to the uStepperS.

I've attempted to print a calibration square. Shifts happen every time the direction is changed. Normal behavior for my printer without uStepper is maybe once in 100 layers a single noticeable shift happens. This behaviour would be like a continuous shift that never stops shifting and each new layer starts farther up and to the right of the layer before it.

If I take motor off of printer and just run the motor with uStepperS, any time I change direction, it'll end up as much as 90 degrees off. Once I've gone one direction long enough it will consistently always advance the way it should, but if I switch directions again, it's going to get thrown off. There's lots of sudden accelerations, screeching, and knocking in the motor.

No hard stop

I'm working on implementing my own limit switches, andI might be missing something, but I can't reliably achieve a full hard stop.

uStepper::stop() still does a ramp down. At the moment, I'm trying to use something like this:

void stop() {
  stepper.driver.reset();
  delay(1000);
  stepper.setup(NORMAL, STEPS_PER_REVOLUTION);
  stepper.setMaxAcceleration(MAX_ACCELERATION);
  stepper.setMaxVelocity(MAX_VELOCITY);
  delay(1000);
}

But if this happens in the middle of a very long move, when stepper.setup(...) is called, it tries to finish the move it was originally in. If I can reset the current ramp profile, then maybe that will help the reset process?

Or if I'm way off base and there's a simple single line function to call to stop, then can someone point me in that direction?

i2C example - Grove-LCD display (RGB Backlight)?

Hi all,

did someone get the I2C ports SDA1 and SCL1 (Digital pins D7 & D8) of the uStepperS up running? I tried to connect a grove-LCD display (RGB Backlight) but it did not work so far.

The examples of the grove library did not work and I also tried without success to detect the I2C ports in general with the i2c_scanner from the arduino uno examples (with and without the pins connected, code see below)

The scanner uses the wire library. Does someone knows if this should work in principle or is there more hard stuff necessary to get it running?

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>

void setup() {
  Wire.begin();

  Serial.begin(9600);
  while (!Serial); // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}

void loop() {
  int nDevices = 0;

  Serial.println("Scanning...");

  for (byte address = 1; address < 127; ++address) {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    byte error = Wire.endTransmission();

    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.print(address, HEX);
      Serial.println("  !");

      ++nDevices;
    } else if (error == 4) {
      Serial.print("Unknown error at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  } else {
    Serial.println("done\n");
  }
  delay(5000); // Wait 5 seconds for next scan
}

uStepperS::setup()'s "setHome" parameter appears to do nothing

Looking in uStepperS.cpp, I can see encoder.setHome() is called twice during setup() (on first glance it seems to be being used to determine which direction to set the driver's direction to), regardless of the value of the bool parameter setHome. It appears that the setHome is actually not used anywhere at all.

One may want to use the encoder to receive absolute angles, and therefore wish to prevent encoder's setHome() function from being called by setting the value of setHome in setup() accordingly.

If I've understood the library correctly from my brief look, I suggest changing setup() to call encoder.getAngle() twice to determine the direction to set for the driver (instead of calling encoder.setHome() at the start of setup() and then using encoder.getAngleMoved()). The final call to encoder.setHome() will then only occur if setup() has been called with the setHome parameter as true. This should preserve current behaviour while adding the option to leave the encoder as absolute.

(As an aside, thanks for open-sourcing and I have to say I appreciate how easy it is to skim through the uStepper code and understand the structure of what appears to be going on.)

Add board footprint

Hello,
I am developing a shield for the uStepper S that adds bluetooth functionality. It would be very helpful to have a complete, dimensioned footprint of the uStepper S and uStepper S-Lite (if there's any difference, e.g. reset button placement) to properly align the headers on my shield.

As it stands, the only information I can find is the overall size and hole placement (41.8mm and 36mm, respectively).

Information about the three headers is necessary. For folks integrating enclosures, the button and power/USB port placements would also be helpful.

Thank you!

Update readme

The readme says to follow the original documentation which talks about the ftdichip vcp. uStepper S uses the Silicon Labs VCP. It might save someone else 10 minutes why the port doesn't show up in the Arduino environment. ;-)

Reading encoder data

Hello, i'm working on my research and this board is exactly what i need, but i have a specific need, read the data used in PID controller on another board. I don't need write data, only read to control a second code, running in another microcontroller, using the output error, this is possible? how?

VCP driver for Windows 10

Hi,
I'm trying to help my friend set up the uStepper S environment on Windows 10, but when I plug in the usb on it, Windows 10 is not creating a virtual com port.

Which Virtual COM port driver do i need to install for the devices to appear in the Aurdino IDE?

Thanks,
Greg

Random jerking on startup.

Hi

good day, one day to another upon booting up my marlin based printer the ustepper for a single axis has begun behaving erratically.

I have altered the PID parameters, setup in dropin mode and values for P ,I , D are 0.1 ,0,1 and 0 respectively.

This minimizes the random jerking motions intensity however still randomly jerks back and forth.

I have read in previous posts that reducing the holding and driving motor current percentages below 50 % might help solve, but no change has been witnessed.

As it has only occurred on a single motor (x axis) with equivalent code as the y axis. I am suspecting the ustepper may be defective.

I have also checked that the magnet sits flush on the surface of the stepper motor

Please instruct me how to proceed

SetHome - is my requirement possible

Hi,

I am new to the ustepper and ustepper library.

I am building a camera slider on a linear belt driven rail using a nema 23 and a ustepperS

I want to create a homing routing that does the following (can be on each reset - no need to store long term)

On power on;

move the gantry CW and detect "home" position and set this as "0" steps
move the gantry CCW and detect "end" position and set this as "nSteps" from home.

I want this to be in steps rather than degrees (although I could divide degrees by step angle if needed)

Is the above possible with the ustepper library?

Thanks

Microstep settings

Hi,
I hope you're doing well!
I can't find a way to change the number of microstep per revolution.
Could you help me tp configure to 51200 microsteps
thank you for your help

StallGuard2 support?

It seems like your stall detection implementation here could be improved. Why not make use of the StallGuard2 feature in the TMC5130A? That should be much more robust and performant than what you have now.

[feature requests] hardware reset and interrupt lines

I wonder if in the next hardware revision you make you could tie pin 10 on the TMC driver (VCC_IO) to a pin on the microcontroller (or at least allow it to pull that line down momentarily).

This would allow the microcontroller to properly reset the driver IC. I'm not sure if there's an easy way in the current design to get all the driver's registers into a known state (is there?).

Also, would be great to have SWN_DIAG0 (pin 26) and SWP_DIAG1 (pin 27) from the stepper driver on interrupt enabled pins of the microcontroller!

ShaftOrientiation is not correctly maintained

Shaft orientation is set in the GCONF register of the driver and correctly set in the corresponding function inside uStepperDriver.cpp.

Unfortunately, the bit is not respected and set to zero, as soon as

  • uStepperDriver::enableStealth()
  • uStepperDriver::enableStallguard( int8_t threshold, bool stopOnStall )
  • uStepperDriver::disableStallguard( void )
    are called.

Therefore, in most of my scenarios the result of uStepperS::checkOrientation was not respected.

Best regards.

Analog pins A0 and A2 labels are exchanged (A0 should be A2 and vice versa)

Hi,

on my board I noticed that the analog pins A0 and A2 are exchanged (A0 should be A2 and vice versa). The labels in the product sheet are wrong (also in the schematics) and on the bord. The serial ports SCL0 and SCL1 are labeled right on the other hand.

Maybe this has something to do with the upgrade from ATmega328P to ATmega328PB?

Overflow bug in stepper setup

in uStepperS::setup, there is the line:

this->angleToStep = (float)(this->fullSteps*this->microSteps)/360.0;

by default, microSteps is 256 so if we call setup with stepsPerRevolution equal to anything over 256, the above will overflow.

This is a problem for (as an example) this motor: https://www.omc-stepperonline.com/nema-17-bipolar-09deg-46ncm-651ozin-2a-28v-42x42x48mm-4-wires-17hm19-2004s.html which has 400 steps per revolution.

The code could be corrected to be something like:

this->angleToStep = (float)this->fullSteps * (float)this->microSteps / 360.0

[FR] Support for Marlin 2.0.X Closed-loop controller function?

Are there any plans to expand support for Drop-in/replacement to be compatible with the new Marlin Firmware closed-loop controller functions? At a glance, it does not seem to be too difficult as it only requires the addition of two pins/variables:

#EXTERNAL_CLOSED_LOOP_CONTROLLER

CLOSED_LOOP_ENABLE_PIN -1
CLOSED_LOOP_MOVE_COMPLETE_PIN -1

Changing Hold Current bug

When changing the max current to 80% using:

void setup(void)
{
stepper.setup(PID);
delay(1000);
stepper.setMaxAcceleration(500);
stepper.setMaxVelocity(800);
stepper.setCurrent(80.0);
}

void loop(void){
if(!stepper.getMotorState())
{
delay(500);
stepper.moveToAngle(angle);
angle = -angle;
}

Any value around 70%-100% gives a random jerking. At start, while moving and sometimes at end where the motor stalls and then continues hap-hazardly.

max value according to datasheet is 31. The driver scales the input float and converts to a range of ints 0-31.

Using a stepper motor rated for up to 3A. Also tried w a smaller stepper motor-same issue.

Platform support for vs code platform io

Has there been any work adding support for the ustepper through vscode with platform io.

I know lots of people are using that as their preferred IDE in favor of the rather minimal arduino IDE.

Happy to help look into it, maybe someone is already on to it?

Error compiling Continous.ino / EEPROM / crtatmega328pb.o

Hi uStepper-Team,

my trial to get the uStepperS working failed. I am running Debian 10 GNU/Linux and installed a new Arduino IDE via flatpack /flathub (v1.8.13) and followed the steps to install the uStepperS hard- and software.

Then I downloaded the Continous.ino example which does not compile (see error output below) - I even flashed the bootloader to be sure.

Do you now what might cause the error? Also I am confused with the description of the EEPROM usage - an example-code or link for further information would help.

Thank you very much
LibrEars

Arduino: 1.8.13 (Linux), Board: "uStepperS"



/app/Arduino/arduino-builder -dump-prefs -logger=machine -hardware /app/Arduino/hardware -hardware /home/user/.arduino15/packages -tools /app/Arduino/tools-builder -tools /app/Arduino/hardware/tools/avr -tools /home/user/.arduino15/packages -built-in-libraries /app/Arduino/libraries -libraries /home/user/Arduino/libraries -fqbn=uStepper:avr:uStepperS -vid-pid=10C4_EA60 -ide-version=10813 -build-path /tmp/arduino_build_119629 -warnings=all -build-cache /tmp/arduino_cache_755599 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/app/Arduino/hardware/tools/avr -verbose /home/user/Examples/Continous.ino/Continous/Continous.ino
/app/Arduino/arduino-builder -compile -logger=machine -hardware /app/Arduino/hardware -hardware /home/user/.arduino15/packages -tools /app/Arduino/tools-builder -tools /app/Arduino/hardware/tools/avr -tools /home/user/.arduino15/packages -built-in-libraries /app/Arduino/libraries -libraries /home/user/Arduino/libraries -fqbn=uStepper:avr:uStepperS -vid-pid=10C4_EA60 -ide-version=10813 -build-path /tmp/arduino_build_119629 -warnings=all -build-cache /tmp/arduino_cache_755599 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/app/Arduino/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/app/Arduino/hardware/tools/avr -verbose /home/user/Examples/Continous.ino/Continous/Continous.ino
Using board 'uStepperS' from platform in folder: /home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1
Using core 'arduino' from platform in folder: /app/Arduino/hardware/arduino/avr
Detecting libraries used...
/app/Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_USTEPPER_S -DARDUINO_ARCH_AVR -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/include -D__AVR_DEV_LIB_NAME__=m328pb -I/app/Arduino/hardware/arduino/avr/cores/arduino -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/variants/ustepperS /tmp/arduino_build_119629/sketch/Continous.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for uStepperS.h: [[email protected]]
ResolveLibrary(uStepperS.h)
  -> candidates: [[email protected]]
/app/Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_USTEPPER_S -DARDUINO_ARCH_AVR -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/include -D__AVR_DEV_LIB_NAME__=m328pb -I/app/Arduino/hardware/arduino/avr/cores/arduino -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/variants/ustepperS -I/home/user/Arduino/libraries/uStepper_S/src /tmp/arduino_build_119629/sketch/Continous.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for EEPROM.h: [[email protected] [email protected]]
ResolveLibrary(EEPROM.h)
  -> candidates: [[email protected] [email protected]]
/app/Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_USTEPPER_S -DARDUINO_ARCH_AVR -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/include -D__AVR_DEV_LIB_NAME__=m328pb -I/app/Arduino/hardware/arduino/avr/cores/arduino -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/variants/ustepperS -I/home/user/Arduino/libraries/uStepper_S/src -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM/src /tmp/arduino_build_119629/sketch/Continous.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Using cached library dependencies for file: /home/user/Arduino/libraries/uStepper_S/src/uStepperDriver.cpp
Using cached library dependencies for file: /home/user/Arduino/libraries/uStepper_S/src/uStepperEncoder.cpp
Using cached library dependencies for file: /home/user/Arduino/libraries/uStepper_S/src/uStepperS.cpp
Using cached library dependencies for file: /home/user/Arduino/libraries/uStepper_S/src/uStepperServo.cpp
Generating function prototypes...
/app/Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_USTEPPER_S -DARDUINO_ARCH_AVR -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/include -D__AVR_DEV_LIB_NAME__=m328pb -I/app/Arduino/hardware/arduino/avr/cores/arduino -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/variants/ustepperS -I/home/user/Arduino/libraries/uStepper_S/src -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM/src /tmp/arduino_build_119629/sketch/Continous.ino.cpp -o /tmp/arduino_build_119629/preproc/ctags_target_for_gcc_minus_e.cpp -DARDUINO_LIB_DISCOVERY_PHASE
/app/Arduino/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_119629/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/app/Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_USTEPPER_S -DARDUINO_ARCH_AVR -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/include -D__AVR_DEV_LIB_NAME__=m328pb -I/app/Arduino/hardware/arduino/avr/cores/arduino -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/variants/ustepperS -I/home/user/Arduino/libraries/uStepper_S/src -I/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM/src /tmp/arduino_build_119629/sketch/Continous.ino.cpp -o /tmp/arduino_build_119629/sketch/Continous.ino.cpp.o
cc1plus: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
cc1plus: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
In file included from /home/user/Arduino/libraries/uStepper_S/src/uStepperS.h:152:0,
                 from /home/user/Examples/Continous.ino/Continous/Continous.ino:9:
/home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM/src/EEPROM.h:145:20: warning: 'EEPROM' defined but not used [-Wunused-variable]
 static EEPROMClass EEPROM;
                    ^~~~~~
Compiling libraries...
Compiling library "uStepper_S"
Using previously compiled file: /tmp/arduino_build_119629/libraries/uStepper_S/uStepperDriver.cpp.o
Using previously compiled file: /tmp/arduino_build_119629/libraries/uStepper_S/uStepperEncoder.cpp.o
Using previously compiled file: /tmp/arduino_build_119629/libraries/uStepper_S/uStepperS.cpp.o
Using previously compiled file: /tmp/arduino_build_119629/libraries/uStepper_S/uStepperServo.cpp.o
Compiling library "EEPROM"
Compiling core...
Using precompiled core: /tmp/arduino_cache_755599/core/core_uStepper_avr_uStepperS_c05e25cd8a3f9a150fee831f71269750.a
Linking everything together...
/app/Arduino/hardware/tools/avr/bin/avr-objcopy /home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/tools/lib/crtatmega328pb.o /app/Arduino/hardware/tools/avr/avr/lib/avr5/crtatmega328pb.o
/app/Arduino/hardware/tools/avr/bin/avr-objcopy:/app/Arduino/hardware/tools/avr/avr/lib/avr5/crtatmega328pb.o: Das Dateisystem ist nur lesbar
Multiple libraries were found for "EEPROM.h"
 Used: /home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM
 Not used: /app/Arduino/hardware/arduino/avr/libraries/EEPROM
Using library uStepper_S at version 2.2.0 in folder: /home/user/Arduino/libraries/uStepper_S 
Using library EEPROM at version 2.0 in folder: /home/user/.arduino15/packages/uStepper/hardware/avr/2.2.1/libraries/EEPROM 
exit status 1
Error compiling for board uStepperS.


Motor starts moving after 'setMaxVelocity' is set.

Bug at 2.2.1 version:

After stopping the moter by 'uStepperS.stop(HARD)' or 'uStepperS.stop(SOFT)' the motor starts immediately runing at the next 'uStepperS.setMaxVelocity(XXX)' command.

Example:

#include <uStepperS.h>
uStepperS stepper;
void setup()
{  
	stepper.setup();
	stepper.checkOrientation(30.0);
	MoveHome(false);
	stepper.stop(SOFT);
	stepper.setMaxVelocity(1000); //-->here motor starts to move
}

Attempt to explain:
The 'stop' method at the uStepperS code only sets the target speed to zero. But the target-position register is not set. Then changing the velocity to a none-zero value the driver starts to moving to the value which is set to the target position register.

Workaraound:
The 'stop' method at the uStepperS code should wait until the motor realy stops movement. After that, the target position should set to the current position:

ORIGINAL CODE:

void uStepperS::stop( bool mode){
	if(mode == HARD)
	{
		this->driver.setDeceleration( 0xFFFE );
		this->driver.setAcceleration( 0xFFFE );
		this->setRPM(0);
		while(this->driver.readRegister(VACTUAL) != 0);
		this->driver.setDeceleration( (uint32_t)( this->maxDeceleration ) );
		this->driver.setAcceleration( (uint32_t)(this->maxAcceleration ) );
	}
	else
	{
		this->setRPM(0);
	}
}

WORKAROUND CODE:

void uStepperS::stop( bool mode){
	if(mode == HARD)
	{
		this->driver.setDeceleration( 0xFFFE );
		this->driver.setAcceleration( 0xFFFE );
		this->setRPM(0);
		while(this->driver.readRegister(VACTUAL) != 0);
		this->driver.setDeceleration( (uint32_t)( this->maxDeceleration ) );
		this->driver.setAcceleration( (uint32_t)(this->maxAcceleration ) );
	}
	else
	{
		this->setRPM(0);
		while(this->driver.readRegister(VACTUAL) != 0);
	}
	// Get current position
	int32_t current = this->driver.getPosition();
	// Set new position
	this->driver.setPosition( current );
}

Permission denied in objcopy crtatmega328pb.o

I am using the Windows Store version of Arduino. When using the uStepperS board I get a permission denied error when it attempts to copy the crtatmega328pb file.

From this forum post it also appears to happen when the Arduino IDE is installed inside the program files folder: https://forum.arduino.cc/index.php?topic=638028.0

For now I've seemed to fix it by commenting out the lines below in the file "packages\uStepper\hardware\avr\2.2.0\platform.txt". I'm not sure if this will cause problems somewhere else but with these changes the bounce example compiles and runs on the board.

# Copy the startup and c runtime libs to the right folder / thx to elector  
#recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.objcopy.cmd}" "{runtime.platform.path}/tools/lib/crtatmega328pb.o" "{runtime.tools.avr-gcc.path}/avr/lib/avr5/crtatmega328pb.o"
#recipe.hooks.linking.prelink.2.pattern="{compiler.path}{compiler.objcopy.cmd}" "{runtime.platform.path}/tools/lib/crtatmega328pb.o" "{runtime.tools.avr-gcc.path}/avr/lib/avr5/crtm328pb.o"
#recipe.hooks.linking.prelink.3.pattern="{compiler.path}{compiler.objcopy.cmd}" "{runtime.platform.path}/tools/lib/libatmega328pb.a" "{runtime.tools.avr-gcc.path}/avr/lib/avr5/libatmega328pb.a"

Arduino error: Error compiling for board uStepper

Hi there , I recently purchased a ustepper S, and I’ve installed the libraries for this in my Arduino (v 1.8.9...I'm not using the app) and have selected the uStepper board at the bottom of the list of boards, but when I try to run one of the example sketches (e.g. bounce) there is always the following error……….

In file included from
...\Arduino\libraries\uStepper_S\Examples\Bounce\Bounce.ino:1:0:

...\Arduino\libraries\uStepper_S\src/uStepperS.h:38:3: error: #error !!This library only supports the ATmega328PB MCU!!

#error !!This library only supports the ATmega328PB MCU!!

^

exit status 1
Error compiling for board uStepper.

Just wondering if you have any advice for this? I’ve tried all the examples from uStepper, UstepperS and UstepperS lite also…

The max velocity seems wrong

I think the max value that can be set is for VMAX should be 0x7FFE00

See the driver documentation:
image

I think the code should be:
if( abs(velocity * this->microSteps) > (float)(0x7FFE00)) {
velocity = (float)0x7FFE00 / this->microSteps;
}

See:

if( abs(velocity * this->microSteps) > (float)(0xFFFFFF))

Encoder stall examples broken

The examples for the encoder stall does not compile on my setup. Using uStepper 2.2.4 in boards and uStepper S 2.3.1 in libraries. Arduino IDE 1.8.19 on macOS 12.4.

Reports following errors:

EncoderStall.ino: In function 'void setup()':
EncoderStall:56:11: error: 'class uStepperEncoder' has no member named 'encoderStallDetectSensitivity'
   stepper.encoder.encoderStallDetectSensitivity = -0.25;//Encoder stalldetect sensitivity - From -10 to 1 where lower number is less sensitive and higher is more sensitive. -0.25 works for most.
EncoderStall:57:11: error: 'class uStepperEncoder' has no member named 'encoderStallDetectEnable'
   stepper..encoder.encoderStallDetectEnable = 1; //Enable the encoder stall detect
EncoderStall.ino: In function 'void loop()':
EncoderStall:61:32: error: 'class uStepperEncoder' has no member named 'encoderStallDetect'; did you mean 'encoderFilter'?
   bool stall = stepper.encoder.encoderStallDetect;//Read the stall decision
EncoderStallSensitivityCalibration.ino: In function 'void setup()':
EncoderStallSensitivityCalibration:56:19: error: 'class uStepperEncoder' has no member named 'encoderStallDetectEnable'
   stepper.encoder.encoderStallDetectEnable = 1; //Enable the encoder stall detect
EncoderStallSensitivityCalibration.ino: In function 'void loop()':
EncoderStallSensitivityCalibration:69:23: error: 'class uStepperEncoder' has no member named 'encoderStallDetectSensitivity'
       stepper.encoder.encoderStallDetectSensitivity = 1-(stallValue*0.05);
EncoderStallSensitivityCalibration:71:27: error: 'class uStepperEncoder' has no member named 'encoderStallDetect'; did you mean 'encoderFilter'?
       if(!stepper.encoder.encoderStallDetect)

Difference between MovedAngle and motor steps

Hi,

I observed with release 2.0.0 a difference between the moved angle and the steps ran by the motor. I am quite sure that the motor did not loose steps.

When running 51200 steps into one direction and then going back the initial angle is missed by approx. 20-40 deg according to getAngleMoved().

Is this anything known?

Regards.

Spurious change to DDRB port in uStepperS::setup

In line 269 of uStepperS.cpp, we have:

/DDRB |= (1 << 4);

It sets the data direction on pin 4 of port B as output. This is the MISO0/RXD1 pin, which is not used by the driver or the encoder and should, in principle, be user configurable.

This line seems spurious and actually interferes with some other libraries when used on the uStepperS. The line in question does not seem to serve any purpose to the uStepper - so I suggest it be removed.

Available/reserverd features?

Hi!

Which 328pb featuers are reserved for ustepper s? I just noteced that serial1 (pins 5&6) interfere with stepperdriver. Is there a way top make serial1 to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.