Driving Stepper motors

Hi -

I am quite new to Particle, so my apologies in advance for any stupid questions. I was hoping anyone might have recommendations for shields/drivers to drive Nema steppers at 2A.

I am upgrading our current system form Arduino to Particle and am not too familiar with shields/drivers available yet.

Thanks!!

Hi Postler -

Thank you for the post, I will look into it. I am familiar with the A4988 as I used them in some Arduino projects in combination with CNC shield.

I am considering getting the Particle classic adapter and add CNC shield to iet again, allowing me to use the same drivers. I need 2A per motor as they have very heavy load on them. Will post my findings, net to Particle and eager to learn :slight_smile:

Thanks again.

Not sure if you really want that.
What Particle devices do you own and what shields do you want to plug them into?
The Particle Classic Adapter is meant as a means of inserting the new Generation 3 of Particle devices into shields that were originally meant for Gen1 & 2 devices.
If you want to get a smooth start with Particle devices I'd recommend going with Gen2 Photon for now.

Hi ScruffR -

Thank you for the feedback. I ordered some Photons, Xenon, Argon, 3G kit and whole bunch of smalls. As many of my projects involve larger Steppers (Nema 23 and up) I got quite used to running them of CNC shields with 2 x DRV8825’s per motor (for redundancy). I saw the shield below on one of our leading sites in South Africa and though it might be a way to run steppers as it does not seem there is something within Particle’s arsenal to driver steppers.

I always prefer sticking to closed environment as far as possible, but seems for steppers I might have to look outside?

To be clear, I wont be running an UNO and Particle, would be overkill. The shield will accommodate the Photon and then the CNC Shield with drivers

Appreciate the advice!

I see, in conjunction with a Particle Shield Shield this makes some more sense.
The only thing using those two shields together to talk to a Arduino shield may require some mental gynmnastics due to the multi-level remaping of pin assignments :wink:

ScruffR -

haha… just what a complete newbie to Particle environment wants to hear :rofl:

I will look into skipping the shields, it just looked like quite a neat way to do things. The only wires required then are PSU to shield and wiring to Stepper. This is quite an interesting project for us stretching far beyond the Steppers. It has been working well so far on Arduino-based products, but I am eager to move to Particle so thought it might be a good idea to switch this over as well.

Can you give us a link to the stepper shield you intended to use?

Since you have some Photons on your list and the Particle Shield Shield was created around that controller, it shouldn't be too confusing - I'd just not start off with the Argon/Xenon plus Classic Adapter to remove two variables from the equation if things should happen to not work immediately :wink:

For that: As you see, if you should happen to run into problems, this community has always been prepared to jump in - and I dare say with incredible turnaround times too :sunglasses:

2 Likes

ScruffR -

I have been reading up on the differences between the controllers from which I gathered the Photons would be used on each component (in this case Augers) and the Argon could be set up to be gateway?

Herewith the link to the CNC Shield. As I mentioned, this configuration is not cast in stone, it was my first (and maybe way to ambitious) project with electronics so I relied heavily on YouTube and Google to guide me :smiley: I just though I have the hardware, the Shields and Drivers seem to be doing an good job, just wanted to upgrade the controller and move to WiFi (or Mesh) for comms as apposed to serial comms over cable.

CNC Shield

Glad to see such willingness to help. I have not had the same experience on “other” platforms. Actually have another project I am busy with that I might move over to Particle based purely on my experience in the forums so far.

Regards,

2 Likes

I see why you are using the CNC shield… a quick search shows that not a lot of stepper drivers get up to the 2A you desire.

Since you have new mesh devices, the Adafruit stepper featherwing is a good option if you can get by with up to 1.2A (2A peak).

There’s also a tutorial:

2 Likes

Hi -

Thank you for your advice, I will look into it. At the start of our project, we used the Arduino Motorshield (also 1.2A if I remember correctly) which yielded very poor performance on a Nema23. Might also have been due to the fact that it was the very first bit of code I wrote using C++ :rofl:

In addition to the stepper, we also control three relays and a sensor (controlling solenoids) from each microcontroller. These in turn communicate with a master for further instructions.

I will set up the Motorshied quick and see if I can get better performance this time around, then I will most certainly look into Adafruit stepper featherwing.

Thanks again! Looking forward to this project.

There might be a slight misconception.
Photons (Generation 2) are meant to be used as standalone devices with a WiFi and cloud connection each with your WiFi AP to act as their common gateway and/or local router if you can accept unencrypted local communication.
And Argon (Generation 3 / Mesh devices) on the other hand - while being also usable standalone - is foremost intended to be used in conjunction with other devices of its own generation (Xenon & Boron) to create an independent mesh network with only a few dedicated devices acting as gateway to connect that mesh network to the rest of the world.

So an Argon can't be used as gateway for a Photon but if both have an active WiFi connection they can communicate that way.

2 Likes

Hi -

