misfittech / nano_stepper Goto Github PK
View Code? Open in Web Editor NEWStepper feedback controller
Stepper feedback controller
Since the feature "USE_TC_STEP" was enabled the Stepper doesn't show any reaction on the step\dir interface when running in "CTRL_OPEN" mode. If I comment the USE_TC_STEP define out it works as intended.
So it seems that it has somthing to do with the new step counting method.
I use the older HW revision (9/29/2016)
How can I do homing with the current?
In terms of Marlin (Ramps 1.4)
My version is "FW: 0.31", stepperDriver is A4954, input signal (STEP, DIR, ENABLE).
The motor works good for a period of time (such as 2~3 hours), then it fails, The motor rotates fast in one direction,The screen is shown as follows:
after reset, it can works good for a moment(maybe 30 minutes), but then fails again.
why is this happening? thanks.
If a setpos command is issued with a negative value, a resulting readpos value will be the abs() of the negative.
move -124.00 400
:>
deg
:>
readpos
encoder -124.10
:>
setpos -10
:>
readpos
encoder 10.08
The current implementation:
static int setpos_cmd(sCmdUart *ptrUart,int argc, char * argv[])
{
if (argc>=1)
{
int64_t a;
float x;
x=fabs(atof(argv[0]));
a=ANGLE_FROM_DEGREES(x);
stepperCtrl.setAngle(a);
return 0;
}
return 1;
}
Is there a reason why the fabs() is used?
I forked this repo and created a wiki based on the readme and the other links back to your blog as well as added some stubs for future documentation I plan to add. Apparently there isn't any way to create a pull request on github for the wiki, so you would have to make the changes from my wiki back to the main branch (I think). I also wasn't able to add any contributors to my fork, so not sure how you would grab the markdown.
https://github.com/andrewismoody/nano_stepper/wiki
The compilation is broken when using mechaduino hardware. How to not use Dir UART?
Hello,
Submitting this issue on the request of btechnet at the 602 Discord. The docs reference the following:
The VIN, GND, STP, and DIR should be connected to the pins on the NZS with the same names. The
above diagram shows the connection for the X axis on the RAMPS only, the other axis have similar
wiring.
The RAMPS boards have 5V logic levels, hence the VIN pin should be connected to the 5V VIN pin on the
RAMPS board. Other boards like Smoothie which uses 3.3V logic will have slightly different wiring.
He advised that this is now incorrect and docs may need to be adjusted, in regards to VIN.
Thanks
when compiling on Arduino IDE on Linux I got this conversion error:
eeprom.cpp:67:90: error: narrowing conversion of '4095' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
__attribute__((__aligned__(FLASH_ROW_SIZE))) const uint8_t NVM_eeprom[EEPROM_SIZE]={0xFFF};
^
exit status 1
narrowing conversion of '4095' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
I guess it is a typo...should it be 0xFF?
Or may be I don't understand the special purpose of initializing an uint8_t with 0xFFF :-)
Hi, i'm trying to compile the 0.39 but get this errors:
sketch\commands.cpp: In function 'uint8_t kbhit_hw()':
commands.cpp:1521:9: error: 'Serial5' was not declared in this scope
return Serial5.available();
^
sketch\commands.cpp: In function 'uint8_t getChar_hw()':
commands.cpp:1526:9: error: 'Serial5' was not declared in this scope
return Serial5.read();
^
sketch\commands.cpp: In function 'uint8_t putch_hw(char)':
commands.cpp:1530:9: error: 'Serial5' was not declared in this scope
return Serial5.write((uint8_t)data);
^
exit status 1
sketch\nzs.cpp: In member function 'void NZS::begin()':
nzs.cpp:637:2: error: 'Serial5' was not declared in this scope
Serial5.begin(SERIAL_BAUD);
^
'Serial5' was not declared in this scope
How about a future development of the board to support TMC2130/TMC2XXX series of chips? This would get much quieter running motors plus better micro stepping.
float pos;
int32_t x,y;
pos=ANGLE_T0_DEGREES(stepperCtrl.getCurrentAngle());
SerialUSB.println(pos);
I use the code to always print pos value, I found that sometimes the value is strange 23592960.00.
maybe there are calculate mistakes, like devided by zero...
thanks.
This project was probably put together when Altium defaulted to self-righting text. It hides upside-down text. Much of the text of the schematic is upside-down.
I am getting a compile error on commands.cpp.
sketch/commands.cpp:7:19: fatal error: reset.h: No such file or directory
#include "reset.h"
This was changed from Rest.h as part of 874650f, back on Jan 27.
I tried moving back to Reset.h and it worked for me, but I am not sure why the change was made or if this is the best fix.
Hi Misfittech team, congrats for your very nice work. I was looking at your GitHub and saw this mention about the firmware license:
The firmware is licensed as GPL V3 for non-commercial use
GPLv3 explicitly says that there is no commercial limit. This mention makes your license kind of invalid. The other problem is that your project can't really be forked/reused/improved because of that non-commercial mention.
If you really want to have a non-commercial restriction you should look at CC licenses but they are more for art stuffs (they are not very explicit on sharing the source code for example). GPLv3 is for sure the best choice if you really want to make your project open source.
I think you have a very nice project here and it would be good to have a great license coming it with. This would for sure help to grow.
I have BIGTREETECH-S42A-V1.0 motor and driver. working on 0.38 firmware. To make it work i need to change some pins in board.h. With the same config pins on FW 0.39-0.40 do not work any more. Every things fine, LCD work, motor working only one way, can't change direction.
here is board.h file
board.zip
Hi,
just wired up some bash stuff to operate Smart Steppers with scripts utilizing screen
apt install screen
#!/bin/bash
SCREEN_NAME="screen_smart_stepper"
LOG_FILE="/opt/${SCREEN_NAME}.log"
# remove old log file if existent
rm "${LOG_FILE}" > /dev/null 2>&1
# send "smart stepper command + enter (^M) keystroke" to first window (-p 0 could be applied) in a new named screen by stuffing (https://www.gnu.org/software/screen/manual/html_node/Command-Summary.html) the string into input; log the output to file
screen -d -m -L ${LOG_FILE} -S ${SCREEN_NAME} /dev/ttyUSB-SMARTSTEPPER 115200
declare -a cmdArray=("getcal" "microsteps" "readpos" "encoderdiag" "spid" "vpid" "ppid" "dirpin" "enablepinmode" "errorlimit" "ctrlmode" "maxcurrent" "holdcurrent" "homecurrent" "motorwiring" "stepsperrotation" "velocity" "looptime" "eepromerror" "eepromloc" "geterror" "getsteps" "torque")
for val in ${cmdArray[@]}; do
screen -S ${SCREEN_NAME} -X stuff "${val}^M"
done
sleep 1
screen -S ${SCREEN_NAME} -X quit
# clean up the log with ^M symbols
sed -i 's/\r//g' ${LOG_FILE}
it looks easy but it was torture to find out how to communicate best without bugging the complete USB buffer or change stty settings. Maybe someone has smarter solution. That one works and might be a starting point.
same script can be used as basis to send commands or to build up some cyclic things.
i am using it for Hangprinter project to read encoder data without I2C/Two Wire interface, because there's no Duet support yet. And i dont want to mess around with firmware mods.
cheers, Mario
Hi, I followed http://misfittech.net/blog/arduino-package-install/ and have a MKS SERVO42A, I bought it without knowing the story about this copy-product, but I need to buy some others soon for my bachelor project. I'm trying the .ino in this hub, the last version but I got this error:
In file included from C:\Users\ATLAS\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from C:\Users\ATLAS\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd.h:105, from C:\Users\ATLAS\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/sam.h:540, from C:\Users\ATLAS\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.4\cores\arduino/Arduino.h:48, from sketch\syslog.h:33, from sketch\stepper_controller.h:27, from sketch\stepper_controller.cpp:24:
C:\Users\ATLAS\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: warning: "LITTLE_ENDIAN" redefined
#define LITTLE_ENDIAN 1
In file included from c:\users\atlas\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\sys\types.h:67:0,
from c:\users\atlas\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\stdio.h:61, from sketch\syslog.h:32, from sketch\stepper_controller.h:27, from sketch\stepper_controller.cpp:24:
c:\users\atlas\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\machine\endian.h:17:0: note: this is the location of the previous definition
#define LITTLE_ENDIAN _LITTLE_ENDIAN
sketch\nzs.cpp: In member function 'void NZS::begin()':
nzs.cpp:639:2: error: 'Serial5' was not declared in this scope
Serial5.begin(SERIAL_BAUD);
^~~~~~~
sketch\nzs.cpp:639:2: note: suggested alternative: 'Serial_'
Serial5.begin(SERIAL_BAUD);
^~~~~~~
Serial_
sketch\commands.cpp: In function 'uint8_t kbhit_hw()':
commands.cpp:1523:9: error: 'Serial5' was not declared in this scope
return Serial5.available();
^~~~~~~
sketch\commands.cpp:1523:9: note: suggested alternative: 'Serial_'
return Serial5.available();
^~~~~~~ Serial_
sketch\commands.cpp: In function 'uint8_t getChar_hw()':
commands.cpp:1528:9: error: 'Serial5' was not declared in this scope
return Serial5.read();
^~~~~~~
sketch\commands.cpp:1528:9: note: suggested alternative: 'Serial_'
return Serial5.read();
^~~~~~~ Serial_
sketch\commands.cpp: In function 'uint8_t putch_hw(char)':
commands.cpp:1532:9: error: 'Serial5' was not declared in this scope
return Serial5.write((uint8_t)data);
^~~~~~~
sketch\commands.cpp:1532:9: note: suggested alternative: 'Serial_'
return Serial5.write((uint8_t)data);
^~~~~~~ Serial_
sketch\commands.cpp: In function 'int commandsProcess()':
sketch\commands.cpp:1579:52: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
CommandProcess(&HostUart,Cmds,' ',COMMANDS_PROMPT);
^
commands.cpp:1589:15: error: 'class Uart' has no member named 'dtr'
if (SerialUSB.dtr())
^~~
sketch\commands.cpp:1591:60: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
return CommandProcess(&UsbUart,Cmds,' ',COMMANDS_PROMPT); ^
exit status 1
'Serial5' was not declared in this scope
I really, really hope for help. @trampas @Misfittech Have a great day!
hello please update how to use it install , can i use it with my leadshine normal driver ? like if its a middle man between the break out board and the driver
Is Limit detection possible. so endstops not required?
Broken link in Github/website on where to find how to install directions
[Arduino install] (http://misfittech.net/2016/07/27/arduino_install/) for building firmware
Hello!
I'm just learning OOP and C++, and use this repo for practice.
First, I noticed a copy constructor that seems to do exactly the same as the implicit copy constructor.
Are there advantages of defining this copy constructor explicitly?
I also noticed an operator overload for subtraction between angles.
I was curious about what behaviour you wanted to change/control, so I compared the new minus operator with the shorter:
int16_t minus(const Angle &a2)
{
return (int16_t)(angle - a2.angle);
}
... but no pair of input angles gave (a - b) != a.minus(b)
.
Is the explicit wrap condition in the minus-operator code there simply to make the code still work if ANGLE_STEPS
ever changes?
Thanks for your software and for your time.
Hello,
I wanted to know, would step interpolation theoretically help with the noise levels of the system? AFAIK it is what trinamic does to keep their steppers quiet even on low microsteps number.
Regards.
advice,add compiled burn-write firmware hex.
Hi,
i installed Smart Stepper on 4 exactly same motors. The smart steppers are all hardware rev. 2019 and they are running with same firmware 0.39. I jsut mounted them and did the calibration procedure anad the test calibration test. All fine so far.
No i figured out that one of the 4 smart steppers the capacitor (N2P 100 35V) is getting really hot. I took an infrared thermometer which measured 70°C (the others are at ~20°C). you cannot grab it by hand because its so hot. The smart stepper reacts normally so far - if i add a force to the motor shaft it corrects the error immediately. The smart stepper are not connected to a machine yet. they are just mounted, connected to power source and to the 2 phases of the stepper motor. do you have an idea what could be wrong?
regards, Mario
regards, Mario
The schlib and pcblib files are missing from the source tree, but are referenced by the Altium project. This leads to errors when opening the project.
Hi,
i lost the magnets for some smart steppers time ago and wanted to ask what to buy to replace the lost ones. At the other smart stepper motors there are some 6.35 x 3.175 mm neodyms used and they work fine. Those are the ones which were delivered together with the boards.
I tried some other magnets like 4x2 mm but i think they do not have the correct field strength. My smart steppers only produce horrible error on calibration all the time. No chance to get them quiet. Any recommendations for this?
Through the usb serial, I can upload the firmware with arduino. And the nano_stepper is working well except the usb serial, I sent ":>help\r\n" and other commands , but no response.
Hi..
can i use GRBL firmware with smart stepper ?
hardaware : Ramps 1.4 + arduino MEGA
Thanks
Rizki
Looking to convert this to a TMC2208. I was wondering if any firmware modifications would be necessary? Any help appreciated!
Hi,
because i want to have control over each smart stepper by usb connected to a usb hub, i figured out that all Smart steppers have same product id and vendor id. I'd like to persist named devices in raspbian by mapping their id's as fixed rule. Unfortunately that looks not so nice because all IDs of nano zero are the same. How can i change that? i did not find a fitting line of code to adjust that.
Hi there
I'm looking for change the driver to 2209 on board, can I do this without major firmware modification?
Regards
[http://misfittech.net/blog/arduino-package-install/]
I followed the above link and "Arduino SAMD Boards (32-bits Arm Cortex-M0+)" was installed successfully, but I am not able to install "MisfitTech SAMD Boards in Arduino".
Any suggestion, how to fix this problem?
Hello,
The nano_stepper is using tx&rx, so we have to use a main controller (like arduino mega 2560), which owns 3or4 serials ports.
If we add rs485&modbus into nano_stepper, we could use “daisy chaining”, just 1 serial port in main controller, or one computer could control many servo motors.
how about the idea? I will make it in my free time.
thank you!
compiling 684f9ac for mechaduino works quite well with Arduino 1.6.13 IDE, Later commits fail. (I have not tracked down the specific commit yet.
Only mod to the code is to uncomment the define for MECHADUINO_HARDWARE
Error message
In file included from sketch/nzs.h:11:0,
from sketch/nzs.cpp:8:
sketch/board.h:83:2: warning: #warning "Compiling source for Mechaduino NOT NZS" [-Wcpp]
#warning "Compiling source for Mechaduino NOT NZS"
^
sketch/nzs.cpp: In function 'int menuTestCal(int, char**)':
nzs.cpp:39: error: 'PIN_SW3' was not declared in this scope
while(digitalRead(PIN_SW3)==1)
^
nzs.cpp:43: error: 'PIN_SW3' was not declared in this scope
while(digitalRead(PIN_SW3)==0)
^
sketch/nzs.cpp: At global scope:
sketch/nzs.cpp:534:9: warning: #pragma GCC target is not supported for this machine [-Wpragmas]
#pragma GCC pop_options
^
exit status 1
'PIN_SW3' was not declared in this scope
Hi, I was wondering if the board, provided it's properly aligned with shaft and magnet can be used directly on a Nema 14 motor, instead of Nema 17.
Thanks.
I got two Mechaduino clones for free, so I use them to check if I want to use Servo Steppers.
I assume it's not a priority for you, but I see Mechaduino is supported in some way.
So I wanted to give it a try and may be give something back (also see my PRs).
NZS has some interesting features, so I want to try some of them, and eventually switch to SmartStepper hardware if it fits for my purposes.
After ironing out some compile problems, I am now getting a stream of AS5047 Errors when trying NZS with two
AS5047 Error
AS5047 Error
AS5047 Error
...
If I enable the LOG messages I get a repeating sequence of these:
...
AS5047 Error
stepper_controller.cpp 309: move
stepper_controller.cpp 314: sample encoder
ERROR: as5047d.cpp 198: read command 0xFFFF failed
AS5047 Error
stepper_controller.cpp 317: Angles 0 0
stepper_controller.cpp 329: Angles 0 0
stepper_controller.cpp 348: angle delta 0 0 (0 0)
ERROR: stepper_controller.cpp 634: Motor may not have power
stepper_controller.cpp 130: Home pin -1
stepper_controller.cpp 586: start up encoder
as5047d.cpp 110: csPin is 16
as5047d.cpp 115: Begin AS5047D...
as5047d.cpp 134: AS5047D diag data is 0x0000
ERROR: as5047d.cpp 198: read command 0xFFFC failed
ERROR: as5047d.cpp 198: read command 0x7FFD failed
as5047d.cpp 153: AS5048A diag data is 0xFFFF
ERROR: as5047d.cpp 241: AS5047D problem
stepper_controller.cpp 592: cal table init
calibration.cpp 346: calibration table status is: 0
ERROR: as5047d.cpp 241: AS5047D problem
ERROR: as5047d.cpp 241: AS5047D problem
ERROR: calibration.cpp 197: WE did some thing wrong
WARNING: stepper_controller.cpp 596: start up encoder 63728
stepper_controller.cpp 598: start stepper driver
stepper_controller.cpp 630: measuring step size
stepper_controller.cpp 302: reset motor
ERROR: as5047d.cpp 241: AS5047D problem
ERROR: as5047d.cpp 241: AS5047D problem
ERROR: calibration.cpp 197: WE did some thing wrong
stepper_controller.cpp 305: sample encoder
ERROR: as5047d.cpp 198: read command 0xFFFF failed
AS5047 Error
...
This is with motor power off, because it tends to get a little hot, but enabling the power doesn't change the messages that much. I am sure it's not the cause of those messages.
May be I am doing something weird, but after looking into it from different sides I don't see what could be wrong.
First question first: should NZS work with Mechaduino hardware?
Also: how is it supposed to be configured?
I ask, because enabling MECHADUINO_HARDWARE wasn't enough.
At least I had to disable NEMA17_SMART_STEPPER_3_21_2017 and USE_STEP_DIR_SERIAL ...
So may be I am missing more of this kind. Though, looking into the sources didn't give me any hint for more necessary changes.
Some conditions and observations:
Any ideas?
Is there anyone using NZS on Mechaduino?
I recently came across this project and while reading the readme. i decided to look up the servo42. it seems a bit weird to open a issue over this but i think they since have released the source code and hardware designs for their version of this project.
https://github.com/makerbase-mks/MKS-SERVO42A
i totally understand not wanting to support a Chinese low cost clone of your project. but if all that was stopping you was lack of documentation. i think that now exists.
The MKS servo42 have an pin error? I need to know when the stepper have a certain error in other to interrupt my G-Code, but I don't see an error pin or something.
Dear Misfit team,
i've got a question belonging to the manual you provide. At the moment i plan to wire up Smart Stepper to a Duet 2 Ethernet Board. In manual is written:
As i don't find any recent information i just wanted to ask you directly by creating this issue.
Can you provide some support information please?
kind regards, Mario
The fet_driver.h is still included in stepper_controller.h, though the Files where removed.
I just confirmed that I cannot use Smoothie's 3.3v logic directly on the level-shifted pins (step (0), dir (1) and error (10)).
I tried with Vin not connected (using usb for power) and with Vin connected to a 3.3v source from smoothie (usb not connected).
With both setups, the screen would come on and the firmware would load, but the motor would not step when signaled from smoothie.
Maybe I am doing something wrong, any suggestions?
Alternatively, I did test with modified firmware:
- Use D3 (3) for STEP, TX (30) for Dir and RX (31) for Err/Ena.
- Disabled Serial5 in NZS::begin.
- Connected Vin to 3.3v.
Then it works great with my Smoothieboard exactly as expected.
I would prefer not to have to modify the firmware each time I update it.
Do you have any suggestions on what I did to hook it up incorrectly?
Anything I can test or retry? I would be happy to test anything and share my results.
Referencing comments from: #1
The copyright notice mentions www.misifittech.net, but that is a dead link.
Hi,
in the recent documentation there are missing some really simple things
https://github.com/makerbase-mks/MKS-SERVO42B
So they probably stopped violating the license.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.