×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

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

  • Posts: 51
  • Thank you received: 12
I've been using an arduino nano and 28BYJ-48 Stepper Motor for a while (there are a few projects across the web for this), but that requires an extra USB cable to the Nano from my Rpi/Rock64. I might have to give this a try. I think I have a NEMA motor hanging around somewhere.
4 years 1 day ago #51298

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

  • Posts: 215
  • Thank you received: 16
colgs3b: I've been using an arduino nano and 28BYJ-48 Stepper Motor for a while (there are a few projects across the web for this), but that requires an extra USB cable to the Nano from my Rpi/Rock64. I might have to give this a try. I think I have a NEMA motor hanging around somewhere.

That was my reasoning as well. I switched from an Arduino setup. The really good news is that you can power the WaveShare HAT and have it power the Pi, thus eliminating one more cable in addition to the USB.
Last edit: 4 years 13 hours ago by Jon Carleton.
4 years 13 hours ago #51338

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

  • Posts: 421
  • Thank you received: 102
BTW, I updated the source code to remove the dependency on WiringPi, since it has been abandoned by its author. It uses a different library for accessing the GPIO pins to communicate with the HAT. There shouldn't be any necessary configuration on anyone's part, it should just work. It accesses the /dev/gpiomem special file for access to the GPIO pins. On Raspbian:

"ls -l /dev/gpiomem" shows:

crw-rw---- 1 root gpio 247, 0 May 12 19:30 /dev/gpiomem

So as long as your user is a member of the "gpio" group, it should work. If you get any type of permission error, try adding your user to the gpio group. In my case, the user I run as is "pi", so:

sudo adduser pi gpio

Replace "pi" with whatever user you run as.

I'd be especially curious to know if this works on people running Ubuntu on their Raspberry Pi. I run Raspbian myself, so I can't check that.

Thanks!
-- Kevin
The following user(s) said Thank You: Jon Carleton
3 years 10 months ago #53710

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

  • Posts: 215
  • Thank you received: 16
Ah...excellent. I sent you a message about the wiringPi thing a while ago when it happened. And many thanks for making the change.
I have a Pi4 that I am running Raspbian on presently with the wiringPi-dependent version of the software, but I have built a Ubuntu 64bit Pi server and added xfce4 desktop for testing on a SD card. I can easily pop that card in, download the new code and see if it compiles and works. I'll let you know. If it does work, I'll probably stick with that platform, as having the 64bit OS solves another problem for me. The primary reason I have remained on Raspbian is your focuser driver. It REALLY works well!
Last edit: 3 years 10 months ago by Jon Carleton.
3 years 10 months ago #53907

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

  • Posts: 421
  • Thank you received: 102
Thanks Jon! yes I'm especially interested in your results!

And yes, I responded to your PM, but it took me a while to notice I even had a message, since the forum software doesn't notify me on screen, and the email notification was in my spam folder.
3 years 10 months ago #53911

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

  • Posts: 1119
  • Thank you received: 182

Hi esb:

I considered using a 3D printer belt to drive the focus of my WhiteCat (basically identical to your RedCat), but abandoned it in favor of a geared solution:



indilib.org/forum/general/6896-featherto...us-cube-2.html#53102

By moving the gears away from the focus ring, this increases travel, hence resolution and reduces torque by a factor of 2x and 1/2, respectively.

That setup is driven driven by an analog motor and the FCUSB driver. Using Hy's linear focus algorithm, the result is spectacular. Hits perfect focus every time.

Last edit: 3 years 10 months ago by Jose Corazon.
3 years 10 months ago #53928
Attachments:

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

  • Posts: 215
  • Thank you received: 16
OK...the compile under Ubuntu Server 20.04 went very well with no barks. However, installing indilib and kstars afterward had some conflicts with /usr/lib/aarch64-linux-gnu/libindilx200.so.1 that required deleting some files and reinstalling indilib1.

Running indiserver with just the focuser did trigger the gpio permission error. There was no gpio group in the /etc/group file, so I did addgroup gpio and adduser ubuntu gpio. Then I had to chmod 660 /dev/gpiomem and chown root.gpio /dev/gpiomem to get things to match your Raspbian specs. Still getting the permissions error. I'll mess with it more tomorrow and see where the issue is.
Last edit: 3 years 10 months ago by Jon Carleton.
3 years 10 months ago #53930

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

  • Posts: 215
  • Thank you received: 16
OK, rebooted and /dev/gpiomem reverted to ownership of root.root. I ran sudo indiserver -vvvv indi_wmh_focuser and got these results:
ubuntu@ubuntu:~$ sudo indiserver -vvvv indi_wmh_focuser
2020-05-16T12:44:40: startup: indiserver -vvvv indi_wmh_focuser
2020-05-16T12:44:40: Driver indi_wmh_focuser: pid=2926 rfd=3 wfd=6 efd=7
2020-05-16T12:44:40: listening to port 7624 on fd 4
2020-05-16T12:44:40: Driver indi_wmh_focuser: sending msg copy 1 nq 1:
<getProperties version='1.7'/>

