Welcome, Guest
Username: Password: Remember me
08 Apr 2018
INDI development team is happy to announce the release of INDI Library v1.7.0. This new exciting release builds on the maturity of INDI Library and comes with many new supported devices and fixes for existing drivers.

TOPIC: Moonlite focuser protocol

Moonlite focuser protocol 9 months 2 weeks ago #19221


Me again! Turns out I did not 'figure it out' - the hex number for the temperature needs to be a signed hex number - I have no idea how to convert a standard number say 20.5 celsius into a signed hex number! Has anybody got any idea?

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

Moonlite focuser protocol 9 months 1 week ago #19325

HelgeMK wrote: Hi Craig,

I am not sure if useful, I followed those instructions when "rebuilding" the moonlite focuser - see this link:


In the library for the LM335 (lm335-cpp), which is used here as sensor, the following formula is applied (to the end of the lib), maybe you can leverage:

return (500.0*analogRead(this->aquisitionPin)/1024.0) - 273.15;

Be careful with the formula. I remarked that the temperature is not quite right. I think the factor 500 come from some try and error process. It is something in my list of things to improve. (I am the author of the library)

The conversion from Celsius to Hex is not very difficult. You can find it in the github repository in the Moonlite.cpp file. At the end. For the temperature the function "convertLongToChar" is what you are looking for probably.

What happened with negative value... I am not sure of that... Check the function before using it. I have to verify that. I don't remember well.

For your question about how to code 20.5 in signed hex. There is a trick. In the protocol such values are not transfered as they are but they are multiplied by 2. Then you don't have to transfer a floating point value. That explain why the display is always with round or .5 values and nothing in between. (See the file Focuser.ino line 106)

The compensation is not used to calculate the temperature. This value is used to readjust the focus when the temperature changes. You focus, note the temperature and the number of steps of the focuser. You wait some times until the temperature is not the same. You refocus and note again the temperature and the number of steps. You know the differences for the temperature and the position between the two measures and you can calculate a step/degree value. This is the compensation value.

The following user(s) said Thank You: TallFurryMan

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

Last Edit: by Jean-Phi.

Moonlite focuser protocol 2 weeks 2 days ago #26474

I'm new to INDI and also trying to build a focuser that can use the Moonlite protocol.
I would value some pointers as to the best code base to use. I have experience building Arduino apps and I have assembled all the bits.Stepper motor, Arduino, A4899 driver board etc
So far I tried to replicate the code from :
I cannot seem to get it to work. The code comes with a test routine that does work with my Stepper motor, but the main code only responds to a few basic commands when entered through the serial monitor.
I would really appreciate any pointers on a better starting base.

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

Re:Moonlite focuser protocol 2 weeks 2 days ago #26475

I designed and 3d-printed mine for an Orion ED80T using an Arduino Nano and a 28BYJ-48 stepper. I realize I did not push the code to github (but I pushed the .scad file), I could do that if it is of any help. It is based on a firmware from Sourceforge, which I, er, fixed for my own purposes. It is supposed to also control my dust cap when its .scad will be done. The protocol is really not a problem. Getting the timings consistent and the backlash of the crappy steppers under control is another story...


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

Re:Moonlite focuser protocol 2 weeks 2 days ago #26477

Hi Max,

Some time ago a build the focuser, which worked well in principle. What can be critical is the persistent port mapping that might be required if other serial devices are used.


Meanwhile I am using the astroberry-diy focuser, with the a4988 driver. If of interest, can share more details.

Best, Helge

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

Time to create page: 0.118 seconds


3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!