×

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

Bi-monthly release with minor bug fixes and improvements

Controlling Moonlite focuser from Raspberry Pi

  • Posts: 983
  • Thank you received: 375
I have recently bought a Moonlite High Resolution Stepper Motor ( supported by INDI ).
However the INDI driver assumes that you also use a control box (like this ) to control the focuser from your PC through USB cable.

I didn't have the control box so I started to analyse the Moonlite High Resolution Stepper Motor RS232 interface to see how I can control it directly from Raspberry Pi without the control box. Apparently the RS232 interface gives direct access to stepper motor coils!
PIN1 -> Coil1+
PIN2 -> Coil1-
PIN3 -> Coil2+
PIN4 -> Coil2-
PIN5 -> +12V

Why it's cool? Because you can control your moonlite stepper motor WITHOUT control box! How? With any stepper motor driver that supports 12V voltage. The example implementation of this idea is using:
1) DB9 female plug (to connect the focuser) - NOTE: use ONLY PIN1-4 and DO NOT connect PIN5 at all.
2) 4 wire cable soldered to PIN1-4 of DB9 plug
3) PiFace Relay Hat + PiFace Motor Control Extra
4) Astroberry PiFace drivers (see here )

Connect DB9 PINs to PiFace Motor Control Extra as follows:
PIN1 - YAOUT1
PIN2 - YAOUT2
PIN3 - YBOUT1
PIN4 - YBOUT2
PIN5 - leave it disconnected. DO NOT connect +12V to PIN5.

Provide +12V to MOTOR Y+ on your PiFace Motor Control Extra.

Run Astroberry PiFace Focuser driver with your INDI server on Raspberry Pi and enjoy!
The following user(s) said Thank You: Oleg
7 years 11 months ago #8211

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

  • Posts: 77
  • Thank you received: 10
Hmm I think they use an RS232 plug and socket but it's definitely not the RS232 software signalling protocol!

I've created my own stepper motor focuser using an arduino. There's several things about steppers you will need to be aware of - first thing is voltage and current delivery.

If you're supplying too little voltage and current then you will get a low torque and very bad performance.
If you supplying too much current then you will find the stepper motor will heat up and could melt the coils.

A less expensive way to do what you have done is to use a DRV8825 micro stepping and current limiting (chopper) driver. The driver carrier board has an adjustable pot on it to tune the maximum current delivery. The 8825 takes an input of 8.2V-45V and can cope with 2A of current. The only thing you need to add is a 50V 100uF (or higher) capacitor over the motor voltage supply pins to protect the carrier board against inrush spike when you connect the power.

In my system I have a stepper rated at 3.8V and 670mA per coil. With the DRV I use a 12V supply and with the aid of a screwdriver and multimeter (for testing the voltage between two pins) have adjusted the system to deliver a maximum of 670mA. The result is in 12 hours of use my stepper is cold to touch but I cannot turn the stepper with my fingers. Compared to a L298 bridge based controller that doesn't control current.

The 8825 supports full stepping, half stepping, 1/4, 1/8, 1/16 and 1/32 steps just by setting the MODE0/1/2 pins which can be controlled from the RPi. The controller does the complicated work.

The 8825 controller is a simple connection to both ardunio and raspberry pi using a standard ENABLE-DIRECTION-STEP interface.

You can get 5 of these DRV controllers off Amazon for about £10.. or if you can wait a few weeks you can order from china and get them for substantially less.
ODROID C2 Ubuntu
7 years 11 months ago #8219

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

  • Posts: 983
  • Thank you received: 375
This is all correct. I used DRV8834 stepper controller in the past as a part of Astroberry project (see README for details). It was using custom built focuser with PG2528-0502U stepper motor (later upgraded to JK28HS45 stepper motor).
Now it's good to know that RS232 socket on Moonlite High Resolution Stepper Motor has actually nothing to do with RS232 serial protocol. Instead it just gives direct access to Hurst LSG35012F76P stepper motor. This lets you control the focuser by any stepper motor controller, including DRV8825, DRV8834 and L289N.
Building any custom electronics requires caution so indeed checking voltage and current is always good idea. In case of PiFace Motor Controller motor works within it's parameters and performs flawlessly with no temperature increase at all. Be aware that this depends on the software you use to control the stepper motor - using Astroberry PiFace is safe but in case of other drivers that keep the motor powered at rest (soft motor breaks) it will always warm up your motor to some degree and you need to make sure it's not overheating the coils.
And last but not least - all of this means that any Robofocus compliant stepper motor can be controlled as described. And this is really good news as you can save another $300 by not buying a dedicated control box. Note that using RPi or Arduino based controllers will not give you temperature compensation at the moment. I have already started to add this functionality to piface focuser driver so it's just the matter of time.
7 years 11 months ago #8221

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

  • Posts: 281
  • Thank you received: 29
I have attached a 4,5V bipolar stepper, with 0.67A to my focuser, in connection with the Moonlite focuser driver lib, a raspberry pi, Arduino nano, and the A4988 driver with 12v, using the poti to limit the current (Vref = 0.26). I actually followed this instruction: hansastro.github.io/Focuser/
6 years 8 months ago #18196

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

  • Posts: 281
  • Thank you received: 29
I have attached a 4,5V bipolar stepper, with 0.67A to my focuser, in connection with the Moonlite focuser driver lib, a raspberry pi, Arduino nano, and the A4988 driver with 12v, using the poti to limit the current (Vref = 0.26, i.e. 0.67 divided by 2.5). I actually followed this instruction: hansastro.github.io/Focuser/ - this is actually very nice, with the temperature sensor and a simple display to show the temperature and the position!

All fine, but the stepper motor seems not to have enough torque with the 5V to get the focuser moving in or out. Eventually I got the stepper running, by providing 8 to 12 V, and raising the Vref to about 0.6 - given all I found on the internet, this is probably not ideal, but it works and is similar to what NickK was writing before. Nevertheless, I would have preferred to run the stepper at 5V, to use the same powersupply as for the Raspberry and the Arduino.

To me, this is surprising, since for instance the 28byj48 stepper was able to do so (in a different setup, with the PiFace), and has less torque, comparing the datasheets.

Would be great if anyone had an idea, whether it is possible to run a focuser safely with 5V stepper, or whether in general I should have gone for 12V-version. I actually ordered a DRV8834, hoping this is a better match for the 5V stepper (which btw is hard to find, not sure if there are any alternatives?)

Best, Helge
Last edit: 6 years 8 months ago by Helge.
6 years 8 months ago #18198

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

Time to create page: 0.397 seconds