2020-05-16T12:44:40: Driver indi_wmh_focuser: read defSwitchVector Waveshare Motor HAT Focuser CONNECTION Idle rw
CONNECT='Off'
DISCONNECT='On'
2020-05-16T12:44:40: Driver indi_wmh_focuser: read defTextVector Waveshare Motor HAT Focuser DRIVER_INFO Idle ro
DRIVER_NAME='Waveshare Motor HAT Focuser'
DRIVER_EXEC='indi_wmh_focuser'
DRIVER_VERSION='1.0'
DRIVER_INTERFACE='8'
2020-05-16T12:44:40: Driver indi_wmh_focuser: read defSwitchVector Waveshare Motor HAT Focuser DEBUG Idle rw
ENABLE='Off'
DISABLE='On'
2020-05-16T12:44:40: Driver indi_wmh_focuser: read defNumberVector Waveshare Motor HAT Focuser POLLING_PERIOD Idle rw
PERIOD_MS='1000'
2020-05-16T12:44:40: Driver indi_wmh_focuser: read defSwitchVector Waveshare Motor HAT Focuser CONFIG_PROCESS Idle rw
CONFIG_LOAD='Off'
CONFIG_SAVE='Off'
CONFIG_DEFAULT='Off'
CONFIG_PURGE='Off'


I added a udev rule: KERNEL=="gpio*", MODE:="0660", GROUP:="gpio" and that fixed the sudo problem. I'm testing the operation of the focuser next.
Last edit: 3 years 10 months ago by Jon Carleton.
3 years 10 months ago #53958

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

  • Posts: 215
  • Thank you received: 16
OK, it works fine in Ubuntu Server 20.04 for IoT (Pi4b). Probably best to install KStars/Ekos/INDI before installing per your instructions on GitHub rather than afterward to avoid whatever that conflict issue was. One needs to create the gpio group (and add user to group) and create a rule for the permissions on /dev/gpiomem. I like the new speed settings. about 40 ms works well for my NEMA17 with the gears I used.

The details of setup and testing are in the previous two posts, but since they were listed as replies to El Corazon, I decided it was best to backup and make this a reply to your post. This forum software is a bit wacky when it comes to notifications and thread order. That is one reason I wondered if you got my earlier messages. I got the distinct feeling the thing crashed on submit instead of sending. Better than no Forum, though.

Thanks again for your work! Well done. If I can assist in any way in future, do not hesitate to ask.

Last gasp: I did a reinstall of Ubuntu 20.04 on the Pi4 and installed KStars/Ekos/INDI prior to compiling your sofware and there was no library conflict. The only remaining issues were to create the gpio group, add the user to the group and create the rule KERNEL=="gpio*", MODE:="0660", GROUP:="gpio" in /etc/udev/rules.d
Last edit: 3 years 10 months ago by Jon Carleton.
3 years 10 months ago #53962

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

  • Posts: 421
  • Thank you received: 102
Jon,

Thank you very much for your testing! And I'm glad you got it to work on Ubuntu without too much difficulty. I might take the easy way out, and install indi_wmh_focuser as setuid root. At least then only the focuser would run as root, and not all of the INDI modules. It's less than ideal, I know, since you normally only want to give only the permissions that a process needs, and no more. But hey, this is just a Pi running on a telescope, after all. :)

BTW, I'm working on new anti-backlash code. The new code will always approach focus from the same direction. If it needs to move inward, it will move inward. If it needs to move outward, it will move a bit too far, then move inward to the desired position. Or vice versa if desired.
3 years 10 months ago #53988

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

  • Posts: 421
  • Thank you received: 102

El Corazon,

Nice looking setup! I like the anti-backlash rubber band! :)

I assume that was all 3D printed?
3 years 10 months ago #53989

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

  • Posts: 1119
  • Thank you received: 182
Yes, it was. I would be happy to share the STL and FreeCAD files, if there is demand here.

The rubberband is actually not for backlash, although in hindsight, that is an added bonus, but to equalize the IN and OUT forces on the motor. Since this is an analog motor, not a stepper, length of travel will depend heavily on the load. Going out will require more work than going in. I tried to somewhat equalize that using the rubber band.

In retrospect, I must say, I am surprised by how well this works. I doubt I could do any better with a stepper motor, although my next project is setting one up for a NEMA17 stepper driven by an Arduino/DRV8825 combo.

I am sure I will have lots of questions, so expect my call!

:-)

Best,

Jo
3 years 10 months ago #53992

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

Time to create page: 0.671 seconds