Stepper motor control Board 36820 MS

Jerry-Hat-Trick

Joined Aug 31, 2022
498
I've used half stepping which involves driving both coils at the same time rather than just switching between them. I've not come across 1/4 steps but I believe you can "microstep" by driving both coils with different voltages. The problem with both is that the coils must be actively driven to hold position and the torque is low. When you turn off the power the stepper will flip to it's nearest happy place. The motor you posted in #2 is clearly very small - how many steps does it have per revolution? It's probably a lot less than 200 but if it's divisible by 3, which is entirely possible, your problem is solved!

One last shot at urging you to use a hall sensor to reduce the steps from 67 to 66. It's just a small magnet, a hall sensor like Y3144 and a resistor (and optionally a capacitor). It'll probably work with 3.3V instead of 5..0. The code is simple - a loop triggered by a button press makes 67 steps unless, during each loop, the code checks the status of the hall sensor and reduces the loop count to 66 if the hall sensor output changes.

1688381982520.png
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Thank you again Jerry, very detailed and informative. I have a lot to consider and as I’m now going to be away for a couple of weeks plenty to think about. My project will be on hold until I get back.
Peter
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Thank you again Jerry, very detailed and informative. I have a lot to consider and as I’m now going to be away for a couple of weeks plenty to think about. My project will be on hold until I get back.
Peter
Thank you again Jerry, very detailed and informative. I have a lot to consider and as I’m now going to be away for a couple of weeks plenty to think about. My project will be on hold until I get back.
Peter
Hi Jerry,
I’m home on Wednesday and have thought a lot about your suggestions which would achieve exactly what I require. So I’ve purchased the SN754410NE chip and a Y3144 sensor and I have a very small magnet that I believe I’ll be able to fit into position on one of the three points of the three sided number plate. It’s obviously a crucial part of the setup.
I’ve searched for a suitable circuit but haven’t found it yet which makes me think I should possibly just go for the Seeeduino XIAO instead and I guess the hall sensor can be added. Additionally this looks the easier setup for programming.
I feel I’m on the right track.
Peter
 
Welcome back! That sounds like a plan. Strictly, the SN754410NE chip is specified as working from a minimum supply voltage of 4.5V but you could see if it works supplied from the 3.3V XIAO pin. If you have a clean 5V supply for the stepper motor you could maybe power the IC with this and 3.3V outputs from the XIAO should still be accepted as high. I'd arrange for the magnet to pass the hall sensor somewhere in the middle of the 67/66 steps so when the magnet triggers the hall sensor the code reduces the number of steps from 67 to 66 as it's likely that the hall sensor will be triggered during several successive steps.

Also, I suspect that the small stepper you showed doesn't have as many as 200 steps per revolution. You may be able to discover how many it has by turning the shaft carefully by hand and feeling the torque as you move it between steps.
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Welcome back! That sounds like a plan. Strictly, the SN754410NE chip is specified as working from a minimum supply voltage of 4.5V but you could see if it works supplied from the 3.3V XIAO pin. If you have a clean 5V supply for the stepper motor you could maybe power the IC with this and 3.3V outputs from the XIAO should still be accepted as high. I'd arrange for the magnet to pass the hall sensor somewhere in the middle of the 67/66 steps so when the magnet triggers the hall sensor the code reduces the number of steps from 67 to 66 as it's likely that the hall sensor will be triggered during several successive steps.

Also, I suspect that the small stepper you showed doesn't have as many as 200 steps per revolution. You may be able to discover how many it has by turning the shaft carefully by hand and feeling the torque as you move it between steps.
Thank you Jerry.
Sorry, you mean I need both the SN754410NE chip and the XIAO together? The motors are 2phase 4 wire so 200 steps and just 4x8 mm which are small enough to fit inside the bumper.
Yes, the magnet, in the position I suggested, will be mid step. Turning the number plates doesn’t require a lot of power so I’m guessing it will work.
 
Sorry, you mean I need both the SN754410NE chip and the XIAO together? The motors are 2phase 4 wire so 200 steps and just 4x8 mm which are small enough to fit inside the bumper.
Yes, you need the XIAO to do all the processing connected to the SN754410NE H bridge as below1689595419457.png
The XIAO used in place of the Arduino. Pins 3,6,11 and 14 connected to the coils of the stepper. 4,5,12 and 13 are ground, 1,8,9 and 16 to 5V and 2,7,10 and 15 to digital output lines from the XIAO.

