Control up to 127 stepper motors as servos with speed and acceleration.
How to add the Stepper Servo robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Servo category tab.
- Press the Stepper Servo icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the Stepper Servo robot skill.
How to use the Stepper Servo robot skill
Control up to 127 stepper motors as servos with any stepper motor driver or motor type. This robot skill requires a low-cost and small-profile Arduino connected to each stepper motor driver. Each Arduino is given a unique ID on the optional serial network, which matches an ARC Virtual servo (Vx) port. All 127 Arduinos will share the same PC COM port via the first Arduino's USB connection. An optional end-stop limit switch can calibrate the stepper's home position. For example, if the Arduino firmware bus_id is configured for ID 1, that will match ARC's virtual servo V1.
If you do not want to chain the Arduinos together, you can add multiple instances of this robot skill for each Arduino connected to the PC via USB.
*Note: download the Arduino firmware in the Arduino Firmware section in this manual
Operating Modes
Each Arduino's firmware has a configuration for specifying the operating mode. There are four modes: SLAVE_SERIAL0, SLAVE_SERIAL1, MASTER_SERIAL0, and MASTER_FORWARDING. They are explained below, and only one of the modes can be active based on your configuration and hardware.MASTER_SERIAL0 This mode uses a single Arduino over USB with no additional Arduinos connected to the serial network. There is no serial network for this setting. This is for a single Arduino with one stepper.
Enable MASTER_SERIAL0 if all of these conditions are met...
- this is the only Arduino that will be connected to the PC (i.e., you only need one stepper motor)
- this Arduino is connected to the PC via the USB cable
MASTER_FORWARDING This mode configures this Arduino as a forwarder for multiple Arduinos on the serial network. This master Arduino will be connected to the PC via the USB cable. All slave Arduinos will link to this Arduino's Serial1 port (TX1/RX1) with diodes for each Arduino.
*Disclaimer: the serial network may not work with all Arduino. You may also not mix 5v and 3.3v Arduino on the serial network.
Enable MASTER_FORWARDING if all of these conditions are met...
- this Arduino is the master with BUS_ID 1
- this Arduino has more than 1 Serial port (i.e., it has RX1/TX1 pins)
- there are other Arduinos connected to the RX1/TX1 of this master Arduino in a serial network
*Note: If you use FORWARDING mode and receive an error about Serial1 not being defined, then this Arduino does not qualify for this mode.
SLAVE_SERIAL0 This Arduino's RX0/TX0 pins are connected to a master Arduino's RX1/TX1 pins as part of the serial network.
Use SLAVE_SERIAL0 mode if all of these conditions are met...
- this Arduino is part of the serial network as a slave (it is not a master)
- this Arduino has onboard RX0/TX0 pins, and they're connected to the master Arduino's RX1/TX1 pins
- there is a diode on this Arduino's TX0 pin that is connected to the master Arduino's RX1 pin
SLAVE_SERIAL1 This Arduino's RX1/TX1 pins are connected to a master Arduino's RX1/TX1 pins as part of the serial network.
Use SLAVE_SERIAL1 mode if all of these conditions are met...
- this Arduino is part of the serial network as a slave (it is not a master)
- this Arduino has onboard RX1/TX1 pins, and they're connected to the master Arduino's RX1/TX1 pins
- there is a diode on this Arduino's TX1 pin that is connected to the master Arduino's RX1 pin
*Note: If you use SLAVE_SERIAL1 mode and receive an error about Serial1 not being defined, it means this Arduino does not meet the requirements for this mode.
Serial Network (optional)
Optionally, you can connect multiple Arduinos in a serial network to share the same USB connection. This requires the first Arduino (the master) to have two serial ports. You can recognize if the first Arduino has two serial ports by the presence of the RX1 and TX1 pins.*Note: The firmware has documentation explaining various modes for which the Arduino can be configured.
This diagram demonstrates how multiple Arduinos can be connected to a Master Arduino with a diode. Ensure the diode's band is facing the correct direction. The 100k ohm resistor holds the RX1 high because the diodes prevent the slave TX lines from doing so.
Configuration
1) Port Select the COM port for the Arduino 1 wire serial network interface.
2) DTR Enabled Some Arduinos require this setting enabled for communication (i.e., Leonardo, Pro Micro). If your Arduino is unresponsive when querying Ping or getting a servo position, this may need to be enabled. It is enabled by default.
3) Virtual Port Selections Put a checkbox next to each Virtual Port you wish to bind to the stepper motors. For example, BUS_ID 1 is V1. And BUS_ID 5 is V5, etc. Any commands to move the Vx port will be sent to the respective stepper motor with the matching BUS_ID. Sending a Servo.setPosition(v2, 100) will move the stepper motor with BUS_ID 2 to position 100.
Max Steps The ARC Max servo Positions number is mapped to the Max Steps value. If the ARC Max servo Position is 180 (default), and this value is set to 1500, the stepper will move 1500 steps when a position is assigned to position 180. If the servo position is assigned to 90, there would be 750. Here is the calculation for each stepper's Max Steps setting...
stepperPosition = Map(servoPosition, arcMinServoPositions, arcMaxServoPositions, 0, maxStepperPositions)
servoPosition: The position that you specify the stepper to move into. arcMinServoPositions: The minimum servo positions for ARC are always one and can not be changed. arcMaxServoPositions: The maximum servo positions configured for ARC. This value is default 180 but can be adjusted up to 2 billion per project. The configuration is in ARC Project Settings maxStepperPositions: This is the value per stepper that determines the maximum number of steps this stepper can move.
That means the selected position will be scaled between 0 and Max Stepper Positions. The stepper is scaled between 0 and max stepper positions based on ARC's max servo positions.
Advanced servo Features
This supports the advanced options of servos for Speed and Acceleration settings. The stepper motors will speed up and slow down between their source and destination positions by configuring the acceleration option in ARC's advanced servo settings.When editing a robot skill for the servo configuration, the Advanced button will allow the speed and acceleration to be specified. You may also use the respective JavaScript, Python, and EZ-Script commands for determining the speed and acceleration programmatically.
A lower acceleration value will cause the stepper to accelerate slower as it begins to move. -1 means not changing by maintaining the current setting, and 0 means no acceleration.
Home Position
The HOME position is servo position 1 in ARC. By default, the position on power-on of all steppers and their respective Arduino's will be servo position 1. The ControlCommand() can specify any position to become HOME (position 1). This robot skill has a ControlCommand() for setting the HOME position to calibrate the stepper motor positions. Additionally, you can use an end-stop limit switch to calibrate the stepper into the home (position 1). A stepper motor knows its position by how many "steps" have been sent to move it in either direction. During the operation, the Stepper servo Arduino Firmware keeps track of the steps and, therefore, the relative position. However, because the position is arbitrary on power-on, you may need to calibrate it using an Endstop Limit Switch.Endstop Limit Switch
This robot skill supports an optional limit switch connected to the Arduino for calibrating the position of the stepper motor to become servo Position 1. When the switch is closed to GND, that will configure the stepper to be servo position 1 in ARC automatically. When the end limit switch is shorted, this is similar to sending the SetAsHome ControlCommand to the Arduino for the specified virtual port. The Arduino firmware can be edited to include the option of auto-calibrating when power is applied. Otherwise, you can programmatically enable calibration with the control command.Place a limit switch on the lowest position of the lever connected to the stepper motor. This switch will be used as the limit switch if configured. When calibrating, the stepper will move toward the lowest position until the limit switch is reached. Once the limit switch is reached, that will be position 1 in ARC until the power is cycled. There is no memory of the position between power cycles. The lowest position means the stepper begins rotating by decreasing from the current position.
Ensure the calibration rotates your stepper in the correct direction, which will be position 1 in ARC. You may need to specify the INVERT option in the firmware if the stepper rotates in the wrong direction. The limit switch should always be at the lowest position for the stepper, which means position 1 in ARC.
Increase servo Resolution
ARC has a project-wide setting for increasing the servo resolution across all robot skills. Increasing this value will give the stepper a high resolution supported by your stepper motor.Test Bi-direction Communication
This allows the Arduino to report the current position of the stepper during movement using the script command GetPositionRealtime(). This command will retrieve the real-time position of the stepper from the respective Arduino. The Arduino's are responsible for moving the stepper, including acceleration and speed.The robot skill main screen has a Ping menu option to test bi-directional communication.
When the ping option is selected, a new window will open with options to ping the Arduinos and view their firmware version. Here, you can choose the port for each Arduino on the serial network to verify communication and the version number.
Control Commands
There are several ControlCommand() for interacting with the stepper servo robot skill.ControlCommand("Stepper Servo", "Calibrate", "ServoPort"); This ControlCommand() takes the virtual servo port as the parameter. It will instruct the Arduino with the ARC Stepper servo firmware to move the stepper until the End Limit Switch is triggered. This command requires an end-limit switch; otherwise, the stepper will rotate indefinitely. Refer to the Limit Switch section in this manual to read more about a limit switch and how to configure it. The servo port is the virtual servo that matches the ID; for example, if the Arduino firmware is configured for ID1, this will be V1.
ControlCommand("Stepper Servo", "SetAsHome", "ServoPort"); The SetAsHome command will set the current position of the stepper as servo position 1. For example, if you move the servo into a position (i.e., 90) and then specify the SetAsHome control command, the current position will become the new servo position 1 for that virtual port. servo position 1 is as low as a servo can move, so when you send SetAsHome to the specified virtual port, it will now refer to the current position as 1. The servo port is the virtual servo that matches the ID; for example, if the Arduino firmware is configured for ID1, this will be V1.
Arduino Firmware
The Arduino code must be downloaded from here and programmed onto each Arduino. The recommended Arduino for this usage would be small and affordable, such as a Pro Micro, Micro, Nano, or ATTiny. These are all very low-cost devices that are small and do not take up much space.Download Arduino Firmware from here: Stepper_Servo (Version 20230223).zip (Updated Feb 23, 2023)
Uncompress the firmware to a folder and open the INO file with the Arduino editor
Configure the BUS_ID on the one-wire serial network in the Arduino editor for this instance. It can be a number between 1 and 127. This number will correspond with the respective Virtual servo Port in ARC. Each Arduino/Stepper will have a unique ID. Remember, the ID corresponds to ARC virtual servo numbers. So BUS_ID 2 is ARC's servo port V2.
In the Arduino editor, configure the type of stepper driver that you will have connected to the Arduino. There are multiple types of stepper drivers to be supported, including two-wire, three-wire, four-wire, etc. Uncomment the section of the kind you will use with this Arduino. Only one area can be uncommented at a time, so comment out another section if editing a previous configuration.
In the Arduino editor, you can configure control line wires from the Arduino to the Stepper Driver if they need to be inverted. This is only if the stepper driver requires an inverted GPIO so that HIGH becomes LOW and vice versa.
Ensure you have selected the correct Arduino Board that you are using
Program the Arduino with the edited code.
Troubleshooting
Ensure you have the latest Arduino firmware installed on your Arduino(s)
Ensure you have the latest Stepper servo robot skill installed in ARC
Ensure you have the latest ARC installed (Early Access edition is recommended)
The stepper driver needs to be connected to the Arduino I/O pins. Ensure the pins are connected and specified in the Arduino firmware. Ensure you uncommented the correct stepper driver type in the Arduino firmware before uploading it to the Arduino.
A common GND is necessary across all electronic devices. Ensure the stepper motor driver, stepper motor, Arduino, and PC have a common ground. The Arduino will be grounded to the PC if connected via a USB cable.
The configured BUS_ID on the Arduino must match the selected checkboxes in the Robot Skill's configuration screen
Remember, the BUS_ID in the firmware will match ARC's Virtual servo (Vx) ports. So BUS_ID 1 will match V1 in ARC. BUS_ID 2 will match V2 in ARC, and so on...
Genius work here.
Thanks for the new control,
I will try it out
your Arduino firmware works, connects on my com port 11
when I uploaded new Accelstepper ino to Arduino, then try to connect on ARC, so far, com11 can't connect
My Arduino, I use 57600 to run your Arduino firmware software
I tried all the baud rates
Can't figure it out what can be the reason
any Ideas?
What do you mean by that?
I believe it is the baud rate
#define _BAUD_RATE 57600
When I go to the COMUBS connection
That menu is not from this robot skill. Read the instructions above.
Updated to v3
new firmware
fix for acceleration
tested on arduino without stepper motor. The steps for positioning is most likely WAY off and needs to be adjusted. I'll do that next week when i get a stepper motor to test with.
Updated to v4
Ok, sounds good
so far I read that, I added Stepper Servo, says connected to com11
Did you check the troubleshooting section above?
I will go over it again
Nice work DJ. AND fast!
v5
updated with a new arduino firmware
allows specifying the max positions for the stepper to rotate (read manual above)
tested and confirmed to work great
Wow, Very nice. Can’t wait to implement it.
Thanks DJ!
You bet! I ordered a 5 pack of 5v stepper motors with drivers from Amazon to test with. They arrived yesterday so I was able to try it out.
the one trouble I ran into was the wiring for the hbridge. There wasn’t a clear example of what order to connect the pins for the driver to arduino. I gather it has something to do with the way the coils are connected in the motor, but not sure on how to identify the order.
If someone with more stepper experience knows, maybe they’ll chime in. But I ended up trying a few combinations until I got it working. For a while the stepper would only go one direction and never reverse.
I got it going in one direction also
saw this on another code site // Create Instance of Stepper Class // Specify Pins used for motor coils // The pins used are 8,9,10,11 // Connected to L298N Motor Driver In1, In2, In3, In4 // Pins entered in sequence 1-2-3-4 for proper step sequencing
On my stepper driver, i used this configuration and it worked for the correct direction
I did that before, I said it works but still goes one-way, horizontal, vertical, continuous servo all do the same thing
You can’t use continuous servo with this stepper motor. Because they’re not the same thing. You’d have to read how a servo works to understand. Click on the word servo here to read more.
any regular servo control will work. If your stepper is moving only in one direction, it’s the wiring or arduino ports misconfigured. You’ll have to read what I wrote above about that. Meaning, you have to know your configuration and stepper motor wiring. Theres nothing I can directly help with because there’s a million possible configurations and types.
** I figured it out now it goes both directions with the horizontal, vertical controls
Thanks,
So a bipolar stepper usually has 4 wires with two coils to create the magnetic force for the stepping action. It will alternate the magnetism in the coils to create a cogging (aka stepping) movement. Using an ohmmeter you can find which 2 wires are connected together to form one coil. The resistance will be very low ohms, it can almost look like a short between the wires that form one of the coils. You'll want to connect one coil to one of the channels of an H-bridge or motor driver, just as you would for a DC motor, you'll just need the second channel to drive the other coil to be able to get movement.
A unipolar stepper will usually have 5 or 6 wires and are a bit harder to figure out the wiring because they have center taps coming off the coils. The center tap wire will be half the resistance of the full coil. You can treat unipolar steppers like bipolar steppers by ignoring the center tap wires.
I tested a Bipolar Stepper, NEMA 17 with L298N H-Bridge with the same code, it worked ok, I can go forward and reverse now
I raised the #define ACCELERATION 100 to 200, it spins better
My other Arduino has different code for a Bipolar Stepper, NEMA 17 with L298N H-Bridge starting with #include <Stepper.h> not AccelStepper.h
Just wondering if it would be possible/easier to use a stepper motor driver (for many different size steppers) and the EZbs could supply step and direction with 2 outputs which I think it could handle. This would bypass arduino. It would probably require a new skill, but in that skill you could have acceleration etc that you could edit. If you could get that working with Blockly I would be a big fan. I still believe in the Kiss method and be able program it quickly in minutes rather than days.
Hello @Automation Man, check out my post with YouTube video above. You can do some simple scripting to make it happen. It’s not efficient use of an EZ-B but it’s possible! You’ll need 4 outputs to control 2 channels of an H-Bridge.
Thanks for the input Jeremie but it's not quite what I'm talking about. Here is a typical stepper motor driver STEPPERONLINE CNC Digital Stepper Motor Driver 2.4-7.2A 18-80VAC or 36-110VDC for Nema 34 and 42 Motor on Amazon. I will do some experiments and get it working with an EZ-B. It will take 4 wires though, pulse direction, enable and ground. A simple way is to send out a steady stream of pulses and a more involved way is to have the pulses go up exponentially for acceleration, deceleration. This could be done with algebraic expressions in blockly. I wouldn't mind being a part of the one selling that skill.
Whoops, I was mistaken, the post I was referring to was here.
Yeah, the driver you are referring to seems straightforward. You may not be able to get high speeds from it but simple operation with Blockly (or other) scripting seems reasonable enough.
I'm not trying to reinvent the wheel this was just an alternative- and as you mentioned it would be for slower speeds. I will try to get this new skill working with the arduinos also. Seems like there may still be a few bugs for forward and reverse that may need to be worked out.
There’s no bugs in this robot skill. Any issues with forward and reverse is due to incorrect wiring - that’s a user error not the robot skill.
Ok good to know, as I was skimming thought I read that EZang only got it working one direction. Will be implementing this skill in the near future.
That’s correct, at first he got it working in only one direction. Once he fixed the wiring, he got it working correctly.
Correct, if you read all the posts, I did get them moving forward and reverse
both the Bipolar Stepper, NEMA 17 with L298N H-Bridge and the 28BYJ-48 Unipolar Stepper with ULN2003 motor driver
the wiring - "step sequence" in the code was the problem at first
v6
updated the robot skill and firmware
the firmware update is required if you wish to use the end stop limit switch calibration
The optional end stop limit switch calibration is documented in the manual above and within the Arduino firmware file. The end stop limit switch allows the stepper to rotate toward a direction until a limit switch is reached. This will set the stepper to servo position 1 in ARC.
The end stop limit switch calibration can be configured to execute after power-on automatically or programmatically using the ARC controlcommand.
Hit a bit of a roadblock while trying to upload to the arduino for the step and direction type. I will be using a stepper driver so only need the step and direction type. If you uncomment the lines for step and direction it states a problem with stepper 1 wire. I tried a lot of different variations but could not get it to upload. It's probably something simple but I can't find it.
If you uncomment one section, you have to comment the other section. Only one type can be active at a time
Yes I understand and can appreciate that, but it's a little deeper than that. If you try to do the step and direction (uncomment only this area) and try to compile it will send back an error (stepper wire 1-something like this). One way to correct that error is to go into the area that states do not uncomment this area but I did for the Stepper wire 1 error and it compiles(verifies). But when I try to upload it to the Arduino it just does not upload and gives an error uploading message. Try it for yourself for the step and direction mode and you'll see what I mean. Maybe it's on my end as Arduino is a bit new to me but looking over the code it makes sense to me on how they do it.
I’m having difficulty understanding that message. But I might make a guess
Maybe you have ARC loaded at the same time when trying to program the ardunio. You can’t have both running.
close ARC and then program the ardunio. Once the arduino is programmed, you can load ARC again.
Here is the driver
which uses pulse and direction. I only uncommented the 3 lines for stepper driver mode for step and direction and it doesn't compile. It is not hooked up to the EZ B-will do it after it uploads. Tried different things after that and still couldn't get it to work. Any suggestions?
OK so I have a dumb question what is the power you are sending to the NEMA 17 stepper motor? Also would you hook a Hall sensor to the Arduino 5V, GND, pin A0 for the homing connection? One last question what stepper motor driver do you recommend? I was thinking about the TMC2209 or A4988 drivers.
Each motor driver voltage is rated differently. I've seen them from 12v to 80v and I think you can set the different wattage output to the stepper on the driver itself.
Error when compiling after doing the below setting up for DRV8825 drivers with step and dir connections. I get and saying there is no STEPPER1_WIRE1 defined. If I uncomment the the FULL4WIRE section it works but that does not match the connection picture in the manual above. What would be the way to set this up and connect it to the Arduino?
Would this be the correct way to wire this for the DRV8825 and use this skill? If so what section would you uncomment?
This would be for an A4988
I'll start by saying I don't know about this skill or how it finds home after power down. I don't know what feedback devices it is able to get position feed from. I do know that on most controllers I've used:
When using an encoder for feedback, there is no way for it or the software to know where Home is after the power is cycled. You need to send the Home command to the motor controller. Then the motor will seek the one end point. It will count pulses as it travels and use that info to determine position Once it finds one end of travel it knows where home is.
When using a potentiometer the controller will know right away where the motor is positioned within the travel space. This is because it is reading voltage and uses math to figure out how far away it is from the end points. From this voltage reading it knows where the end points are.
Again, I don't know this skill but it should be able to use the above info somehow in setting up the start position of the motor.
How is this skill getting feedback from the stepper motor?
Thanks Dave, I edited my question because I think I know how it works once setup the stepper motor would always travel from 0 to say 180. So if you turned it off at anything above zero the Autohome should always try to return to zero at startup. I am just not sure if it required to have a max end stop also in place. My goal is to develop a generic gearbox with a ARDUINO, Stepper Driver and Hall Effect sensor in one package that can be set to find home and then use the skill to set the range of motion the stepper motor can move. I just want to make sure I understand how this skill works before I start printing parts.
Again, I'm unfamiliar with controlling stepper motors. Just wondering, can a stepper motor be manually moved when powered down? Like a worm gear motor can not be moved? If so then the "step" position would always be know after a power cycle. If so you would not need to find and confirm where home is. The software would already know where the potpr is if set up properly.
smiller, the limit switch is just that - a switch put on the limit for the movement position 1 (one). That's the lowest position of any servo of the stepper in ARC.
Once the limit switch is reached during the auto or manual calibration, that becomes position 1 (one) in ARC.
There is no "memory" for the position in an Arduino because they don't have a memory. So you can decide if you want to calibrate every time the robot is powered on, or you can manually specify it to calibrate with the control command.
You will find this information in the above manual under the "Limit Switch" section.
Here is more information on types of limit switches
So @DJ I was right in my comment above I only need the one sensor no need for a second one thank you for validating that for me. Now what about the compiler error I am getting?
What compiler error are you getting? The error should tell you what’s wrong in your code.
DJ Check Post #39 for more details
Sorry, I’m only able to help if you tell me what error you’re receiving.
DJ See below please.
Error when compiling after doing the below setting up for DRV8825 drivers with step and dir connections. I get and saying there is no STEPPER1_WIRE1 defined. If I uncomment the the FULL4WIRE section it works but that does not match the connection picture in the manual above. What would be the way to set this up and connect it to the Arduino?
Gives the follow error seen below
Would this be the correct way to wire this for the DRV8825 and use this skill? If so what section would you uncomment?
That's the information I needed, thanks. I slightly changed the firmware and updated it on this page. There's a new version on the top of this page, where you can download the Arduino firmware. It reads updated today on Sept 9, 2022
The section that you're uncommenting looks correct for the DRV8825
DJ, Thank you it compiled correctly!!! Thank you again for the quick turn around on this.
DJ another question for you please confirm this is correct.
Arduinos have USB connections for programming. When the Arduino's USB is connected to the PC, it will become a COM port. With this configuration, you only require one Arduino connected to the PC via USB, and all other Arduinos will connect their RX0 pin to the first Arduino's RX0 pin. All Arduino's on the one-wire serial network will have their RX0 and GND pins connected. They all receive the same packets with this configuration, but they will only process the packets that match their unique BUS_ID. I would think it should read like this "first Arduino TX pin". Arduinos have USB connections for programming. When the Arduino's USB is connected to the PC, it will become a COM port. With this configuration, you only require one Arduino connected to the PC via USB, and all other Arduinos will connect their RX0 pin to the first Arduino's TX pin. All Arduino's on the one-wire serial network will have their RX0 and GND pins connected. They all receive the same packets with this configuration, but they will only process the packets that match their unique BUS_ID.
No, the original instructions are correct. Do not use the TX lines.
Thank you for confirming that!
Smiller, wait - you were right. I wasn't in the correct headspace. If you look at the original wiring diagram photo, it shows the TX connected to the RX of the other arduinos.
The FIRST arduino's TX is connected to the other arduino's RX. So the TX of the first arduino transmits to the RX of all other arduinos. Your original notice was correct
OK great thanks for taking a second look. I hope to have everything I need in the next few days to test this out.
I updated the manual to reflect the change you identified
Thanks S Miller for having the same problem that I had and DJ for solving the problem by modifying the software. I have DM542T stepper driver and the Arduino Micro. Tried to hook it up similar to Smiller drawing with A1=step and A0=Dir but I also noticed in the Arduino code it states step=2 (a2) and Dir 3 (A3). I tried both but it is not working. It would help if you could print both and show the wiring diagram from the Arduino to the stepper. Getting closer but not quite there.
I think the section in the code that needs to be uncommented would be something other than the step/dir section. Maybe someone else can chime in. Note DC source of 5V is needed for the Ardino.
Arduinos have USB connections for programming. When the Arduino's USB is connected to the PC, it will become a COM port. With this configuration, you only require one Arduino connected to the PC via USB, and all other Arduinos will connect their RX0 pin to the first Arduino's TX0 pin. Remember, all Arduinos also need to have their GND pins connected. All Arduino will receive the same packets with this configuration, but they will only process the packets that match their unique BUS_ID.
Just a reminder that some Arduinos are active low. I had my stepper motor working with a small pulse and direction generator but when I replaced step, direction and also hooked up ground to the Arduino couldn't get it working. At SMiller I think your puls+ dir+ and En+ all need to be hooked to 5v regulated and the inputs coming from the Arduino need to be hooked to the Puls-, dir-, Ena- but I'm not positive on that -looking for confirmation.
My post from above
A great site to understand steppers is https://dronebotworkshop.com/stepper-motors-with-arduino/
you said on your other page: Quote:
https://dronebotworkshop.com/stepper-motor-hall-effect/there is other stepper motors info there on the site
The step sequences were my problems, but I resolved it
I did get them moving forward and reverse
Ok got it, the 4 wire scenario works and that's a big step forward but we're trying to get the pulse and direction pins to control larger stepper drivers to work . Go ahead and try it maybe you can figure it out, you'll need to get a larger stepper driver with pulse and direction pins and a larger stepper motor maybe a nema 23 or 34 as those would be a good ones.
What do you mean by "the 4 wire scenario works but we're trying to get the pulse and direction pins to control stepper drivers to work"?
All you have to do is uncomment the stepper driver mode option in the Arduino firmware...
This is because the schematic you posted above demonstrates that you only need to use the STEP and DIR from the Arduino to the controller's input. If the DIR is not working, the four wires to the stepper must be misconnected.
Yes, tried that with my Arduino micro but couldn't get it working. I have ordered the same parts (Arduino Uno and DM542) as Smiller and will hook it up exactly like his drawing. Will also uncomment the specific lines in the code for step and direction and see if that works. I was using a pulse generator in active low to rotate the stepper motor and that was rotating fine so the wiring to the motor is one less variable that could be wrong. Which pins from micro should be to the driver? Is the micro different from the Uno in that it has to be active low but the Uno can be both active high and active low?
Automation Man. I want to be clear I am not using that setup I just posted what I had found online for that driver/controller.
The pins you use are in the part that you’re uncommenting.
Ahh sweet that's the answer I was looking for, thanks DJ. I hooked it up with the Arduino micro and it is now working. @ SMiller after looking over your schematic and understanding it yours should work also.
Some quick observations- I looked for a variable in the variable list for Acceleration so that we could change it on the fly rather than get back into the Arduino software each time and could not find anything, maybe you have made one can you point me to it. Different motors will need different acceleration. Where in the code is this located? The resolution index is not really resolution (which it has plenty of). It is more in line with amount of rotation, as you change this amount it is changing degrees of rotation. How many actual pulses is it putting out per degree? If we know this amount then we will know how far it will rotate. Where in the code is this located? This one would also be nice to have as a global variable. Thanks again, Don
Manual for advanced servo settings for acceleration: https://synthiam.com/Support/ARC-Overview/Servo-Controls
your other questions regarding the step values are settings in the firmware file.
Perfect, got it.
DJ Have another question I hope you can answer. It refers to the following statement in the instructions:
A common GND is necessary across all electronic devices. Ensure the stepper motor driver, stepper motor, Arduino, and PC have a common ground. The Arduino will be grounded to the PC if connected via a USB cable.
In my build I have a 6V 60A DC power supply and for the my 5V devices I have a 5V buck converter that powers my Lattepanda and also the powered USB hub that is connected to the Lattepanda. To power the planned stepper motors I will be connecting a 12V boost converter to the 6V power supply. So here's my question. If the first Arduino BUS1 is connected with a USB from the USB hub connected to the Lattepanda for BUS2 Arduino where does the power need to come from? The same 5V buck converter the hub and the Lattepanda is connected to?
Because all the power in being supplied by the 6V power supply would all the grounds be considered common? Meaning the 12V Boost and the 5V Buck grounds and the power supplies ground are common?
I was planning to power the Arduino's with 5V mini buck converters on each motor being powered by the 12V feed from the 12V boost converter. This all depends on determining a common ground based on the statement above.
All power sources in electronics need to have a common ground. That’s the reference of 0 volts. Without it there’s no way to see voltages. Connect all gnds of all power sources
So then because everything is connected to the 6V power supply GND as the starting point you are saying this means everything is on the same ground no matter if it goes through a booster or a buck converter if I understand you correctly.
All gnds have to be connected for all power sources. Not sure how else I can say that haha
In Blockly how would you move the stepper since it is a virtual port. Will you need to make up a different Move servo DO,0 etc or maybe modify existing one to handle virtual as well as the typical?
Vx virtual servos are not included in blockly. We'll have to add them in a future release. We have a released scheduled for between the 5th and 7th, so I'll try and sneak it into that one.
Wonderful, thanks
Is there a variable built in that we can use to count the pulses of pin 2 and then also subtract as needed with direction pin 3. I tried to do it with Blockly and the adc but the cycle time is too slow to keep with the pulses. It worked but did not catch them all. This variable would be very helpful in many ways. It would always know where you are and if you want to clear it to start something new, just clear it. I suppose rather than pin 2 and 3 it would need to be pulses and direction for a specific Bus address (diff motor). Maybe add this variable in the same area as virtual stepper motor advanced area.
The hardware that controls the stepper motor is an Arduino, which is not part of the PC that runs ARC. The Arduino has the step count, not the PC. It is not possible for a variable as they are separate pieces of hardware. Therefore, we commend using a potentiometer or encoder for the output position.
A potentiometer is the easiest solution, as it would connect to an EZB ADC port. The ADC value can then be used as a position. This can be combined with an existing ADC robot skill available here: https://synthiam.com/Support/Skills/Servo/PWM-Servo-Feedback-ADC?id=18047
ok understand and will implement the feedback, thanks
I was talking to the guys and they feel there’s a way we can extract the position if both the rx and tx were connected. This allows the controllers to transmit their position when requested with a command.
i looked into it and I agree it is possible. It’ll operate the same as the robot skill I shared above.
we’re gonna look into it further and see what we can do. Stay tuned
Ahh, I think that would be a big find if you can pull it off.
Whenever you get time to make the virtual port I think it can actually be different from the PWM integer degree because it is serial and not hindered by the 9us separation that is needed with PWM. It should be able to go into the 1/1000 or even more because it is microsteps, this will add a lot of precision to everything (30.652 degrees)
The servo position is not in degrees. The servo value range in ARC is customizable. Out of convenience, the default is 180 positions. A link and mention of altering the ARC global servo resolution value is also in the manual above.
Most advanced robots would have the servo range increased for higher resolution. Read more about ARC servo resolution and how to configure it in the servo manual here: https://synthiam.com/Support/ARC-Overview/Servo-Controls
Updated version 7
Includes support for a bi-directional connection method that allows querying the stepper positions during movement. See the manual above for wiring
Additional debugging messages added
Requires updated firmware for October 5th, 2022 or newer
Great update! One more item to consider is to make it continuous rotation with a simple click in a checkbox. Thanks again, Don
When do you think the update to ARC for Move servo for virtual in Blockly will occur? Looking forward to it with a smile on my face!
I believe there is a release scheduled for this week - so today would be it
Disregard this post I had an issue and fixed it myself.
The error message from the Arduino IDE product explains the error. It does not appear that you have selected the appropriate Arduino board in the Arduino IDE. If you have, there is an issue with their product regarding the updates you have accepted.
It was cause by the board updates the IDE made when I reloaded SEEED boards lib in the board manager. After doing that the next time I started the IDE it asked me to make the board updates again and this this time I said no and everything returned to normal.
Unfortunately I cannot get the new software to work. I updated ARC and the Arduino software, tried multiple stepper drivers and one of them even had a pulse generator working then I switched out the pul, dir, had enab tied high and made sure they were all grounded together properly but still could not get it working. Can you please verify that it works on your end with pulse and direction mode. Is there a way to verify that the pulses are coming through with the internal counters? Mine did say it was connected to Port 6. Are they a certain variable? For the limit switch it states that it is port 6, is that an adc port- is that on the Arduino or on the EZ?
I guess I am the only one who is noticing that it doesn't work anymore.
Info on "BIG" stepper motors
watch and read this https://dronebotworkshop.com/big-stepper-motors/
I have to go now, see you in a few days for you progress
Thanks for the feedback, I'm already there and using NEMA 34 steppers-and I would prefer bigger, which I make my own large servos when needed. They were working great and then updated the software with Blockly and Arduino but it's not working anymore.
You updated the robot skill and arduino firmware? All tests work good here. Make sure you have both the recent robotskill and arduino firmware
Ok that's what I wanted to figure out, if it's on my end or your end. Are you using it with step and direction? I will backtrack and reload the Arduino update into the Arduino. I have been using the updated the ARC software. Yes I did update both of them. Thanks
Yes we test with all settings. Verify your ports are configured in the firmware prior to uploading to arduino
Still not working but I did notice in the variable watcher that $direction is "stop" even when I move it to different positions. I would think that is supposed to continuously change as you change the positions. Is that variable somehow locked somewhere?
$direction variable is for the current movement direction of the robot’s movement panel. The stepper motor robot skill is not a movement panel. That variable changes when the movement direction has changed for the Movement Panel (ie forward, left, right, stop, up, down, etc)
I’ll make a quick update to the robot skill tomorrow that allows testing with a ping. That way you can see if the arduino is correctly connected
Wonderful thanks this will help me narrow down where the problem lies
Updated robot skill v8 and firmware v20221012 to include a PING option to verify communication with Arduino slaves on the serial network
It states that port V1 is unresponsive I have confirmed that the stepper panel and the stepper servo panel are both on V1 I am using the Arduino Uno what would cause it to be unresponsive? Have confirmed that other small servos are working OK also have confirmed that it is using port six in the stepper servo panel
There’s a trouble shooting section in the manual above. Id be repeating what’s in that section so it would be easiest if you referenced that.
I’m guessing you either have the wrong com port selected or you’re not uploading the firmware to the ardunio successfully. There’s instructions above for both
got it working again - forward, and reverse - works well
I tested a Bipolar Stepper, NEMA 17 with L298N H-Bridge with an Arduino with DJ's code
in code using 8, 9, 10, 11 for pins 1,2,3,4,
external 12 v power supply for stepper motor
all grounded together, the 12v and the Arduino - used a small bread board, EnA EnB to bread board 5v form Arduino
used in the code - #define ACCELERATION 300 - spins better - will try a higher ACCELERATION later
Ahh, got it working and it was a stupid mistake. After looking it over a little bit wouldn't it be better to have a built in variable in each stepper panel to get realtime position rather than making a loop in blockly. The Get realtime position could be used as a one shot when a specific position is needed. What is the proper way to make a loop in Blockly to constantly get the realtime position and can that be separate blocks on the sidelines that constantly monitors it?
Another feature that you may want to put in the stepper panel is rather than using limit switch to make it zero what if you referenced a pot that knows it's position and input that position before it starts up. This value from Adc would be manipulated/multiplied as the starting point. There could be checkbox in the panel if someone wanted to use this or not. If you are using a 180 scale it may start at 122 and be proportional to the total. This is similar to what you are actually doing when you input a value Into the PWM servo feedback.
It was mentioned earlier that it is impossible to have a variable because it is a separate piece of hardware. You can use functions like a variable. A function returns a value. Use the function to get the position instead of using a variable.
Combine this robot skill with one of the servo position robot skills that does just that. It was mentioned above as well.
PWM servo feedback (ADC): https://synthiam.com/Support/Skills/Servo/PWM-Servo-Feedback-ADC?id=18047 PWM servo feedback (I2c): https://synthiam.com/Support/Skills/Servo/PWM-Servo-Feedback-i2c?id=18069
I got it working again as I stated above - forward, and reverse - works well
I tested a Bipolar Stepper, NEMA 17 with L298N H-Bridge with an Arduino with DJ's code
In the code I used 8, 9, 10, 11 for pins 1,2,3,4,
external 12v power supply for stepper motor
all grounded together, the 12v and the Arduino - used a small bread board, EnA EnB to bread board 5v form Arduino
used in the code - #define ACCELERATION 300 - spins better - will try a higher ACCELERATION later
The ping worked, you can see above
What was your mistake at first?EzAng
I clicked on the green update which I thought would update my Arduino, but that was for ARC. It was when I was looking for troubleshooting that I saw the update for the Arduino. As soon as I saw it I knew what was wrong-downloaded then uploaded, tried it out and it works great.I knew better than that because it was downloaded the first time.
Synthiam support, yes you did mention it and I was a bit amped up and forgot because finally got it working again. Will try to combine the skills for the second answer. How would you write the function in Blockly or on main screen to see where it thinks it is and display it. I'm new to writing functions.
You don’t write a function. That Get servo Position Realtime block is a function that returns the position of the stepper.
So instead of using a variable, use that function block. That block returns the position of the stepper where it is. You can read more about that block by selecting HELP on that block.
This thread is about questions regarding the stepper robot skill. If you have programming questions, you'll need to create another thread so we can keep the website organized for other users, please.
Yes that is what I was looking for, and I was very close by set variable x to Get realtime position
Tried to change the ratio to make it move twice as fast but it keeps reverting back to 1 ratio. Just wondering if this is available to be changed?
Have three different steppers working individually with different com ports but when I tried to get them all hooked with one as main com port sending out via Tx to the next 2 receiving via Rx and tied all the grounds together but it did not work. I made the Tx line put out 2 parallel wires just like the picture and also put a check in V1, V2, V3 checkboxes in the stepper panel. Tried to ping the other 2 and they were unresponsive. Don't they need to ping to work properly and don't they need both the Rx and Tx to make them ping?
Hello Guys! The ARC newbie needs some help with this. I have had my subscription for almost a year and this is the first time I am using it. For this issue I have latest ARC running on Windows 11 using Parallels on my MAC computer. Seems to work ok. I have loaded the Seeed Studio XIAO (Arduino) with the latest firmware Windows see's the board on COM3 as seen below
settings as follows: #define BUS_ID 1 #define SPEED 100 #define ACCELERATION 100 #define CALIBRATE_ON_POWER 1 #define CALIBRATION_DIRECTION 0 #define CALIBRATION_STEPS 50 #define END_STOP_LIMIT_PORT 0 // Uncomment the four lines below if using stepper DRIVER mode (with Step and Direction pins). #define STEPPER_TYPE DRIVER #define STEPPER1_STEP_PIN 1 #define STEPPER1_DIR_PIN 2 AccelStepper stepper1(AccelStepper::DRIVER, STEPPER1_STEP_PIN, STEPPER1_DIR_PIN);
USB is connected to the Seeed Studio XIAO and the driver is connected to a 24V DC supply.
At power up the stepper motor searches for home and when the hall sensor is triggered it stops. So far so good... But now when I try the Vertical servo set to a virtual 0.V1 port I get no movement. I know I must be doing something wrong. Can anyone please help me figure this out. Note: my ARC is not connected to any other device.
It is basically wired like this:
The UNO would be the Seeed Studio XIAO #define END_STOP_LIMIT_PORT 0 #define STEPPER1_STEP_PIN 1 #define STEPPER1_DIR_PIN 2
Seeed Studio XIAO PIN OUTS
Should ARC be connected to the SEEED on com3. also to be able to test this? If so it will not connect.
I got it working again as I stated above - forward, and reverse - works well
single stepper setup
I tested a Bipolar Stepper, NEMA 17 with L298N H-Bridge with an Arduino with DJ's code
@EzAng was that post in response to my post if so your setup is not like mine. I am not sure if I need to do something else to setup ARC. If I connect an IOTiny and connect to it I can run a servo that is connected to its port.
when setting things up for this stepper stuff it looks like the stepper skill is connecting to the com port the Seeed (arduino) is on. But do I also need to have a connection to the Seeed on the connection panel also?
I have not been able to find anything that spells it out clearly to me yet.
I see in your picture it looks like your arduino is connected to your pc. Do you have that USB com port connected in the board connection panel?
It was updated to version 9, the firmware and robot skill, with more information to help you guys with questions.
Also, the firmware now has the max step positions and more information on what the setting for "SPEED" means.
Thanks DJ, But I have been messing with this for a bit. Looks link this could be a hardware issue with the Seeed Studio XIAO USB working with the the skill. I have no issues using the IDE to put software on it but it locks up ARC if I try and do a ping test after it says it connected to the right com port.
I don't seem to have this issue with and Arduino UNO using the same skill.
It was updated again to version 10, the firmware and robot skill. The firmware is 201210162, and the robot skill is version 10
Added more debug information to help people get this skill working.
DJ, I think your new version may have fixed things. I will need to check it out more after a little sleep.
lol, thanks DJ - you code keeps making it easier
just connect to the stepper skill for the Arduino - I used com5
no connection is needed in the connection panel
smiller29, hope this helps you today
IOTinys and regular servos are different, don't need the stepper skill
My Arduino is connected to ARC with the stepper skill by the USB wireyour Seeed Studio XIAO PIN OUTS - looks about the same as my Arduino
On ARC under project, properties, I am using - Max servo positions - 1024 for better smooth movements
Good to hear you’ve got it working can you try to hook up multiple Arduinos and see if they communicate with each other mine is still not giving a ping or moving multiple motors wonder if there is something in the software that needs to be changed instead of a comport it uses the Rx TX on the Arduinos have hooked it up according to the new schematic with TX and RX etc. Also can you try going from highest to lowest and see if it works for some reason mine is not moving properly if I go from 90 to 180 it is fine or 90 to 1 it is fine I have updated the two new pieces of software this morning before I got started
DJ, The new version is working and I thank you for everything you have done to make this skill better!
If now have a few questions I hope you can help with because I am not sure where to start. I am attaching the stepper motor to a gearbox with a 38:1 ratio for a full 360 degree rotation. My goal is to have this gearbox move from 1 to 225 degrees as fast as I can using this skill. My questions is how do I go about figuring out what the settings should be in ARC and this skill?
The stepper is set for full steps. My understanding a NEMA 17 make 200 full steps to go a full rotation. So am I understanding that to turn this gearbox 360 degrees it 38 x 200 = 7600 steps? making every 90 degrees of the gearbox would equal 1900 steps of the motor?
So to make the gearbox rotate 225 degrees the stepper needs to move 4750 steps? MAX_STEPS_FOR_ARC_POSITION 4750
also what is the max value that can be defined for MAX_SPEED?
Sorry if these seem like dumb questions but I am new to all this stuff.
Yes 4750 is correct
Well that does not seem to work... I don't get much rotation at all so I am not sure what else is missing.
Rotation is the MAX_STEPS_FOR_ARC_POSITION. So increase that. It’s documented in the firmware file.
DJ, like I stated above to make the gearbox rotate 225 degrees the stepper needs to move 4750 steps? MAX_STEPS_FOR_ARC_POSITION 4750 is what it is set to and when I move the servo control it does not even come close to rotating 225 degrees maybe about 20 degree at best... also the motor does not seem to be moving as fast as it should it also sometimes jerks or stutters as it speeds up and slows down.
I have set the global ARC servo resolution to 270.
also what is the max value that can be defined for MAX_SPEED? I have it set to 500 like you have it. I am using a 24V supply for the motor.
Oh one more thing do you have a servo control like a slide bar because the controls are hard to use with a touch pad. I am sure with a mouse wheel they are easy to use but I don't use a mouse. I have used the touch pad skill also but that also is hard to use. slider controls would be the best solution.
the speed of 500 might be too fast for your arduino. Use the default speed of 100 or so and dial in your MAX_STEPS_FOR_ARC_POSITION. You're changing too many parameters at once and losing track of what's not working.
Put your max speed back to something normal (not 500)
dial in your MAX_STEPS_FOR_ARC_POSITION so you get what you want
dial in your speed. If you make the speed to fast of a number, you'll miss steps and exprience what you have now.
Ok the default value in the skill was 500 so I left it but I will back it down and see what happens.
If 500 is the default, leave it, but you may need to try something smaller. It depends on how faster your Arduino is and how quickly the stepper responds. I can't give you numbers for your hardware because I don't have your hardware. Each stepper is different, each stepper driver is different, and each Arduino model is different.
You can check to ensure the stepper is connected to the driver correctly. Maybe it's only moving partial because one of the coils is connected backward.
One last thing you can look at the datasheet for your stepper driver. See what the minimum pulse width is.
I created a new version of the Arduino firmware (download it above), which has a MIN PULSE WIDTH setting. You can try that and see if it makes a difference based on the datasheet for your stepper driver. Read the comment in the firmware because it explains more.
ok I will check it out but it may be the Seeed XIAO looking at the spec it has a 48Khz bus speed so I will also try a Nano and see if that also changes things. Minimum STEP pulse duration for DRV8825 is 1.9s
Do you mean 1.9us? Because 1.9s is almost 2 seconds. I want to make sure you're looking at the correct value. The number you find should be us (microsecond)
1.9us the symbol did not copy correctly... also the one spec sheet had a typo on it also the Seeed XIAO is running at 48mhz not 48Khz which is faster than the nano so no need to try that.
Please no one take this the wrong way I am just trying to save everyone a lot of time-In my experiments the output was not proportional to the input. Example- I am using 1-180 with 3000 pulses If you go from 90-180 or 90-1 works fine but if you go 1-180 or 180 to 20 etc the output is erratic and barely moves which is what Smiller is experiencing. Until this scenario is corrected the output will not get the intended result.
@Automation Man, thank you for your feedback on this I thought it was me doing something wrong.
I change the Arduino code to:
#define MAX_STEPS_FOR_ARC_POSITION 1500 #define ACCELERATION 200 #define MAX_SPEED 200
works fine forward and reverse
@smiller you may want to buy some Arduino Uno they are so much easier to read what pins they are and they also come with three ground pins and 5 V and 3.3 V which in some cases is very helpful The cost is $29 compared to $24 in the scheme of things small price to pay for added features
Amazon 17.99
I use these
https://www.amazon.com/ELEGOO-Board-ATmega328P-ATMEGA16U2-Compliant/dp/B01EWOE0UU/ref=sxts_rp_s_1_0?content-id=amzn1.sym.acfa156f-6066-4c30-8587-c628ec07e337%3Aamzn1.sym.acfa156f-6066-4c30-8587-c628ec07e337&crid=1M1ITNLIB6NDK&cv_ct_cx=Arduino&keywords=Arduino&pd_rd_i=B01EWOE0UU&pd_rd_r=86b6ca4c-ce52-43c0-a94b-01a5990f9888&pd_rd_w=fdzA5&pd_rd_wg=yyip8&pf_rd_p=acfa156f-6066-4c30-8587-c628ec07e337&pf_rd_r=VNRQ259RR4JFSF176MV9&psc=1&qid=1666020557&qu=eyJxc2MiOiI2LjAwIiwicXNhIjoiNS4yMSIsInFzcCI6IjUuMDMifQ%3D%3D&sprefix=arduino%2Caps%2C549&sr=1-1-f0029781-b79b-4b60-9cb0-eeda4dea34d6
@Automation Man the Seeed XIAO is less than $10 it is very small. You can see my setup below the top board is the driver board with a DRV8825 driver and the board below it is the Seeed XIAO. This package will contain the master BUS_ID1 and the second BUS_ID2 with a second driver board and Seeed XIAO to support the right two joints in my Inmoov the left shoulder will have BUS_ID3 and 4. I don't have a lot of space so I need to keep things small.
This pack will slide in and out of a holder so they can be updated and serviced easily.
Seeed Studio XIAO SAMD21The Smallest Arduino Microcontroller Based on SAMD21,with Rich Interfaces, 100% Arduino IDE Compatible, desiged for Projects Need Arduino Micro, 1pc https://www.amazon.com/dp/B08CN5YSQF?ref=ppx_yo2ov_dt_b_product_details&th=1
The conversation seems to have gone off track from assisting with your issues. You're experiencing missed steps, and I've addressed that by advising you to adjust the MIN PULSE WIDTH setting in the firmware. Your min pulse width for the driver is 2us, so set the firmware min pulse width to anything higher. Try 20 to start with, as that's a safe value.
DJ, I have set the value MIN PULSE WIDTH setting to 2 as my DRV8825 needs 1.9us but I have not been able to test it yet as I am dealing with my day job
Is there any way to get a skill with sliders bars with Min <------------------------> MAX ?
Test with 20 because that’s a safe value. Then dial is back as needed.
@ DJ, OK will I set it to 20us when I test.
@EzAng, can you do me a test please set MAX_STEPS_FOR_ARC_POSITION to 5000 and try it please.
ok, just got back
Here is the results smiller29,
I uploaded to the Arduino code - MAX_STEPS_FOR_ARC_POSITION to 5000
As you can see below, I used On ARC under project, properties, I am using - Max servo positions - 5000
It works fine, forward and reverse - I suspect it going to the 5000 position then it stops - "horizonal servo skill" maybe what you want - you can stop this in any position if you desire, every 20 or whatever...
my "continuous servo" skill stops also after a while = again maybe it going to the 5000 position
It doesn’t matter what the max steps are set for. It will always send the appropriate pulse count. Again, if your stepper is missing steps, it can be a few reasons
the min pulse width is too low for your driver board
the stepper isn’t getting enough power and missing steps
the speed value is too fast for the Arduino (doubtful if it’s less than 3000)
one of the stepper coils is connected to the driver backward (or not at all)
You see, the get position real-time command will show the stepper's current position based on the number of steps sent. So if your stepper is off, you can view the get position in real-time and see that it thinks it’s in the correct place. That’s because it did send the steps, whether or not they were received or processed.
Unfortunately, the issue is at your end. You’ll have to read the suggestions I wrote in this post and test to find what’s causing your behavior. I don’t think there is any additional debugging information I can add to assist with the missing stepper steps.
OK I figured out what my problems were the stepper would not work correctly using full steps once it was set to half steps or less everything worked fine. I needed MAX_STEPS_FOR_ARC_POSITION set to like 20,000 to get the rotation I needed in the gearbox set for half steps. To turn the stepper shaft one full rotation MAX_STEPS_FOR_ARC_POSITION needed to be set to 600.
So I want to thank everyone for helping me out.
The sad thing is I need to come up with a better gear ratio because 38:1 is to slow using a stepper motor.
That's good to hear you figured it out. Wow, 38:1 is crazy! Stepper motors get pretty warm, so working them that hard might get toasty.
Did anyone get 2 Arduinos talking to each other and 2 steppers working yet?
Is it correct to load the Arduino code with #define BUS_ID 2 on the second Arduino? and Horizontal servo add V2 servo
is this correct?
read all instruction, tried many scenarios thanks, in advance
wow , I just checked , 7 hour later, I guess no one accomplished this
Automation Man, something is wrong, I tried so many connections and altering of code etc...
we need :
step 1 step 2 step3 and so on...
I wish that I could say that it is working with multiple Arduinos, but haven't been able to. Theoretically seems like it would work with the Tx of the main going to the Rx of next and Tx feeding back to the main but can't get it working.
I figured out why it doesn’t work with some arduinos. I can make a workaround if I have time later tonight.
the issue is that some arduinos have an onchip usb interface, and the rx/tx of pins 0 and 1 are for serial1. While other arduinos have a second chip to interface with usb and their rx/tx of pins 0 and 1 are for serial0
I’ll have to modify the firmware so they can communicate over serial0. And so the first arduino will need to relay all serial data from serial0 to serial1
Good thing we all have you in our corner You the man!! Everything else is working properly and this would be the final link
sounds great, be waiting, thanks again
Updated robot skill to v11 and firmware to 20221020
There's a new configuration section specifying the operating mode in the firmware. The modes are documented in the firmware comments.
Wow you're burning the midnight oil-it is appreciated by all of us. I think it might need a slight revision, tried to do an uncomment define Uart mode forwarding for my first Uno R3 and it came back with an error message exit status one serial one was not declared in this scope and for the second Uno R3 I uncommented Uart mode serial1 and it also mentioned serial one was not declared in the scope was I supposed to uncomment anything else relating to the modes? I uncommented only one at a time as usual.
thanks again Dj
Still one servo only moves, my 28BYJ-48 Unipolar stepper motor has a "step sequence" correct now,
the second Arduino is not receiving any data, can't figure this out
first Arduino is in TX
second Arduino RX
Everything is hooked up and lit up
any advice?
There's a new configuration section specifying the operating mode in the firmware. The modes are documented in the firmware comments.
v12 robot skill updated to include a "DTR Enabled" option in the configuration. It appears some Arduino require this setting enabled (i.e., Leonardo and Pro Micro)
It compiles fine now as they are both on Serial0 but the Arduino Uno R3's are still not talking to each other. Tried with enable DTR and without.
Automation man, I just tested, same results here, Arduino Unos are still not talking to each other.
tried:
#define UART_MODE FORWARDING #define UART_MODE SERIAL0
and just #define UART_MODE SERIAL0
Port: V2 unresponsive! (The operation has timed out.)
I just got the v2 to connect and my moter drive went out
I believe we all need a tutorial video on this one, like others we had.
no one has succeeded on this skill
I just got the v2 to connect, then my motor driver went out, have to wait to I get home, at my farm doing all this now.
tried 3 Arduino to see if the second one would connect, nothing ...
Yes this one is quite involved, seems like we're very close though.
Can we add the option to define the TX and RX pins if required for Serial1? The Seeed XIAO uses pin D6=TX and D7=RX.
The below is sample code for connecting to a Raspberry PI
Use those pins, it doesn't matter, and no changes are needed. That's how Arduino works - you can know that by following the links in the firmware documentation. Serial0 is serial port 0. Serial 1 is serial port 1. Please, I need you all to read the documentation in the firmware.
Suppose this documentation mentions pin 0/1 for serial1 or serial 0; that is the default for Arduino. If your aftermarket Arduino uses different pins for serial1 or serial0, it's still the same serial port. You can do that research by reading the documentation for your product to know what pins Serial0 or Serial1 are for your Arduino.
I see people using random settings and posting about them. Uncommenting multiple lines when the instructions mention one line. Or trying things like DTR when the documentation says it has nothing to do with multiple Arduinos on the serial network. It all comes down to not reading the documentation. We can fix bugs, but the best we can do to have your unique configurations work is by writing documentation in the firmware for you to read.
DJ I am sorry I did not know that pin 0/1 are standard pins in all Ardrino's that is why I said "if required" in my question. The reason I asked my question is because I read the instruction in the first place and you made a point to call those pins many times.
Thanks, smiller29, no problem. If you look at the Arduino code you posted, there’s no mention of pins - there are only SerialXXX references. I use example code to help me identify how things work. It's a great way to learn the basics to help with the configuration.
I wish there were an easier way to configure the Arduino for this to be a more straightforward process. But the most I can do is provide links and documentation because we’re covering a HUGE variety of devices with this solution.
There are thousands of Arduino, including aftermarket versions. There are thousands of stepper drivers, each with different electrical connections. And thousands of stepper motors. Plus, different power setups and other unique project configurations make this a difficult robot skill to make easy, as Synthiam does. With these hardware options, we’re trying to cover everything.
The proposed solution at our dev meeting was to standardize one Arduino model, one driver, and one stepper type. That way, there’s no configuration necessary, and it’ll just work. But that doesn’t mean it’ll work with your existing hardware.
I took over the development of this robot skill to keep it modular. It’s because this solution tackles such a wide variety of devices instead of one standard configuration.
DJ, I hear where you are coming from and as a former software developer myself I understand what you are dealing with making this skill work with so many hardware options. I have been reviewing your code and the Arduino functions to try and get an understanding where there could be a disconnect between master and slave TX and RX. At first look I don't see an issue, as it is pretty basic straight forward stuff. Is there a way you can monitor what's going through the pipe at both ends sending/receiving to try and debug it?
So in FORWARDING mode Serial is the incoming data on the USB cable and Serial1 is the Arduino TX and RX to the slaves.
MASTER = FORWARDING SLAVES = SERIAL1 or SERIAL0
I can't seem to locate more detail on function readBlocking() can you provide more insight as to what this is doing? I think I know but not sure.
It works great if you do it as documented
Connect the usb arduino tx to the slave arduino’s rx.
connect the usb arduino rx to the slave ardunio’s tx
And ensure you’re using the correct mode that matches your configuration by reading the documentation in the firmware.
Will do it I am still waiting for my second stepper motor hardware setup. But when it gets here trust me I will be testing it out. I have spent a lot of money planning on using this skill in my build so I need it to work for me.
It works for everyone that configures it correctly for their setup. There’s only two things needed for it to work
ensure the correct mode is configured for each ardunio
wire the serial network correctly
For example, here's one of my test setup responses. The Arduino #1 is a Mega, and the Arduino #2 is a Leonard.
Arduino #1
Arduino #2
See, it works...
A million combinations are based on the various hardware, but I test with all. The Mega is a good test for Arduino #0 because it can work in either Forward or Serial0 modes.
I updated to lucky version #13. I added more documentation in the firmware file that should be clearer about the three modes.
Preview the firmware file and review the documentation to ensure you have chosen the correct mode...
Master Arduino On the first Arduino, you should use forwarding mode if you have the RX1/TX1 pins.
Slave Arduinos On slave devices, if you have RX0/TX0 pins, then use SERIAL0 mode. If you have RX1/TX1 pins, then use SERIAL1 mode.
Also, because Arduino is a free-for-all with no standard, there is some device with 5v I/O and others with 3.3v I/O. That may cause an issue with a serial network because the 5v I/O will be much stronger. In that case, try to use Forwarding mode on the first Arduino and stick with 3.3v Arduino as slave devices.
I updated the robot skill and firmware again. robot skill is version 14, and the firmware is 202210222.
read all info many times
// SERIAL0 // ------- // This option will use the first serial port (Serial0) for all communication. Generally, this is used for Arduino's that have // on onboard serial driver chips. This means the first serial port (Serial0) can be used for both USB communication and the // serial network. // // Use SERIAL0 mode if all of these conditions are met... // * this Arduino has onboard RX0/TX0 pins
#define UART_MODE FORWARDING does not compile by it self #define UART_MODE SERIAL0 compiles #define UART_MODE SERIAL1 does not compile by it self
using SERIAL0 mode - compiles
using Arduino Unos
Arduino 1 - TX 1 #define BUS_ID 1 ---- v1 servo move forward and reverse Arduino 2 - RX 0 #define BUS_ID 2 --- v2 nothing
Ping: Port: V1 returned version 202210222 Port: V2 unresponsive! (The operation has timed out.)
I see my Arduinos are not the correct ones, I need a Arduino Mega
Same here and also tried Mega as master and still slave was unresponsive
Why are you using the mega in serial0 mode? The documentation states that if you have multiple serial ports that you should use forwarding mode.
Did you read my post above?
Forwarding mode does not compile here
here is what happens:
says
'Serial1' was not declared in this scope
and Serial1 mode says the says thing when I try to compile it
only ones that compile is UART_MODE SERIAL0 and UART_MODE Forwarding
or just UART_MODE SERIAL0 compiles
You get an error because you aren't reading the documentation. The documentation explains what happens if you get an error what to do. But you're not using a Mega, so I wasn't responding to you about using Forwarding mode. You can't use someone else's settings on your different hardware.
I don't know what else to tell you. I can't keep repeating "read the documentation" because it isn't helping. You can't use someone else's configuration for their hardware and expect it to work with yours.
On top of that, there are things I can't help you with because they're electrical - such as, are you mixing 5v and 3v Arduino? Are the Arduino's official or knock-offs? Are the UARTS holding the TX high with too much current, and the transmitting Arduino can't pull it down? Maybe you need diode's on the TX line? Anyone diving into using a complete custom hardware solution must learn to address those questions because there is no possible way a custom hardware solution can be modularized for a million possible combinations.
The robot skill works. Your hardware configuration, Arduino selection, or electrical doesn't work.
Here's what I'm going to do tomorrow. I will modify this robot skill to work with a specific hardware requirement for the Arduinos. It won't be as modular to support all hardware because that isn't working for the three people on this thread who can't figure it out. So once I standardize the robot skill for specific hardware, it will work, but you'll need that hardware. That's the best solution to put this to rest.
Okay I figured out what we’re going to do tomorrow. Here’s what you’ll need for the next modification of this robot skill tomorrow
master arduino must have a usb and serial1. No exceptions. If your master ardunio doesn’t have a serial0 and serial1, it won’t work at all as master.
the slave arduinos on the serial line will need a diode on every TX pin. Without the diode, it most likely won’t work for your hardware. So you’ll need a diode for every slave arduino on the serial network.
There are too many variables causing issues with the current open configuration. We will simplify the hardware by limiting the requirements. This way, it will work for everyone with the correct hardware.
I did use forwarding on the Mega but did not use the diode. I tried to find out what each Arduino was putting out from their data sheets but could not find it-30+ pages of in depth logic gates. Your guidance with certain hardware and a diode seems like a very good solution.
I enjoy all these projects,
I am not known as a quitter, but maybe enough time has been spent on this one,
thanks for all your help and thoughts
Time to sit back and see what Automation Man, SMiller29 and others come up with.
DJ, I have not tried the slave setup yet but I am pretty sure the current version is going to work without issue for me once I get my slave setup hardware. Also the main problem I had testing this skill I had my stepper driver set to full step and it was not working correctly. When I changed things to half or qtr stepping all the issues stopped for me with this skill. Yes I had some questions on some of the changes made to the firmware just to understand better. Please make sure you keep a copy of this version because I really don’t want to have to go out and buy more hardware to replace the hardware I have already purchased for this project.
This robot skill and associated firmware have been updated. The robot skill is version 15, and the firmware is version 20221024.
It is advised to read the documentation provided in the firmware file for configuring the Arduino to its appropriate mode. The schematic for connecting slave Arduinos with the required diode is posted in the manual above.
diodes are on the way to me for the rescue, lol
will test on Thursday
Automation Man, did you try this yet with a diode yet?
thanks DJ, for all your help and time
Bravo!! Very nice job! It's all working and making the motors dance now. I feel like I just graduated college all over again. Thanks again to you and your team for all of your help!!
Have some questions-While trying to get real time position I set it to a variable to repeat and check each 1/2 second but it is just showing the final destination even while it is accelerating. Is there a buffer inside of the stepper driver or Arduino that just takes all of the data in and executes it as it was programmed to or is the computer with ARC sending the accelerating pulses and direction to the Arduino. I had it working before and you could see the variable changing proportionately. Just trying to understand how it works.
You must use the correct command for retrieving the REALTIME information. The commands are labeled differently as they do different things. The command documentation is here: https://synthiam.com/Support/javascript-api/Servo/getPositionRealtime
In the future, you can find information about a command by right-clicking and selecting HELP in Blockly (which we notice you prefer).
This command was added in a previous release of ARC. You can find the release notes here: https://synthiam.com/Products/ARC/Releases
The specific release note for this update can be found here to ensure you’re using the latest software: https://synthiam.com/Products/ARC/Releases/ARC-2022-10-08-00-Early-Access-Runtime-21335
automation man, what size, v diode did you use?
5W 12V Power Zener Diodes ?
I would venture to guess that the diodes need to be sized to the max voltage and amperage (watts) being consumed by each motor or if it's logic circuit then the same applies but the diode could be rated much smaller. Over sizing diodes is ok. Then the other requirement is that they be blocking diodes.
(100 Pcs) 1N4004 Rectifier Diode 1A 400V Hole DO-41 are the ones that I bought from amazon These are on the logic side so they don't have to be all that big
I got Chanzon 1W Zener Diode Assorted Kit (30 Values x 10pc 3V 3.3V 3.6V 3.9V 4.3V 4.7V 5.1V 5.6V 6.2V 6.8V 7.5V 8.2V 9.1V 10V 11V 12V 13V 15V 16V 18V 20V 22V 24V 27V 30V 33V 36V 39V 43V 47V) Assortment Set
is this ok?
why so large? (100 Pcs) 1N4004 Rectifier Diode 1A 400V Hole DO-41 sure?
Synthiam Support, you're absolutely right I grabbed the wrong block- it's all working good now.
Ezang, The ones that you bought are probably more appropriate. As long as we don't overload them and with logic level voltage it's very low amperage. I think what happen is they were available quick so I ordered them rather than wait.
because this is on the logic circuit I would think these would work 1N4148 Switching Diode 200 mA 100 V DO-35 Axial 4148 200 milliamp 100 Volt Electronic Silicon Diodes.
https://www.amazon.com/gp/product/B07Q4F3Y5W/ref=ox_sc_act_title_3?smid=A2RFXKS6GNXFWP&psc=1
my steppers are only 12v - Bipolar Stepper, NEMA 17 with L298N H-Bridge
So I ordered from Amazon: Chanzon 1W Zener Diode Assorted Kit (30 Values x 10pc 3V 3.3V 3.6V 3.9V 4.3V 4.7V 5.1V 5.6V 6.2V 6.8V 7.5V 8.2V 9.1V 10V 11V 12V 13V 15V 16V 18V 20V 22V 24V 27V 30V 33V 36V 39V 43V 47V) Assortment Set - coming Friday
I just wanted to interject a few thoughts and questions about diodes to think about. Maybe this will add an opportunity for others (myself included) to learn and think outside of the box. No reflection on your choices of diodes at all.
Is a switching diode approiate for this circuit? From what I read a diode conducts in one direction only (uni-directional only in forward biased conditions). Zener diode is bi-directional (it conducts both in forward biased and reverse biased conditions).
Disclaimer: I'm not an electronics expert. Perhaps a switching diode will work but will it operate properly in this circuit? I would assume it will work if you place the band in the proper orientation.
I'm not sure what the intention of the diode in this circuit is. I assumed it was simply to block any voltage or signal backfeed. I would think a simple 1N4001 through 1N4004 (rectifier diode) would work nicely. Remember we can over size but not under size. Are you guys simply wanting a very small sized diode to fit better?
My conclusion is that both types will work. Another option would be a Schottky diode. They are quite remarkable in a lot of ways and are a super replacement for the common 1N400x diodes.
One last thought. From what I read: in a small silicon diode operating at its rated currents, voltage drop is about 0.6 to 0.7 volts. The value is different for other diode typesSchottky diodes can be rated as low as 0.2 V, germanium diodes 0.25 to 0.3 V, and red or blue light-emitting diodes (LEDs) can have values of 1.4 V and 4.0 V respectively. If using as a simple blocking diode then voltage drop is not an issue.
Technically, you can also do the serial network with one wire using the same hardware. This photo demonstrates
Since Stepper servo is working great I'd like to request continuous rotation for the stepper servo skill. Seems like the software in the Arduino could be modified to transmit a speed rather than a location. Thanks, Don
You title your request as "Stepper servo Continuous Rotation". I've never used a stepper motor but I do know they can turn continuously. This seems like a valid request if this skill doesn't support it. Thinking it through though (and again I don't know) I'd think that once a stepper runs continually you would have to re-home it to get it to stop at a wanted position again?
I haven't used this skill but looking through the instructions, can't you already set the speed (and acceleration) under the "Advanced servo Features"?
Yes you can post a speed but you are limited to the max amount of positions and then it will stop there are times when you just need a motor to turn a certain speed and don’t care how many steps it took to get there -ie lathe I can do this with other drivers but I would prefer to do it with ARC
Discussion about the stepper motor running continuously has been moved from Feature Request to the appropriate robot skill thread.
Automation Man, what was your Arduino connections?
EzAng- Mega using forwarding, Uno using slave serial0 and I used a breadboard for the resistors and diode. Mine is a bit different from yours because mine is step and direction, but yours should work fine. The hookup was per diagram above.
Synthiam Support the Stepper servo and Continuous Rotation Stepper are two totally different things. The max rotation on Stepper servo skill is about 25k steps and and continuous rotation stepper would do that in a 5 seconds with motor having 800 steps per rotation. Not sure if it will ever happen but I thought that I'd put it out there to request it. It would be great if it were created though. I know EzAng was asking for it also.
Actually, they’re correct that it is a discussion for this robot skill. I don’t know how they’d be able to make it work anyway. Because there’s a maximum number of steps that can be logged. There’s a driver that is moving the stepper and keeping count of the steps. That’s how it works.
The driver uses a signed long variable type. Long variables store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647
so even if the code were to be modified for some type of lengthy rotation, you’d have a maximum number of steps per direction anyway.
Why would you want to use a stepper motor for continuous rotation? That’s what regular brushed or brushless motors are for with a motor controller. Such as an hbridge.
Ok understand. The reason that I wanted it was that it remains constant speed under load but I will just do it a different way.
That’s true, and get really hot
what you could do is a custom firmware that takes the ARC swerve position and pauses between each step. The motor will get super hot but that’s the sacrifice you get for the torque. I can write something for you
I wonder if it is possible to somehow incorporate the use that ratio function as a multiplier so that you would get a very large amount of steps as needed and basically create continuous rotation The stepper that I am using has a minimum of 800 steps per rotation so I can only get about 32 rotations which is a bit limiting when you use a 4ft ball screw The stepper I’m using is a hybrid with an encoder built-in so it is keeping up with the amount of steps very easily
Hi, Automation Man,
not many people tiring this,
I am using 2 Arduino unos, maybe that is the problem
need a Arduino Mega
Simply put, my Arduino unos do not qualify for this project according to the Documation - MASTER_FORWARDING
I feel your pain and some things that I noticed is that you need to go into The stepper servo panel and save the comm port sometimes a couple times The slave serial zero should work on its own for testing purposes since you already have that master working just need to get the slave working individually after you get both of them working individually then you can hook them both up master and slave -it’s a process
You may want to try using non Zener Diodes in your setup because they work different than standard diodes.
Simply put, my Arduino unos do not qualify for this project according to the Documation - MASTER_FORWARDING, need a Arduino mega
I quit on this, don't want to invest more money into this. Thanks for all your help I am not using this in any robot project.
I like testing DJ's Skills
PS, DJ said, you can’t use "continuous servo" with this stepper motor.
Sorry I didn't see the last sentence that you were done with it. Each device will make it's own comm port. I put a piece of tape on each and write down the virtual port and the comm port so there won't be any confusion later. V1 is already taken by the Master. Getting closer now, just slow down take your time and hook up the Arduinos like the diagram switch the comport to the original master you may want to have multiple slave Arduinos in case the Rx TX is not working on one of them
In the past when I've had issues with com ports I've had some success by deleting the assigned ones in Windows. Then the device will reassign a new one when plugged in . In truth this will probably not help you as this would only he a problem with older software having problems finding higher numbered com ports or a device has too many ports already assigned to it. I don't think ARC would have this issue as it's so polished. In the latter case you have probably a few com ports assigned to the different devices because you have moved them around a little. Anyway it couldn't hurt to try. Here's an artical article telling you about it and how to delete the ports:
How to delete com ports
If you use the schematic that is posted above, only the master device needs usb to the pc. The slaves are powered by the master. That will remove any confusion of ports
DJ, Could you show me how to customize the properties value to higher than the 25k max limit. This would help in many different ways.
Nevermind, have it figured out and I understand how there are limitations with the integers/registers etc. Thanks, Don
Got both steppers working
Excellent - oh, to answer the Automation man's question, I didn't see that before. You can increase the number of servo positions in ARC. The maximum number of servo positions ARC supports is 2,147,483,647
Congrats EZAng, DJ, Great that is what I was looking for!! Thanks. Also I'm getting close on garbage can bot. It moves it around now no problem, fine tuning the Better Navigator and Camera Pose.
I received two Arduino Megas, that was the answer to my problem, lol
I tested it without a diode, it still works
Also I uploaded same code on both Arduino Megas, got both steppers moving forward and reverse at the same time on v2
What is a garbage can bot Mr. Automation man? lol
A Bot that takes a large, green, heavy trash can from garage to the end of the driveway and then parks itself back in garage. After they empty it, the bot then goes and retrieves it and puts it back in it's place in the garage. So far I have encountered issues with backing it in place because The better Navigator only like to go forward. Will probably have that as a separate script.
DJ, I have been experimenting with the stepper servo and think that the Arduino code may need to be modified to get a higher value than two to the 16th power because it is limiting the amount of steps to 65,535
also, if you are trying to calibrate position 1in Blockly, won’t it need to know which stepper V1-V20 etc currently, there is no way to pick which one
How is your garbage can bot coming?
Hi there EZ, Mechanically it's all working fine and runs around the driveway and garage nicely. Have hit a few issues that just need to be fine tuned. The Better Navigator works pretty well in the garage but when I took it outside it was unaware of where it was on the driveway so I need to experiment more with it. Had to work out the acceleration so that is doesn't jump after it heads towards it's destination. Working on remote scenario so I can control it through another computer but I use a Mac so it's still being looked over by apple. I work on multiple different items at a time because I get bored/ or in a rutt if I work on something too long. Sometimes the best thing you can do is put aside and then let your mind figures it out on it's own. The name Automation Man is what I should have done but I don't do it for a living. I build nonlinear circular stairs for a living. Did Electrical engineering in college and machine tool in high school. Mechanical things are kind of my wheelhouse as I'm sure you're good with them also having to work with things on the farm. You should realize that you now have a high technology with the stepper servo skill and you can do many things with this. Take care
DJ, Will you be updating the code for max number of steps or should do it on my own. The question that I have is do I just replace the 65k number with say a 10 million? Do I need to change anything else to handle the higher number as it will be using more registers?
Hmmm - let me take a look at it tomorrow. ARC was updated for a few billion servo positions, but I don't think this was. It might also need an update in the robot skill since it seems to be mapped.
Thanks, appreciate it. it would also be helpful if I could do a ControlCommand() starting position V1 (1)whenever I wanted this way it will allow me to get the limit switch to close and I can make the decision whether I want it to put in position one or not basically let me zero it out whenever I want it Currently I don’t think there is a way to specify V1 - V 255
In real life terms, it would probably be better to have it go to a user defined destination example if you are using 2 million then it would have have it go to a centerpoint of 1 million if it is possible to do it that way that would actually be better otherwise, if you were trying to have it go in reverse, you would have to go forward 1 million and then have it go in reverse from there. As is, it is like a big circle.
This robot skill has been updated to use the ARC max servo resolution of 2,147,483,647 positions. The latest arduino firmware must be installed for this operate correctly.
I appreciate you updating the plugin and the Arduino software. I updated both of them on my end and used the same number settings as the previous working model but unfortunately could not get it working. I'm pretty familiar with it all now and understand it. Had it rotating on power on so that part is working but it's just not rotating when it's told to. Could you please verify that it does work on your end and if so then it's on my end. Maybe EZang can try to get it working also. It is going to be a very cool skill with over 2 Billion positions once I do get it working. Thanks
Automation Man, I can give it a try when I get back, I see the latest arduino firmware must be installed for this operate correctly.
Any luck? The changes would have been tested.
Ok, if the changes would have been tested then it's on my end. I thought of one possibility is that in the Arduino software I may have put 2 billion but in the ARC software I experimented with 50k max which may make a difference as it's minuscule compared the 2 billion. It seemed like it still should have moved though and it shouldn't have mattered. I verified that both softwares were updated as it states the date in ARC and and I scrolled down to see the larger 2 + billion in Arduino. I will have to put it aside for a few days as I have to go out of town to see my mom. On a different note inside of the Arduino software isn't there a specific line of code that pinpoints where it sets it to position one. Could you please show me where that is. Instead of position one couldn't that be any position within the max positions? Maybe have a switch on pin 7 that goes to a set position within that range and have that as one of the questions near the top which you can take off the //. It could be very useful.
Isn’t it supposed to be 32 bit
I don’t understand your question. Can you elaborate
Could this be the reason that it may not be working for me, wouldn't 2 billion+ need to be 32 bit although you already said it was tested so it's probably not the reason.
ARC uses a max servo position setting of 2,147,483,647, the value of a signed 32-bit integer. The robot skill uses the same 2,147,483,647 value for mapping, allowing you to use 2,147,483,647 servo positions in ARC.
You can see the 32-bit value transmitted in your screenshot as four different byte values because that's how computers transfer information. A 32-bit value is a 4-byte value. A byte is 8 bits. So if you were to multiply 4 x 8, you would get 32.
You can see the 32-bit value being split into 4 bytes by bit-shifting. The robot skill and the Arduino source always had 32-bit communication for the mapping, but it used a small number of 65535 instead. I'm not sure why it used such a small number, but maybe because that was the most considerable servo value at the time of the robot skill's creation.
When you connect the robot skill to the Arduino, can you PING the controller? Does it respond?
I tried to do a total shut down to see if that would help and this is what it mentioned
I tried to ping the V1 and V4 and they returned version 20230117 but I just could not get any movement from the motors They do rotate on startup and I have to ground 6 pin out to make them stop Strange seems like it should work
Ezang did you get it working? It doesn’t work for me. On a different note, how are you supposed to calibrate it in Blockly when it does not give you a drop down for which V1-V125 nor does it give you a drop down menu for set as home V1 -V125
Sorry, still not at the place where my robot experiments occur. Maybe next week.
I think you're referring to the calibration on startup. If so, pin #6 is the default pin for the limit switch. If you do not want calibration, you'd have to disable it. It is disabled by default, so you must have enabled it at one point. It's documented in the Arduino file
Yes I totally understand grounding pin 6 to calibrate to position 1 and trying to not do it this way(calibrate on power 0), could you please do a hypothetical scenario wheres I want to calibrate V1, V4, V5, V8 at different times in blockly. What I'm try to show is that it can't be done because there is no drop down menu to pick which Virtual port to do. I'm trying to make things predictable and turn on a single motor a time and set the position 1 as needed.
Also what I was trying mention is that if it can be set to position 1 it would be more beneficial to be able set it to any user defined position. What if you would like to put your limit switch 3/4 down at then of end of a 16' gantry and would like to set it to position 8750. Maybe that's asking for a lot but it would be nice.
This robot skil doesn't work in blockly. Robot skills that have parameters for ControlCommand do not work in blockly.
You will have to use javascript, python, or ezscript. Just use the ControlCommand manual and see how easy it is. You'll eventually start doing things that Blockly can't do - beyond blockly, as they might say! Sounds like a good movie title
Got it! My concern was once you go to javascript then everything had to be done that way, but after experimenting I've found a way to combine the two languages. This opens up new roads, thanks.
Oh yah you can call JavaScript from Blockly. Good idea. If you make a robot skill that executes the commands, you can call it from Blockly ControlCommand block
did You get the stepper working?
Yes that's what I did. I used to use state logic programming software and had 23 pages of programming, looking back I can do the same thing much easier with 2 pages in Blockly and that is why I use it. have not been able to get stepper working. If you get 10 minutes and can try it yourself that would be a big help. As you can see (screenshot) when I tried to save it had an issue with 32 bit-not sure what that is all about. This year I will be making some really nice large 6' robots but I will be needing this skill to be working properly.
Sure wish this skill would work, but it does not work anymore since the update. I am very familiar with all of the settings and it was programmed with the same settings as the older versions except with the updated the Arduino software and also the ARC plugin. Have tried multiple times to get it to work but have had no success. Some help with someone trying it out would be appreciated.
I heard it worked when tested - I can take a look if I can squeeze it in maybe early next week. Say Monday or Tuesday
That would be a big help. Here are a few of my observations which may save some time. The motors turn when powered on as they are supposed to for a limit switch (pin 6). I did this on purpose to verify that the Arduino was hooked up properly. They do ping. They just do not move to the location given from ARC.
Did you set the ARC project to the max position of 2 billion? Because I doubt you'll see a stepper move if you did. What is the max position that you have ARC set for?
50,000 is what I had it set for. What is the reason that you would not see movement if it were set to 2 billion?
haha yeah you'd see movement but it would need increments in the thousands or tens of thousands haha.
I actually might have a bit of time tonight or tomorrow day to give it a shot and see what's up
I don't know if that's quite right because if a stepper needs 1400 pulses/steps for one revolution. If you were to have ARC tell it to move 1 million pulses then it would move 1mill/1400 for revolutions=714 revolutions. Having the ability to have billions would mean it could run nonstop for days. But it's Friday and I've been sippin, you are the genius behind all of this that knows so much more than we'll ever know. How you put all of these things together is amazing. Your help is appreciated.
We might be talking about two different things. It's been a while, so it wouldn't hurt to revisit the manual above.
You asked for an increase in resolution from ARC to the stepper. That is a setting in ARC in the My Robot Properties menu (https://synthiam.com/Support/ARC-Overview/Project%20Menu/My%20Robot).
I think what you're thinking I'm talking about is the setting in the firmware for steps per position.
When I had it working with the older software I did a lot of experimenting and understand that you need to increase servo positions in ARC to 50,000 and also Arduino max steps to 50,000 which would give my 1400/rev stepper 35.7 revolutions-which doesn't go very far with a ballscrew. Am I incorrect to say that to increase max steps in Arduino software to 2 billion you would also need to increase max positions in ARC to 2 billion so it would be able to rotate 1,428,000 times? Any luck with getting it to work with larger numbers?
I decided to do non-work related things for the family holiday weekend.
It’s all good, no worries
Finally made it back, 2 steppers ping and run again.
2 Arduino Megas first Arduino Mega - Tx1 to second Arduino Mega Rx1 first Arduino Mega Rx1 to second Arduino Mega Tx1
EzAng
Yes, that is the old software that worked. Try and download the new software and see if you can get it running.
here what I get - error on the program
I am sticking with the older version.
I see DJ is having fun https://www.youtube.com/@DJSuresI may have to go back to the older version also, but it is very limiting. Was trying to avoid that.
Hmmm ezang, you’re trying to load a plug-in as a project. It looks like you changed the association of the plug-in files with ARC files in windows.
im guessing a reinstall of ARC will fix it - I think. Im not quite sure. Otherwise, you’ll have to re-associate the file extension to the plug-in manager manually.
automationman, I have some changes for the plug-in. I’ll update it this evening for you.
also, what is the Arduino ide version # that you’re using to compile the firmware? Are there any warnings in the log when compiling? Specially about integer overflow.
Im wondering if the Long used in the Map is incompatible with some ide libraries. Similarly to what some other ppl have noticed with Map not knowing the difference between Byte and Int on the Map override. That’s in another thread and pops up quite often.
This skill version uses the firmware version 20230117.
works well
just went to project, add, stepper...
I deleted stepper motor for all my projects, then uninstalled it and reinstalled it.
thanks
Ez When you ping it, it is supposed to say 20230117 which is the latest update. Although there may be a new update coming soon.
Hmmm, this is strange. I can get the firmware to work on the developer's IDE version. But it will not work with my version. There must be some peculiar difference between the MAP() and LONG variables.
I'll have to try a few more things - I'll probably rewrite the map function for long. Stay tuned - I'll have something in the morning, I believe.
Arduino is garbage. I removed the map between ARC servo positions to the firmware with a static value. Instead, each stepper/servo has its own max steps configuration in the config menu of the robot skill.
That is some deep programming skills and I think will actually make it easier to access. Personally I will be using this skill very often and will make these motors do all kinds of things. Will experiment with it in the next couple days if it's all done. Thanks
Hi Automation Man
You said
If you read above my does say this skill version uses the firmware version 20230117.
I see we up to version 18 now.
As you can see below, this does not say 18
Yes, the ping version reveals the date issued if you have time see if you can get the latest up and running
you said:
I thought I am using version 18.
the ping
what is this version 20221024?
October 24 year 2022 is what you are showing, which is not the latest there was another version in January and another version I think today
funny, my ARC updated the program. It says this skill version uses the firmware version 20230223.
I have 2 different versions: 2023023 and 20221024 look below:
Show me your ping.
I do have the new
Again, I uninstalled the stepper control and the reinstalled it/
@ezang, you're not using the latest firmware. As automation man said, your firmware is from october 2022. The latest firmware is 20230223, which is today.
My control does say = this skill version uses the firmware version 20230223.
when I ping it says: 20221024
steppers still work...
This robot skill has been updated to version v19. It displays a message that is more clear to the user when the firmware needs to be updated when using the Ping option.
Boom, worked like a charm! The motor is dancing again. I didn't have time to install it on a second motor but I'm sure that works just fine also. Big Thanks!
I deleted ARC form my computer a few times, even deleted it out of regedit - deleted stepper control and upgraded it
reinstalled it now.
This robot skill requires the stepper motor Arduino's have firmware version 20230223 installed.
My control does say = this skill version uses the firmware version 20230223.
when I ping it says: 20221024
can't understand it, My steppers still work great, however.
Did you download the Arduino update? It is in the middle of the skills page. You have to scroll down quite a bit and then download that into your computer and then into the Arduino and that will update it to the newest version. And then you also have to update ARC plug-in as a separate item
it was the Arduino software that need to be updated
It worked!!!! great
@automation man - would it make more sense to change it from "max steps" to "steps per position"?
So right now, if the max steps are 15000, then your range between 1-180 is between steps 1 - 15000
But if I change it to Steps Per Position, then it feels like it would be easier to manage. What do you think?
Thanks for asking. I think that there should be two totally separate sets of properties because they do not mix very well. For the typical servos there is 9us to 1 ratio which is fine and dandy for most people but if you do that with the steppers you are defeating the purpose of having the ability for high precision. I think it should be a 1 to 1 ratio on steppers and have at least 10 million available. Even at 10 million with 1400/rev that is only 7142 revolutions but enough to do a ball screw. The properties section for steppers should be within the skill itself so as to not get people confused and it would be separate from typical servos.I have some motors that actually can do 40k steps per rev so it wouldn't take long to fill up that register
I’ll change it to steps per position and put this skill to rest.
I guess that I'm kinda bummed out because we used to have 50-60k to work with and now we will have 15k to work with. Is there any way to have the ratio scenario in the advanced section working so I can get more revolutions?
Have been thinking about it a bit more and wonder if you're talking about max positions divided by a 15,000 scale. Example 15 million/15000 positions which would make sense. That would be very helpful.
There's 2 billion stepper positions, because it matches the ARC max servo position setting. So maybe you're refering to that? If so, I’m sorry but if 2 billion stepper positions isn’t enough, there’s nothing more I can do
2 billion Wonderful!! U da man!
Okay phew. Take a look at the top manual on this page about how the stepper position is calculated. I think the way it is now is best. All you do is specify the number of max steps you want per stepper (up to 2 billion). Then, in ARC you specify how many servo positions you want, up to 2 billion
Ok understand how it is calculated 1 for 1 which is the preferable route and it can also be set as a ratio. I experimented with it for a few hours and up to 50,000 it works as expected. I realize there are 3 different areas to change settings, main properties area, Stepper servo config area and then on horizontal servo max positions. When you go to 500k, I mill, 10 mill etc, it does not rotate as much as it should. It's almost as though there is an internal max of about 65k which is 2 to 16th power.Have all max servo settings in Arduino been moved to ARC or maybe there is one somewhere that may be holding it back? It should be rotating a very long time for the 1 mill and 10 mill but unfortunately it's not. Example-If the max servo position in ARC is 1000, position set to 1000, max steps 1mil for properties and 1 mill in configl= result is 1000 individual steps not the 1 million as described in the manual (ratio method). Same result with 1=1 method. Please don't be mad at the messenger just reporting my findings.
There’s only two places for settings as I’ve described and in the manual above. ARC properties for max servo positions and the robot skill for max stepper positions
Ok let me try that, 1 million in ARC properties, 1 million max servo positions and 180 positions should result in 500k if 90 is input as the position.
Tried it and it only moved about a quarter turn 180/(800 steps per rev) ratio method should have turned it full amount at the 180 position but it turned it 180 steps instead. Had to put my hand on it to verify that it actually turned. Tried changing positions to 10k and it move it 12.5 rotations.
the good news is that is it is far enough along to control a 5 motor bot that I already made and you’d get a kick out of
I now see the specific code that sets the position and it helps when analyzing what is actually going on.
I wonder if the stepper motor driver is only 65535 steps? It accepts a signed long, which is 2 billion on the plus and minus. But I never considered that the driver itself may be limited to 65k.
Not quite sure what is going on but it is working fine under 65k. The driver is a typical driver that they use on CNCs. With G code I think the they break the movements down to very small amounts and they are probably relative movements. If your movements are + or - 2 billion then that is actually 4 billion posiitions. I haven't tried the - movements but it is good to know. If you have someone experimenting see if they can get it running continuous for 60 sec + or over the 65k positions. I will keep experimenting, and the bot is coming along. I like the 1 to 1 ratio (no scaling) as it is very high precision.
No, 2 billion because it’s the positive side of the signed long.
as I said it seems the stepper library is treating it as a unsigned 16 bit.
This is definitely your domain and you would know, I defer. On a different note have you ever seen Moasure https://www.moasure.com/products/moasure-one I can see lots of possibilities if ARC were able to communicate with it.
I'll take a look at the stepper motor resolution in the library. I really dislike working with open source projects, and this is why. Soon as I look into the open source stepper motor library, I'll end up re-writing it to make it actually work as intended because open source projects do not receive the level of quality control that a real product would. It is too time consuming to keep rewriting code that others have butchered
Once you have high standards like you do it is very hard to go backwards and try to use other peoples code. As a guy that used to work for me mentioned "You're trying to make chicken salad out of chicken sh t. For now the code is working adequate for the rotation that I am using (less than 20). Thanks again
Just an update-finally figured out a way to have motor travel full length of a 20" ball screw. I now remember how steppers have low torque compared to permanent magnet motors. For me If I'm not using Nema 34s then I'm just going to disappointed in the results. Accuracy that's what I'm looking for and they have it. Whenever you have time to modify or rewrite the code some things I've noticed. The project max positions when using steppers-- what's the use it just complicates things. If it's possible to have the max positions listed right there in the virtual list and that's it that would be great. Example I have one 20" ball screw which needs 64k position but my other motors need 8k.If I make project max pos 64k then all the other motors are scaled. If you want to go 64k just put in 64k well it doesn't go 64k only 32k. If you try to combine the 180 position servos with the 64k max it barely moves. If it's possible to have the virtual separate from D1... servos would be a big help. A simple goal would be to put in a value of 10k and it moves 10k put in a value of 63k and it moves 63k. I forsee many projects with this skill. Thanks again
Each stepper has its range in the robot skill - I think you forgot that setting. The stepper only gets the range specified in the robot skill configuration. Stepper on v1 can have a range of 1500 steps. Stepper on v2 can have a range of 234232352 steps. Stepper v3 can have a range of 5 steps. You decide per stepper.
The servo position range in ARC results in the resolution between the range of each stepper.
I only wish that were the case but I did remember that and do set each one individually but the project max positions seems to take over. If that was your original intention for stepper max to be the max, then great because that exactly what is preferred. The project max positions seems to be overriding it and then it get divided by the stepper max positions.
I did some more experimenting and it confirmed what I was talking about.The project max positions does play a part in how much movement the ballscrew will travel. A possible way to change this could be an added line in code something like this. If V3 max positions (set in the skill) is less than project max positions then use skill max positions in the equation. Example Project max 64k, skill V3 max positions 16k, Low amount 1, High amount 16k. It should go 16k steps but it doesn't it only goes 16/64=.25 1/4 of 16k=4k steps. But if skill max pos<project max=use skill max in equation. The result would move 16k steps. This could be a checkbox in the skill itself to use an equation like this.
Have the 5 motors dancing now and doing some experimenting, had a question. What is the proper javascript format to home a typical virtual V5 etc?
Trying to use Auto Position for movement and it is taking about 15 seconds to send out a movement of 1 to 1000 which usually takes 1 second. Have tried to change the steps to 1 in Auto Position but it does not help. Makes the Auto Position basically unusable. I don't like being on the forefront because it make me look like the bad guy but all I'm doing is pointing things out.
Something to consider on the next update is to have the Virtual ports on the software start at 1 rather than center point. Example-If you are using 65k for max the software will startup at 32,500 and your steppers will be off the races. Maybe just a questionnaire of where you would like it to start while setting up the virtual port would take care of it.
A simple way to verify what I'm saying is to have it in frames of Auto Position and and have realtime update with a few Virtual ports and it will be very obvious how slow the virtual ports move. It would help a lot if this was working properly.
Maybe you didn't know this from reading the ARC manual, but you can right-click in the stepper box and manually enter a value with the keyboard. You do not need to drag 65,000 of them.
Regarding your message about setting Auto Position to 1 and claiming it took a long time is correct. that would be the absolute slowest you could make it move. 1 is the smallest positive integer value in mathematics. To move something by Step 1, would be like counting by 1 (i.e. 1, 2, 3, 4, 5). If you set Steps to 10, you'd be counting by 10's, and that would be faster. If you used Step 100, you'd be counting by 100's, and that would be even faster.
The delay is delay between steps. So if you have a value of 1 in delay, that would be fast. But if you have a value of 1000 in delay, that would be very slow because it would pause 1000 ms per step. You have to tune these values.
Ok, on the right click and have been doing that. On the steps I must have misinterpreted it and that may be the problem. The delay I had correct. Will retry and hopefully takes care of it, which would be really nice. Thanks
Ahh that was it. I interpreted it as 5 would take 5 steps to get there and 1 would take 1 step to get there, my bad. It's so nice to have Auto Position working again!!
It's getting fun now. I'm pretty sure you'd get a kick out the various things that I'm working on. Thanks again, Don
Oh i'd love to see! Create a new general post to show your stuff off I bet everyone is wondering
All in due time. The automated lathe which I made from scratch worked very well,
is looking a bit primitive to me now. There is always a first phase which works out the bugs and does the proof of concept. I am building revised versions of the many different machines/robots etc. with upgraded bearings, motors to handle heavier loads and very little backlash. You would have a field day programming them, but first they need to get built. Here is the final product picture with 850 tapered Ipe spindles. I don't know why it keeps rotating the picture.
Personally one of the cool machines that I recently made was a 17' gantry with 360 degree rotatable saw with 10" blade and it can go on a 45 degree angle. Well I build all different types of stairs and they need stringers. They have a rise and a run at very precise angles say 36.33 and 53.67 so I plunged the saw but that only cuts part of it so it had to go a very specific vector with the saw at a specific angle to finish the cut,... that one was pretty cool, onto the next one.
Holy moly that is real wild to see! Thank you for sharing! It must have been a lot of work. You're very talented! It's funny how the image is sideways - makes it look like an MC Escher sketch lol
Thanks, appreciate it. Here is a little more eye candy which that my son and I did.
Each tread is independant and does not touch any other tread, they are all just connected to the wall. The belly spindles offer no support.
@automation man Incredible work. Amazed to see the floating stairs in the last picture. Beautiful.
Thanks Fxrtst, we all have things that we do to make a living.
The Synthiam platform for making robots is great, wish it was around many years earlier! Things that were put on the back burner till the technology (that is cost effective) caught up are now coming to life.
Updated robot skill to v20 which sets the internal ARC servo position to 1 for the specified ID after Calibrate or SetAsHome controlcommands are set.
I wonder if something similar is happening with the project max positions which may not be sent to the Arduino. If it is not being sent maybe it is defaulting to 16 bit which is about 65k. It would be nice if was able to work properly past the 65k mark then I could get higher resolution.
version 21 of this robot skill has been updated to use the virtual servo ports as ControlCommand() parameters for SetAsHome and Calibrate. They used to use the BUS_ID of the firmware, but now they use the virtual port, which was causing confusion.
The Homing and the Calibrate work
great now. I think that I may stumbled upon the reason that max position is only about 65k. In the older version of the Arduino code there was a line for defining max positions in the newer code there is no such line so it probably defaulting back to 16 bit. I tried to insert it in the newer code but there may be another part of it to define it.