On closer inspection I see what you mean. I have to get a better understanding on how the Particle environment works compared to Arduino. In our case the upgrade from Serial comms to WiFi would simply mean adding ESP8266 modules and a change code for comms. The Gateway would be the local WiFi router (less than Ideal as I would prefer these not to be exposed on the local WiFi Network). From here the 4D Touchscreen we use to control the system would be the master and the Uno + CNC shields then slaves. The Uno’s do not have to communicate with each other, only with the master.

In this setup, if I understand correctly, best would be to go with Argon as gateway and Xenon for end points (augers) ? Or no Gateway at all and simply use Photons (or Xenon) to connect to the local Router?

My apologies for the newbie questions :blush:

1 Like

apart from the fact that Xenon has no WiFi connectivity, that would be the Argon.

Xenon ... mesh only (IEEE 802.15.4)
Argon ... mesh plus WiFi
Boron ... mesh plus Cellular

any of the above can be used with an Ethernet FeatherWing for wired network access.

Hi ScruffR -

Great, got it - I think :joy:

So either

  1. Argon as gateway with Xenon end points OR
  2. Local WiFi Router with Photons all over (or Argon)

If I go with option 1, can I set up Argon as ‘Master’ then to control the system? If so, I might not need the touchscreen. Maybe even connect to API of our software to create completely automised system.

Alternatively, use Photons all the way and communicate via Local router and have one Photon and 4D touchscreen act as master.

Really appreciate your help as I understand that such trivial question can be frustrating :slight_smile:

1 Like

Yup, that'd be one of the standard use-cases, but having it equipped with a touchscreen would still be useful.

Hi,

I am using a 28 BY J-48 stepper motor with ULN2003 at 12VDC with Particle Argon. I am using Stepper.h library in Particle. It works, but torque is extremely low. Does anyone know how can I improve torque?

Here is my code:

//Define the distance of the floors    
    Diff_Flrs=CurrentFloor-DestinationFloor;
    if(Diff_Flrs==2||Diff_Flrs==-2){d=y;}  
    else{d=x;}       
    
//If Destination Floor is LARGER than Current Floor then go UP
    if(DestinationFloor>CurrentFloor){     
       for(int i=0;i<=d;i++){
           digitalWrite(6,HIGH);// Sets the red light on  
           digitalWrite(7,LOW);// Sets the green light off  
           motor.step(number_of_steps);          
         }  
       CurrentFloor=DestinationFloor;
     }    
    
// If Destination Floor is SMALLER than Current Floor then go DOWN    
    if (DestinationFloor<CurrentFloor){
       for(int i=0;i<=d;i++)
       {
         digitalWrite(6,HIGH);// Sets the red light on 
         digitalWrite(7,LOW);// Sets the green light off
         motor.step(-number_of_steps);  
       }   
       CurrentFloor=DestinationFloor;
     }  
    if (DestinationFloor==0){Serial.println("You arrived in Ground Floor. Please enter your Destination Floor.");}
    else{
         Serial.print("You arrived in Floor ");
         Serial.print(DestinationFloor);
         Serial.println(". Please enter your Destination Floor.");
     }
     digitalWrite(6,LOW);// Sets the red light off
     digitalWrite(7,HIGH);// Sets the green light on
     delay(1500);// Sets the delay in case that the user inserts the input continuously
}

void setup(){
  Serial.begin(9600); 
  while(!Serial);   
  Serial.println("You are in Ground Floor. Please enter your Destination Floor.");
  motor.setSpeed(120);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
}

void loop(){
   if(Serial.available()>0)
   {      
       Serial.println("prueba");
     digitalWrite(7,HIGH);// Sets the green light on
     int button=Serial.parseInt();// Takes the value from keyboard from Serial Monitor
     if(button==0||button==1||button==2){        
        CompareFloor(button);// Sets the input value to the Destination function      
        Serial.setTimeout(10000000);      
     }
     else{Serial.println("Wrong input. Please enter the correct floor number");}
   } 
} 

Regards

HI @iarakis -

HHmm... I not familiar with the driver you are using, so can only guess. Usually when I had torque ot speed issues (providing of course the stepper can actually provide high torque or speed) it was either low voltage issue or the current supplied by the driver was insufficient.

the NEMA motors I used liked being able to draw 2A of current and have a Voltage supply for 24V directly to the motor. The driver was powered by 3.3V-5V.

I tried to google the motor and driver you mentioned, they both seem to use 5V? You mentioned you are using 12V?

Regards
Friedl

Yes, they can be powered up to 12V. I see videos with the same stepper motor and driver with quite a high torque https://www.youtube.com/watch?v=14jF8umwJLI This would be more than enough for me.

So I guess it could be 2 things:

-Or the current provided by the power supply is too low??
-Or there is some issue with Stepper.h library??

Here is another video with the same motor: #59 - 28BYJ-48 torque in Wave, Full, Half step modes - YouTube