×
INDI Library v1.8.5 Released (19 Apr 2020)

April 2020 release of INDI Library v1.8.5 introduces new drivers while providing fixes and improvements to existing devices and core framework.

INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi

8 months 3 weeks ago 4 months 3 weeks ago by kross. Reason: Clarified stepper motor HAT vs DC motor HAT
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #45918
Hello all!

I have written a new INDI driver, for the Waveshare Stepper Motor HAT. I've been using Radek Kaczorek's driver for the Adafruit Motor HAT for a while now, and while it works, I came across this Waveshare HAT which looks to be a bit better.

Advantages of the Waveshare Stepper Motor HAT versus the Adafruit Motor HAT:
  • Real stepper driver, a Texas Instruments DRV8825
  • Up to 1/32 microstepping, for super quiet and smooth focusing
  • Adjustable current limiting
  • Doesn't use i2c
  • Can power the Pi and the stepper motor with a single 12V connection. No more 12V and 5V dual power to the Pi!

Even with 1/32 microstepping, I can get very reasonable speeds, since we're not using i2c, but are just triggering a single GPIO pin every time we want to step the motor. At 1/32 microstepping, I can get a full revolution of a 1.8 degree stepper motor in about half a second. 1/16 or 1/8 microstepping will, of course, be 2x and 4x faster, respectively.

From a programming standpoint, controlling the stepper is quite simple, and they include sample C code (unlike Adafruit which only includes Python code, which must be ported to C). My driver code was heavily inspired by (read: stolen from) Radek Kaczorek's original astroberry-amh driver.

Anyway, the code is here. If you do try it out, drop a note and let me know how it works out for you!

github.com/k-ross/indi-wmh-focuser
The following user(s) said Thank You knro, ChrisHoward

Please Log in or Create an account to join the conversation.

8 months 3 weeks ago
knro
Administrator
Administrator
Posts: 8213
Karma: 51
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #45925
Great job Kevin! As someone who loves to tinker a lot (like many of us here do), I'd sure checkout this HAT and your drivers. Awesome work!

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

Please Log in or Create an account to join the conversation.

8 months 3 weeks ago
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #45944
Thanks Jasem!

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
esb
Senior Boarder
Senior Boarder
Posts: 54
More
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51029
I'm trying to get this driver running with my setup and have run into a couple of problems. I've built and installed the driver on my rPi4 running StellarMate 1.5.1. Ekos wasn't including the driver in the list of available Focuser drivers. I tracked that down to the fact that the driver executable was installed in /usr/local/bin instead of /usr/bin where the rest of the indi driver binaries reside. By moving it there, it now recognizes the driver, but the driver fails to start.

The log shows the following:

wiringPiSetup: Unable to open /dev/mem or /dev/gpiomem: Permission denied.
Aborting your program because if it can not access the GPIO
hardware then it most certainly won't work
Try running with sudo?

I get the same result when running the indiserver manually as the stellarmate user. If I run it as root, then the driver is able to start.

I'm able to get it to run by setting the setuid bit on the driver, but that doesn't seem like a good long term solution. Has anybody else run into this issue?

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
esb
Senior Boarder
Senior Boarder
Posts: 54
More
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51030
Even with it running, I can’t get the stepper to turn. I’m using the Ekos focus module and attempting to perform both relative and absolute moves. I’ve tried multiple stepper motors and cables in either of the connectors.

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51031
Hmm, someone else was having a similar issue. Seems to be an issue on Ubuntu. I'm using Raspbian without any issues. I suspect permissions are different between the two OSes.

I'll have to dig into this a bit...

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51033
What does the output of "gpio -v" show?

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
knro
Administrator
Administrator
Posts: 8213
Karma: 51
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51034
GPIO issue fixed in SM OS v1.5.2 (to be released soon). Meanwhile, please install an updated wiringpi:
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51035
Wow, Jasem is all over it! :)

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
esb
Senior Boarder
Senior Boarder
Posts: 54
More
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51067
Thanks for the help. That fixed the issue. I had wondered if it was an issue due to the EOL of WiringPi. The apt repo claimed it was up to date, but clearly that wasn't the latest (final?) release.

One thing I did notice is that the micro stepping define in the driver works as a multiplier which effectively negates the use of micro stepping. If you want to just have one tick == one step, that can be adjusted by the dip switches on the stepper hat. In my case, I definitely want as small steps as I can get as I'm using a custom gear/pulley to connect the helical focuser on a RedCat 51 to a stepper. I only get maybe 3 rotations or so of the stepper to move through the focus range, so I need all of the resolution I can get. I'm thinking it might be worthwhile to have a number property for a multiplier that can then be customized and saved in a config.

That said, it seems to work just as expected. Thanks to Jasem for the help and to Kevin for the driver.

Now I just need the clouds to depart so I can try this out. I'm anxious to see it work and to see how much backlash I have in my custom parts. Ultimately its grabbing onto a rubber piece and quite a bit of effort is required to start the focuser turning. Fortunately I can already see that the stepper can move the focuser much smaller amounts than I ever could by hand, so I'm expecting good results.

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
kross
Expert Boarder
Expert Boarder
Posts: 146
Karma: 2
More
Topic Author
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51068
You are correct that the multiplier effectively negates the resolution with microstepping. This is because I don't use microstepping to increase resolution, but for added smoothness and quietness. When the stepper isn't actively changing position, I turn off power to the motor, to keep them cool. And stepper motors can't hold position between full steps without power applied.

However, if you want full resolution, and don't mind keeping power to the motor at all times, then you can change the #define MICROSTEPPING to 1, and in wmh_focuser.cpp, remove line 381, the line that reads "DRV8825_Stop();". That will prevent the motor from turning off when done focusing.

Make sure you monitor the temperature of your motors. The Waveshare Stepper Motor HAT has adjustable current limiting. You will need to decrease the current if the motor gets too hot when idle.

Hope this helps, and thanks for your interest!
The following user(s) said Thank You JonCarleton

Please Log in or Create an account to join the conversation.

4 months 3 weeks ago
esb
Senior Boarder
Senior Boarder
Posts: 54
More
INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi #51070
Thanks for the clarification. Interestingly I noticed that my stepper was making noise continuously after a couple of cycles in/out. I assumed that was because the motor still had power applied. I'll have to see if I can reproduce that. Based on what you've said, it shouldn't stay powered.

I'll have to see if the added resolution really helps. It may be that there is enough backlash / inertia in the focuser that the extra resolution doesn't actually make a difference. I do like the idea of keeping the stepper unpowered. Even if the motor / controller can handle it, less power use by the rig is good. At some point I am going to want to image away from home and will depend on a battery to power everything.

I also get some varying noise while stepping. My only other experience with steppers is with my 3d printer and it has very consistent noise when stepping (especially when stepping at a constant rate). I wonder if I'm at the edge of the torque capabilities of the stepper I'm using. I originally tried a pancake stepper and it did not have enough torque to get the focuser moving. I'll have to check what the rating is on the one I'm using.

Please Log in or Create an account to join the conversation.

Time to create page: 0.549 seconds