×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

INDI focuser driver for Waveshare Stepper Motor HAT for Raspberry Pi / Rock Pi

  • Posts: 421
  • Thank you received: 102
4 years 5 months ago #45944

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

  • Posts: 59
  • Thank you received: 3
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?
4 years 1 month ago #51029

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

  • Posts: 59
  • Thank you received: 3
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.
4 years 1 month ago #51030

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

  • Posts: 421
  • Thank you received: 102
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...
4 years 1 month ago #51031

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

  • Posts: 421
  • Thank you received: 102
What does the output of "gpio -v" show?
4 years 1 month ago #51033

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

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
4 years 1 month ago #51034

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

  • Posts: 421
  • Thank you received: 102
4 years 1 month ago #51035

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

  • Posts: 59
  • Thank you received: 3
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.
4 years 1 month ago #51067

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

  • Posts: 421
  • Thank you received: 102
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: Jon Carleton
4 years 1 month ago #51068

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

  • Posts: 59
  • Thank you received: 3
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.
4 years 1 month ago #51070

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

  • Posts: 421
  • Thank you received: 102
The default settings for the driver try to run at max speed, which will sacrifice some torque. Go to the options tab and increase the delay per step from 0 to 1 or 2 ms per step. See if that helps give the motor the power it needs.

Also, the sending of pulses to the stepper isn't timed as precisely as on a 3D printer, which runs a single program on a microcontroller, and not a full multitasking operating system. So on the Pi, the sending of the pulses to the stepper will never be as smooth as on a 3D printer.

BTW, I have a Creality Ender 5. What do you have?
4 years 1 month ago #51071

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

  • Posts: 59
  • Thank you received: 3
Now I've done it. I switched my system to root from a USB drive and I've lost the ability to drive the stepper again. I started with the same base OS (1.5.1) and everything else seems to be running fine. Iupdated the OS (apt update/upgrade), installed the dev tools, ran the above command to install the latest wiring pi and then built and installed the driver. Kstars sees it just fine, but I get nothing from the stepper when I try to move it - in or out.

I did add the driver "i2c-bcm2708" to the /etc/modules file. Maybe I missed something else? I had tried a bunch of things originally trying to get it to work when rooting from the SD card.
4 years 1 month ago #51073

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

Time to create page: 0.915 seconds