The above image was taken from https://docs.arduino.cc/learn/electronics/stepper-motors
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Skimming through, I don't see any means of guaranteeing the rated motor current through the rpm range with that set up?
Hi Max,
Here are the motor specs:
-Motor outer diameter : 4.5 MM
-Motor height : 8.6 MM
-Motor shaft diameter : 0.7 MM (flat position 0.5 MM)
-Output shaft length : 1.5 MM
-Weight : 0.6g
-Model : Two-phase four-wire
-Drive voltage: DC5V (estimated)
-Internal resistance: approx. 12.1 ohms
-5V short-circuit current: 0.32 A

Please let me know if I need to change anything.
Thank you.
Peter
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Hi Max,
Here are the motor specs:
-Motor outer diameter : 4.5 MM
-Motor height : 8.6 MM
-Motor shaft diameter : 0.7 MM (flat position 0.5 MM)
-Output shaft length : 1.5 MM
-Weight : 0.6g
-Model : Two-phase four-wire
-Drive voltage: DC5V (estimated)
-Internal resistance: approx. 12.1 ohms
-5V short-circuit current: 0.32 A

Please let me know if I need to change anything.
Thank you.
Peter
Also please note:
2 motors are turning together
The motors are just flipping the number plate slowly, one face at a time, 3 faces to 1 revolution.
Peter
 
With two motors in parallel you should still be less than 1.0A current so it should be fine for the H bridge but if you are using the USB connection to supply the 5.0V (which makes sense when testing) then you'd need to put a 15 ohm resistor in series with each coil to reduce the total current of two motors in parallel to below 500mA which is the maximum available from USB.

Coming back to my previous comment, are you absolutely sure the motors have 200 steps per revolution? For motors that small I would be amazed....
 

MaxHeadRoom

Joined Jul 18, 2013
28,521
I always use a 'translator' IC before the H-Bridge, eg, L297 , One, because it allows regulating the plate rated motor current through-out the rpm range.
If very small motor you may (or may not) need it?
Also it just requires a simple pulse for RPM and DIR input.

1689615275863.png
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
With two motors in parallel you should still be less than 1.0A current so it should be fine for the H bridge but if you are using the USB connection to supply the 5.0V (which makes sense when testing) then you'd need to put a 15 ohm resistor in series with each coil to reduce the total current of two motors in parallel to below 500mA which is the maximum available from USB.

Coming back to my previous comment, are you absolutely sure the motors have 200 steps per revolution? For motors that small I would be amazed....
Hi Jerry,
I do hope I’m not wasting everyone’s time but as you rightly suggested I’ve checked the motor and by turning the guide pin it jumps to just 8 positions.
I read at the beginning of all this that a 2 phase 4 wire stepper had 200 steps so assumed that was what I had.
So if this new information is correct I now have to program for 3, 3 and 2 steps.
The XIAO arrived this morning so as soon as I get a chance I’ll do some experimenting.
Peter
 
No worries - shame it doesn't have 9 steps! If your number plate block has an equilateral triangle cross section then it may be an issue that it doesn't sit quite right for two out of the three positions?

My suggestion is to focus initially on downloading the Arduino IDE and loading a simple example into the XIAO. https://wiki.seeedstudio.com/Seeed_Arduino_Boards/ may help. If you build the circuit with the XIAO, H Bridge and motor, programming it to do one revolution, 8 steps will a big step in the right direction! I'll look out for your post on how this goes.

For 3, 3 and 2 steps, a push button to pull one I/O line low (normally pulled high with a resistor) should initiate a loop to do three steps but with a strategically placed magnet to trigger the hall sensor would 'break' out of the loop after two steps.

There are stepper motor examples you can google which use a stepper motor library or you can simply drive the necessary output pins high and low directly with digitalWrite()
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
No worries - shame it doesn't have 9 steps! If your number plate block has an equilateral triangle cross section then it may be an issue that it doesn't sit quite right for two out of the three positions?

My suggestion is to focus initially on downloading the Arduino IDE and loading a simple example into the XIAO. https://wiki.seeedstudio.com/Seeed_Arduino_Boards/ may help. If you build the circuit with the XIAO, H Bridge and motor, programming it to do one revolution, 8 steps will a big step in the right direction! I'll look out for your post on how this goes.

For 3, 3 and 2 steps, a push button to pull one I/O line low (normally pulled high with a resistor) should initiate a loop to do three steps but with a strategically placed magnet to trigger the hall sensor would 'break' out of the loop after two steps.

There are stepper motor examples you can google which use a stepper motor library or you can simply drive the necessary output pins high and low directly with digitalWrite()
Hi Jerry,
I’ve made a start but I can’t find a comparison table for Arduino uno to the XIAO pins D8,D9,D10 and 11
No worries - shame it doesn't have 9 steps! If your number plate block has an equilateral triangle cross section then it may be an issue that it doesn't sit quite right for two out of the three positions?

