I started following this wonderful project to build an electronic focuser for my Skywatcher 150/750 PDS explorer.
I had a L298N board already so I choosed a motor that could be driven at full steps with this card and which would also give me room in the CFZ , like advised in the Focuser Basics documentation.
For my f5 newtonian tube I have around 22,72 Steps in CFZ @full speed.
I'm using it with a NodeMCU-ESP32 DEVKITV1
After receiving everything, I have setup everything according to the myFP2ESP32-User-Guide-311-01.pdf documentation, page 117.
When I try to move the motor from the /move page (or with the windows application) it moves well, let's say, clock wise direction, by 500 steps.
But when I try to move it to -500 steps it should move anti clock wise but it won't : it's always spinning the same way : clock wise.
Am I missing someting somewhere ? I don't know where to look to resolve this issue.
I've read online lots of posts saying L298N board isn't a suitable board for Nema17 motors but this docs refers it, Internet too and we are using the motor at really low speeds so it should work.
If someone has some explanation to solve my problem, it would be nice to share it with me !
I have a few clarifications to make. After manipulating the engine for a long time, I realize that it is turning, from time to time, in the other direction. Often when I turn the set on and do +500, -500, +500... it spins the right way every time. But once I do it more than once in the same direction, then it will no longer turn in the opposite direction.
Also, it happens that at a certain moment, it changes direction on its own, sometimes it even seems blocked and alternates in one direction then the other several times during the same movement. Where can this behavior come from?
I tried adjusting the motor speed but it is worse than the default offered. I also tried using half steps but no, that doesn't solve the problem.
If anyone has even an idea, I'm all ears.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried adjusting the motor speed but it is worse than the default offered. I also tried using half steps but no, that doesn't solve the problem.>
Use microstepping wont change direction, or motor speed. So we do not need to look at that.
When I try to move the motor from the /move page (or with the windows application) it moves well, let's say, clock wise direction, by 500 steps. But when I try to move it to -500 steps it should move anti clock wise but it won't : it's always spinning the same way : clock wise.
There are only a few things that will make a motor turn in one direction only
L298N does not have a DIR pin, so that is ruled out.
Driver board connections between ESP32 and L298Driver board.
see attachment.
You did not mention if you are using a PCB or made you own PCB or were just using connector wires.
The chip to driverboard connections - for L298N are 6 wires, two wires for GND and 12V (J5 on PCB) and 4 input leads. Looking at the firmware file boarddefs.h for ESP32 and L298N I sfind this line
#define PRO2ESP32L298N 46 // L298N
which leads me to the boards file 46
defines/boards/46.jsn
So the DRVBRD to select is PRO2ESP32L298N and the 4 wires for connction to the driver board are
brdpins":[14,27,26,25]
so is wired
esp32 >> L298N
D14 to IN1
D27 to IN2
D26 to IN3
D25 to IN4
and of course the 12V and gnd wires need connection.
You have to have 12V power on to move the motor. You cannot supply 5v or 3.3v to the L298N board.
Next wiring the outputs from the L298N board to the stepper motor. You did not way which stepper motor you have. I have to assume that you either had a motor lying around or purchased a non-recommended stepper motor - either way - it sounds like the color of the stepper motor wires are different.
There are 4 stepper motor wires. If you have 5 or 6 wires then it won't work out of the box.
If you have a multimeter, set to measure resistance, and put one lead of the meter to 1 wire, then touch the other meter leads, one by one to the free stepper wires. Only 1 of the remaining wires will measure a low resistance. So put those two leads together, and then the other two leads go together.You now known the two stepper coil wirings.
1 group goes to one side of the L298N and the other group goes to the other side of the L298N.
If you do not have a multimeter, then it is a little harder.
Set motor delay to 4000
set motor speed to fast
I would try to connect two wires only to IN1 and IN2
Then with 12V on to the L298N I would run the web browser to move some steps. Does not care about direction, If the motor moves then the 2 wires below to the same coil, so just connect the other two wires to 1N3 and IN4
if the motor did not move then remove the wire to IN2 and use a different one, and keep doing it till you have two wires connected to IN1 and IN2 that causes the motor to move when clinking
a move button on the web server page. As above, when that happens wire the other two leads to IN3 and IN4.
Thank you very much for the information. I would like to point out that I indicated which motor I was using, in the title of the article: A NEMA 17-PG27 therefore a recommended motor and not one that I had around. I really followed the documentation and I'm not trying to do something DIY on the side. I bought the motor from stepper online. We can also see it in the photo attached to the first message.
I do not use PCBs, nor custom PCBs. The photo that I attached to the description of my problem shows the connections between the different elements.
I also saw the 46.jsn file and also checked the compatibility with the ESP32 pins. I also had doubts about pin 14 which did not seem appropriate to be used as an output but ultimately yes.
I also tried swapping the motor wire pairs as suggested, but that didn't fix the problem.
EDIT :
Finally, I think I found what the problem is.
I have a voltage of 12v at the OUT1 OUT2 OUT3 and OUT4 terminals of the L298N. When I manage to properly plug the cables into the IN1 to IN4 slots, this tension disappears and the motor behaves normally. (From my understanding, the voltage should only appears when the motor is requested in one direction and only on the appropriate outputs). I must have a faulty L298N.
I'll try to confirm this with another card.
Last edit: Leor 2024-09-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had lying around another L298N board used in another project wich works fine.
Both have the 3 jumpers in place, both behave the same here, on this project :
I sometimes have a voltage at around 11-12v on the OUT1 OUT2 OUT3 and OUT4 outputs when the motor isn't moving in any direction. I'm pretty sure there should be a voltage at this pins (and only in pair of two, not the fours in the same time) only when the motor is turning in one direction.
Therefore, it must explain why it sometimes turns, sometimes not. But I cant find why I have this voltage.
Does my reasoning make sense?
Last edit: Leor 2024-09-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have just found and therefore tested the famous l298n test program
I uploaded it to an identical but new ESP32.
I modified the program to match the motor I have : I simply commented out line 78 and uncommented line 79.
I then uploaded the program to the ESP and put it in place.
When I power everything, the program runs but I guess, not correctly: the motor vibrates instead of rotating in one direction, then stops. And nothing at all after that. It does not loop through the program sequence.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some news on my problem which isn't solved at this point.
I purchased and tested another control board for the motor. I took the DRV8825 chip.
The pins are not identical to those in the project, see photos attached to the message, so I adjusted the connections.
I first took another ESP32 WROOM 32D DevKit V1 card and I uploaded the program having modified the card in controller_config.h. I then uploaded the sketch data files and configured the step size and motor speed.
I carried out the same manipulations as recommended in the doc: move the motor in one direction for 5000 steps then in the other, etc.
With this control card, it's worse: the motor doesn't move at all! Absolutely nothing happens. I tried the procedure described in the manual, with the integrated potentiometer, in one direction or the other: nothing.
I measured with a voltmeter, I never have voltage on my 1A 2A 1B 2B output pins. I tried several DRV8825s (having bought 5 new ones) but same result. I tried reversing the wire pairs, but no results either.
I'm completely lost and wondering what i'm doing wrong.
don't know exactly your level with thes stuff, so i may appear a bit didactic
with the DRV8825 some points are very important to follow!
FIRST: NEVER disconnect the motor while the power is on the driver board..it will surely fry the drv8825 chip
To start with these drivers you should do:
- connect ONLY the power to the board (12V and gnd)
- adjust the VREFto the required value for your motor. that should be around 0,8V for your nema17 motor. you should monitor the Vref (with oneof your multimeter tip on the potentiometer the other on gnd) while turning it with the screwdriver. it'is very sensitive, so be patient.
Disconnect the power.
plug in your motor on the terminal of the drv8825 one coil to A1/A2 the other to B1/B2
connect the sleep and reset pins of the driver to the 5V/3.3V (if these pins are not at high level/ or not connected the driver is disabled, on you picture they seems to be left unconnected...)
connect the ground of the +5V power supply to the other GND pin of the board
connect 0V to the dir pin
plug back the power
plug the 5V supply
you should not be able to turn the axle freely . you may also hear high frequency tone. now if you connect and disconnect regularly a+5V/+3 wire to the step pin, the motor should move step by step...
this will assess that your drv8825 boards are working
then
disconnect power again(5V first)
connect the esp to your driver board (only dir/step to start)
load a simple code which is just stepping (see here https://arduinokitproject.com/drv8825-stepper-motor-driver-arduino-tutorial/ use the io pins that will be used for the fp2 firmware)
if it is working,it will asses you made proper connection between your board and esp.
you can now try to load the firmware , should work
Joël
👍
1
Last edit: Collet 2024-09-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, thank you very much for the explanations. I know the L298N card well but I am a beginner on the DRV8825 and your message helped me a lot. I was actually missing connections on sleep and reset, looking at the diagram I didn't think I needed them but ultimately that's what I was missing and for that, I gain say thank you.
I carried out step by step what you indicated, I now have a Vref between the GND and the potentiometer of 0.79v.
I then uploaded the firmware and connected the ESP.
The motor runs well in one direction and then the other, reliably. Houra !
My only problem left now is the way it runs :
It turns counterclockwise very well, but clockwise it "scratches", you feel like it's skipping steps.
I'm guessing there must be something left to adjust, maybe directly in the web interface ?
EDIT : I tried another DRV8825 with the potentiometer at around 1.68v and it works just fine. The motor can turn in the two directions without any issue, reliably. I think this might me resolved then, I'll try with everything wired up correctly around the focuser and in a box and will do a feedback here.
Anyway, thank you both of you for your time, your patience and your pedagogy. I appreciate it.
No problem with helping; that is also the purpose of this forum.
You should really take care of the Vref setting. With 1.68V setting (and if the board is having the Rsense of 0.1Ohm) it means that the current reaching your motor can be as high as ~3A..which exceed alot the current rating of this motor which will quickly overheat. Another way to adjust the potentiomer, a bit easier, is to put the multimeter in Current mode and to put it between one motor pîn of the board and one of the wire of the motor. Follow the first connection i sent earlier and adjust the pot so that the measured current is rouglhy 0.7the rated current of the motor.
Take care when disconnecting the multimeter that the power is removed from the board!!
Regards
Joël
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone,
I started following this wonderful project to build an electronic focuser for my Skywatcher 150/750 PDS explorer.
I had a L298N board already so I choosed a motor that could be driven at full steps with this card and which would also give me room in the CFZ , like advised in the Focuser Basics documentation.
For my f5 newtonian tube I have around 22,72 Steps in CFZ @full speed.
I'm using it with a NodeMCU-ESP32 DEVKITV1
After receiving everything, I have setup everything according to the myFP2ESP32-User-Guide-311-01.pdf documentation, page 117.
When I try to move the motor from the /move page (or with the windows application) it moves well, let's say, clock wise direction, by 500 steps.
But when I try to move it to -500 steps it should move anti clock wise but it won't : it's always spinning the same way : clock wise.
Am I missing someting somewhere ? I don't know where to look to resolve this issue.
I've read online lots of posts saying L298N board isn't a suitable board for Nema17 motors but this docs refers it, Internet too and we are using the motor at really low speeds so it should work.
If someone has some explanation to solve my problem, it would be nice to share it with me !
Last edit: Leor 2024-09-02
Hi everyone,
I have a few clarifications to make. After manipulating the engine for a long time, I realize that it is turning, from time to time, in the other direction. Often when I turn the set on and do +500, -500, +500... it spins the right way every time. But once I do it more than once in the same direction, then it will no longer turn in the opposite direction.
Also, it happens that at a certain moment, it changes direction on its own, sometimes it even seems blocked and alternates in one direction then the other several times during the same movement. Where can this behavior come from?
I tried adjusting the motor speed but it is worse than the default offered. I also tried using half steps but no, that doesn't solve the problem.
If anyone has even an idea, I'm all ears.
Hi
Use microstepping wont change direction, or motor speed. So we do not need to look at that.
There are only a few things that will make a motor turn in one direction only
L298N does not have a DIR pin, so that is ruled out.
Driver board connections between ESP32 and L298Driver board.
see attachment.
You did not mention if you are using a PCB or made you own PCB or were just using connector wires.
The chip to driverboard connections - for L298N are 6 wires, two wires for GND and 12V (J5 on PCB) and 4 input leads. Looking at the firmware file boarddefs.h for ESP32 and L298N I sfind this line
which leads me to the boards file 46
defines/boards/46.jsn
and 46.jsn looks like
So the DRVBRD to select is PRO2ESP32L298N and the 4 wires for connction to the driver board are
so is wired
esp32 >> L298N
D14 to IN1
D27 to IN2
D26 to IN3
D25 to IN4
and of course the 12V and gnd wires need connection.
You have to have 12V power on to move the motor. You cannot supply 5v or 3.3v to the L298N board.
Next wiring the outputs from the L298N board to the stepper motor. You did not way which stepper motor you have. I have to assume that you either had a motor lying around or purchased a non-recommended stepper motor - either way - it sounds like the color of the stepper motor wires are different.
There are 4 stepper motor wires. If you have 5 or 6 wires then it won't work out of the box.
If you have a multimeter, set to measure resistance, and put one lead of the meter to 1 wire, then touch the other meter leads, one by one to the free stepper wires. Only 1 of the remaining wires will measure a low resistance. So put those two leads together, and then the other two leads go together.You now known the two stepper coil wirings.
1 group goes to one side of the L298N and the other group goes to the other side of the L298N.
If you do not have a multimeter, then it is a little harder.
Then with 12V on to the L298N I would run the web browser to move some steps. Does not care about direction, If the motor moves then the 2 wires below to the same coil, so just connect the other two wires to 1N3 and IN4
if the motor did not move then remove the wire to IN2 and use a different one, and keep doing it till you have two wires connected to IN1 and IN2 that causes the motor to move when clinking
a move button on the web server page. As above, when that happens wire the other two leads to IN3 and IN4.
Regards
Robert
Hello,
Thank you very much for the information. I would like to point out that I indicated which motor I was using, in the title of the article: A NEMA 17-PG27 therefore a recommended motor and not one that I had around. I really followed the documentation and I'm not trying to do something DIY on the side. I bought the motor from stepper online. We can also see it in the photo attached to the first message.
I do not use PCBs, nor custom PCBs. The photo that I attached to the description of my problem shows the connections between the different elements.
I also saw the 46.jsn file and also checked the compatibility with the ESP32 pins. I also had doubts about pin 14 which did not seem appropriate to be used as an output but ultimately yes.
I also tried swapping the motor wire pairs as suggested, but that didn't fix the problem.
EDIT :
Finally, I think I found what the problem is.
I have a voltage of 12v at the OUT1 OUT2 OUT3 and OUT4 terminals of the L298N. When I manage to properly plug the cables into the IN1 to IN4 slots, this tension disappears and the motor behaves normally. (From my understanding, the voltage should only appears when the motor is requested in one direction and only on the appropriate outputs). I must have a faulty L298N.
I'll try to confirm this with another card.
Last edit: Leor 2024-09-04
Yes you did but I did not see that, apologies, and yes I did not look at the picture, my aplogies again.
Looking at the L298N driver board
There are 3 shunt jumpers
Enable A
Enable B
Enable 5V
Please check that the shunt jumpers are in place on the l298n. I have double checked this on my own controller with L298N
Regards
Robert
You might try the test program l298N in the folder Text Examples, to see if the motor turns both ways?
Regards
Robert
I had lying around another L298N board used in another project wich works fine.
Both have the 3 jumpers in place, both behave the same here, on this project :
I sometimes have a voltage at around 11-12v on the OUT1 OUT2 OUT3 and OUT4 outputs when the motor isn't moving in any direction. I'm pretty sure there should be a voltage at this pins (and only in pair of two, not the fours in the same time) only when the motor is turning in one direction.
Therefore, it must explain why it sometimes turns, sometimes not. But I cant find why I have this voltage.
Does my reasoning make sense?
Last edit: Leor 2024-09-04
I have just found and therefore tested the famous l298n test program
I uploaded it to an identical but new ESP32.
I modified the program to match the motor I have : I simply commented out line 78 and uncommented line 79.
I then uploaded the program to the ESP and put it in place.
When I power everything, the program runs but I guess, not correctly: the motor vibrates instead of rotating in one direction, then stops. And nothing at all after that. It does not loop through the program sequence.
Hello,
Some news on my problem which isn't solved at this point.
I purchased and tested another control board for the motor. I took the DRV8825 chip.
The pins are not identical to those in the project, see photos attached to the message, so I adjusted the connections.
I first took another ESP32 WROOM 32D DevKit V1 card and I uploaded the program having modified the card in controller_config.h. I then uploaded the sketch data files and configured the step size and motor speed.
I carried out the same manipulations as recommended in the doc: move the motor in one direction for 5000 steps then in the other, etc.
With this control card, it's worse: the motor doesn't move at all! Absolutely nothing happens. I tried the procedure described in the manual, with the integrated potentiometer, in one direction or the other: nothing.
I measured with a voltmeter, I never have voltage on my 1A 2A 1B 2B output pins. I tried several DRV8825s (having bought 5 new ones) but same result. I tried reversing the wire pairs, but no results either.
I'm completely lost and wondering what i'm doing wrong.
Hi Leor,
don't know exactly your level with thes stuff, so i may appear a bit didactic
with the DRV8825 some points are very important to follow!
FIRST: NEVER disconnect the motor while the power is on the driver board..it will surely fry the drv8825 chip
To start with these drivers you should do:
- connect ONLY the power to the board (12V and gnd)
- adjust the VREFto the required value for your motor. that should be around 0,8V for your nema17 motor. you should monitor the Vref (with oneof your multimeter tip on the potentiometer the other on gnd) while turning it with the screwdriver. it'is very sensitive, so be patient.
Disconnect the power.
plug in your motor on the terminal of the drv8825 one coil to A1/A2 the other to B1/B2
connect the sleep and reset pins of the driver to the 5V/3.3V (if these pins are not at high level/ or not connected the driver is disabled, on you picture they seems to be left unconnected...)
connect the ground of the +5V power supply to the other GND pin of the board
connect 0V to the dir pin
plug back the power
plug the 5V supply
you should not be able to turn the axle freely . you may also hear high frequency tone. now if you connect and disconnect regularly a+5V/+3 wire to the step pin, the motor should move step by step...
this will assess that your drv8825 boards are working
then
disconnect power again(5V first)
connect the esp to your driver board (only dir/step to start)
load a simple code which is just stepping (see here https://arduinokitproject.com/drv8825-stepper-motor-driver-arduino-tutorial/ use the io pins that will be used for the fp2 firmware)
if it is working,it will asses you made proper connection between your board and esp.
you can now try to load the firmware , should work
Joël
Last edit: Collet 2024-09-10
Hi Collet,
First of all, thank you very much for the explanations. I know the L298N card well but I am a beginner on the DRV8825 and your message helped me a lot. I was actually missing connections on sleep and reset, looking at the diagram I didn't think I needed them but ultimately that's what I was missing and for that, I gain say thank you.
I carried out step by step what you indicated, I now have a Vref between the GND and the potentiometer of 0.79v.
I then uploaded the firmware and connected the ESP.
The motor runs well in one direction and then the other, reliably. Houra !
My only problem left now is the way it runs :
It turns counterclockwise very well, but clockwise it "scratches", you feel like it's skipping steps.
I'm guessing there must be something left to adjust, maybe directly in the web interface ?
EDIT : I tried another DRV8825 with the potentiometer at around 1.68v and it works just fine. The motor can turn in the two directions without any issue, reliably. I think this might me resolved then, I'll try with everything wired up correctly around the focuser and in a box and will do a feedback here.
Anyway, thank you both of you for your time, your patience and your pedagogy. I appreciate it.
Last edit: Leor 2024-09-11
Hi Leor
No problem with helping; that is also the purpose of this forum.
You should really take care of the Vref setting. With 1.68V setting (and if the board is having the Rsense of 0.1Ohm) it means that the current reaching your motor can be as high as ~3A..which exceed alot the current rating of this motor which will quickly overheat. Another way to adjust the potentiomer, a bit easier, is to put the multimeter in Current mode and to put it between one motor pîn of the board and one of the wire of the motor. Follow the first connection i sent earlier and adjust the pot so that the measured current is rouglhy 0.7the rated current of the motor.
Take care when disconnecting the multimeter that the power is removed from the board!!
Regards
Joël
I continued tweaking it and got it working perfectly with a Vref at 0.75v. A lot better I guess.
I'll now work on integration around the focuser.