×

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

Bi-monthly release with minor bug fixes and improvements

Moonlite focuser protocol

  • Posts: 3
  • Thank you received: 0
Yep, thanks for that. I eventually figured it out
6 years 6 months ago #19026

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

  • Posts: 3
  • Thank you received: 0
Hi,

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?
6 years 6 months ago #19221

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

  • Posts: 9
  • Thank you received: 1

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.

Jean-Phi
The following user(s) said Thank You: Eric
Last edit: 6 years 6 months ago by Jean-Philippe.
6 years 6 months ago #19325

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

  • Posts: 79
  • Thank you received: 13
Hi,
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 :
github.com/Hansastro/Focuser
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.
Max
5 years 9 months ago #26474

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

  • Posts: 1029
  • Thank you received: 301

Replied by Eric on topic Re:Moonlite focuser protocol

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...

-Eric
5 years 9 months ago #26475

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

  • Posts: 281
  • Thank you received: 29

Replied by Helge on topic Re:Moonlite focuser protocol

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.

www.indilib.org/support/tutorials.html

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

Best, Helge
5 years 9 months ago #26477

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

  • Posts: 79
  • Thank you received: 13
Managed to get the Arduino based focuser at github.com/Hansastro/Focuser working well on an Arduino Nano. Had to tweak the code to move the screed connections for the I2C display and correct a small error, but basically the code works well and I have it all connected and driven by the EKOS focus module. I can run the autofocus routine to achieve a much better focus result and for a fraction of the price of a proprietary product.
Below are a few pictures They show:
The focuser in its final project box. The three cables are: USB to RPI; 12v power in for motor; cable to stepper motor. Breadboard version before boxing; stepper connection to telescope using metal collar and flexible coupler
The following user(s) said Thank You: Hellriegel, euklides69
5 years 8 months ago #27332
Attachments:

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

  • Posts: 51
  • Thank you received: 4
Hi, Maxchess.
I am very interested in this project. I currently have a focuser based on Robert Brown's idea
sourceforge.net/projects/arduinoascomfocuserpro2diy/
but the problem is that it only works on windows.... and has no drivers for indi. I wish I had one that could work on OSX.
Could you tell me what corrections you made to the ino file? And another thing, could you explain a little more about how you coupled the engine with the collar? Or put some more pictures to see it better....
Thank you in advance.
5 years 8 months ago #27354

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

  • Posts: 79
  • Thank you received: 13
Hi,
I have posted my amended code on Github: github.com/mdobres/MaxFocuser
The changes I made were:
-Initialise steps as eigths so that initial setting works
-Changed temp sensor to pin A0, in the original code it was pin 3, which was already in use
-Added temp correct factor to allow temperature range to be corrected, 10k pot seems unnecessary and I disconnected it in my final version
-Note that I2C display should be connected to I2C: A4 (SDA) and A5 (SCL)

The easiest way to test this is to wire the whole thing on a breadboard then connect using the Arduino serial monitor and issue Moonlite commands, referenced in the Readme file.

I got this to work from Arduino PDE under windows and then under indy Ekos, but I couldn't get it to work with the windows Moonlite focuser program I downloaded from their site. Probably due to something to do with Nano drivers which changed at some point. But I only need it under Indy so didn't spend any time trying to solve it. If you need it to run under windows you may want to use an Arduino UNO and use the original code with the A0 correction. I prefer the nano, it is more compact fits nicely on a small breadboard and is really cheap.

Choice of stepper motor is key, I used: a Nema 17 Stepper motor SM-42BYG011-25 about £15 , I see some people try and use the little 28BYJ-48 motors which cost less than £2 and get problems with holding and backlash. The Nema 17 I used (there are lots of different ones) has great torque and holding but is quite light.

As far as fixing the motor to the telescope I used three components:
-Rubber Lined Munsen Rings Bracket plus M10 20mm bolt
-Nema 17 stepper motor mounting plate
-Flexible shaft coupling joint to match diameter of motor shaft and focuser shaft. Mine were 4mm and 5mm.

You can see how its fixed in my last set of photos. The Munsen ring (picture attached) goes round the telescope and has a post sticking out to which you bolt the mounting plate. You will probably need to drill a hole in the plate for the M10 bolt. Then with careful positioning the shaft coupling joint just joins the motor shaft to the focus wheel shaft,

Best of luck
Max
The following user(s) said Thank You: anofeles, euklides69
5 years 8 months ago #27363
Attachments:

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

  • Posts: 51
  • Thank you received: 4
Thank you, Maxchess.
I finished it today and it worked fine for me. Perhaps the pdf focuser_schematic is a little confusing, since pin A0 has no associated connection...
I just have a little problem. When I've tested it on Ekos, everything's fine... except the temperature. It tells me it's -80 degrees Celsius.... (and going down). Of the three legs of the sensor, one is ground, one is V+ and the third is adjust. This last one, "adjust", is the one I connect to pin A0. Is that right? Or do I have to make any different temperature settings?
Thanks for sharing your work.
5 years 7 months ago #27985

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

  • Posts: 79
  • Thank you received: 13
Hi, I am away from home for a few weeks so I cannot give you a detailed reply but I the pdf electronics diagram is the original one and the sensor connections are different from original code and from mine. If you look at my code you will see that the temprature sensor is connected to A0 , this is instead of A4 shown on the pdf. It is the v+ that is connected and v+ is also connected via a 1.8k resistor to the 5v supply.
I did not connect the adj leg to anything. In the peg it is connected by a pot to allow calibration but I found this was better done in software.

I also recommend connecting the display which is an i2c oled device and shows both the temperature and the focused ticks. On the nano that connects A4 (SDA) and A5 (SCL) (hence why I moved the above connector to A0). The display makes testing much easier.

If this is not clear let me know and I will reply when I have returned home.
Max
5 years 7 months ago #28030

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

  • Posts: 51
  • Thank you received: 4

Don't worry, Max. I'm starting my vacation tomorrow too. There'll be time to check the temperature sensor and the display when we get back.
Enjoy your rest.
Greetings....
5 years 7 months ago #28082

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

Time to create page: 0.947 seconds