My suggestion is to focus initially on downloading the Arduino IDE and loading a simple example into the XIAO. https://wiki.seeedstudio.com/Seeed_Arduino_Boards/ may help. If you build the circuit with the XIAO, H Bridge and motor, programming it to do one revolution, 8 steps will a big step in the right direction! I'll look out for your post on how this goes.

For 3, 3 and 2 steps, a push button to pull one I/O line low (normally pulled high with a resistor) should initiate a loop to do three steps but with a strategically placed magnet to trigger the hall sensor would 'break' out of the loop after two steps.

There are stepper motor examples you can google which use a stepper motor library or you can simply drive the necessary output pins high and low directly with digitalWrite()
Hi Jerry,
I’ve made a start with the circuit but I can’t find any guide as to which XIAO pins match the Arduino uno D8,D9,D10and D11 digital output pins and obviously wouldn’t like to just guess IMG_9944.jpeg
 
You can use any of the digital pins D0 to D10 as long as you assign them correctly in your code. For convenience you could use D5,6,7 and 8 as they are nearest your H bridge unless you plan to use any of these for their alternative functions. As you are coming new to this I’d recommend using one or more red LEDs in series with 1K resistors to check your digital outputs are doing what you expect them to do! Red because the LED voltage is typically low enough to allow a 1K resistor to keep the current to about 1.5mA which is visible
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
You can use any of the digital pins D0 to D10 as long as you assign them correctly in your code. For convenience you could use D5,6,7 and 8 as they are nearest your H bridge unless you plan to use any of these for their alternative functions. As you are coming new to this I’d recommend using one or more red LEDs in series with 1K resistors to check your digital outputs are doing what you expect them to do! Red because the LED voltage is typically low enough to allow a 1K resistor to keep the current to about 1.5mA which is visible
Ah, I was beginning to think the coding managed the pins. Thank you again Jerry. Sorry but one further question, as I’m using a button to trigger I’m thinking it replaces the pot going to the XIO pin A0 but not sure of connection. Here’s how it now looks including the LED’s
IMG_0010.jpegIMG_0009.jpeg
 
Sorry, I meant to suggest to try driving the LEDs without the H Bridge and motor attached. Not sure if the XIAO will be happy driving the LEDs and the H Bridge at the same time - I've always found that building a circuit step by step and testing each step of the way checking it does what you expect is the safest and surest way to proceed. If you build the whole thing and it doesn't work you don't know where to start finding out what is wrong. If you just connect the LEDs (with their resistor) you can write your code and check that the sequence of on and off is happening correctly.

For the button, connect any of the spare digital pins to ground with a 10K resistor and use button (switch) to pull it high to 3.3V. Then, when you read the voltage on that pin, if it's high, you start the motor loop.

I really recommend to do step by step, just load the Arduino IDE, make it work with the XIAO, turn an LED on and off, then four LEDs to mimic the stepper motor sequence (with a delay of 1,000mS between steps - delay(1000); ) then remove the LEDs and connect the H bridge and stepper motor, then reduce the delay to maybe 100mS etc. Including the hall sensor, both hardware and code, is a final step.

Hope this helps!
 

Thread Starter

Pcarmour

Joined Jun 24, 2023
94
Sorry, I meant to suggest to try driving the LEDs without the H Bridge and motor attached. Not sure if the XIAO will be happy driving the LEDs and the H Bridge at the same time - I've always found that building a circuit step by step and testing each step of the way checking it does what you expect is the safest and surest way to proceed. If you build the whole thing and it doesn't work you don't know where to start finding out what is wrong. If you just connect the LEDs (with their resistor) you can write your code and check that the sequence of on and off is happening correctly.

For the button, connect any of the spare digital pins to ground with a 10K resistor and use button (switch) to pull it high to 3.3V. Then, when you read the voltage on that pin, if it's high, you start the motor loop.

I really recommend to do step by step, just load the Arduino IDE, make it work with the XIAO, turn an LED on and off, then four LEDs to mimic the stepper motor sequence (with a delay of 1,000mS between steps - delay(1000); ) then remove the LEDs and connect the H bridge and stepper motor, then reduce the delay to maybe 100mS etc. Including the hall sensor, both hardware and code, is a final step.

Hope this helps!
Yes, that makes sense. Thank you
Peter
 

MaxHeadRoom

Joined Jul 18, 2013
28,521
Top