Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Arduino Ascom focuser Mark2


tekkydave

Recommended Posts

Just noticed that there isn't source files for the driver in SF.

But maybe this can be of help

using System.Globalization;temp t = tempFromArdu;string localeAwareTempVal = t.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);

C# gives me headaches  :eek: 

Link to comment
Share on other sites

To confirm the headaches proble the hint code should be :

using System.Globalization;string t = tempFromArdu;string localeAwareTempVal = t.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);

It seems i cannot edit my posts (yet)?

Link to comment
Share on other sites

Just noticed that there isn't source files for the driver in SF.

But maybe this can be of help

using System.Globalization;temp t = tempFromArdu;string localeAwareTempVal = t.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);

C# gives me headaches  :eek:

The source is all in the svn repository - you need to check it out first.

Click on the Code menu option.

The Ascom driver is based on the IFocuserV2 interface http://www.ascom-standards.org/Help/Developer/html/P_ASCOM_DeviceInterface_IFocuserV2_Temperature.htm

The Temperature property returns a double to the client program. This can't be fixed in the driver - it is up to the client program how it displays the temperature.

The problem may be in my AAF2 class where it converts the string from the nano to a double.

Edited by tekkydave
  • Like 1
Link to comment
Share on other sites

To confirm the headaches proble the hint code should be :

using System.Globalization;string t = tempFromArdu;string localeAwareTempVal = t.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);

It seems i cannot edit my posts (yet)?

You need to get to 250 posts before you can edit your own posts - keep posting :grin:

  • Like 1
Link to comment
Share on other sites

You need to get to 250 posts before you can edit your own posts - keep posting :grin:

omg! that will take awhile :)

I found the code section in SF!

Indeed it seems that on  http://sourceforge.net/p/arduinoascomfocuser/code/HEAD/tree/Ascom_Driver/AAF/AAF2/AAF2.cs

on line 157

Instead of

 return Double.Parse(p); 

we could try

return Double.Parse(p, CultureInfo.CurrentCulture);

Should (might :-) ) return the temp as a double but with respect to the users locale specified decimal point,according to MSDN.

Unfortunately i don't have any experience with C# or how - where to compile anything with it.

Might start reading about it in the morning but that will also take awhile :)

I would be happy to beta test if you need me to.

Link to comment
Share on other sites

Didier,  have you now managed to install the driver ?    

 

Hi Mike J, yes I have and the workaround to declare Ascom driver works quite well.

I get trouble with temperature because in France we use comma instead of dot to separate the digits.

And as a good dummy I try to modify some parameters in Ascom : I notched "Trace" without knowing what will be the result...

After many reinstall, finally I change from "true" to "false" on "Trace" with Ascom tool.

I hope that Silio and Tekky will found a way to update Ascom driver to implement comma for temperature.

My plan is to use this focuser with my DSLR and BYN and reach a good focus.

Thanks to Gina for showing the multi camera and stimulate me to try to do that.

I will post photos when I reach a good prototype ;-))

Didier S-C

  • Like 1
Link to comment
Share on other sites

Just got UNO board today and try to test the sketch. I could upload 2.2 nano sketch and my modified UNO sketch, but both failed when I open ASCOM driver.

What could be the reason?

Ok, when I run ASCOM diagnostics, it says mscoree.dll not found. Is this file part of installation package? I am using win8.1.

Link to comment
Share on other sites

Hi Mike J, yes I have and the workaround to declare Ascom driver works quite well.

I get trouble with temperature because in France we use comma instead of dot to separate the digits.

And as a good dummy I try to modify some parameters in Ascom : I notched "Trace" without knowing what will be the result...

After many reinstall, finally I change from "true" to "false" on "Trace" with Ascom tool.

I hope that Silio and Tekky will found a way to update Ascom driver to implement comma for temperature.

My plan is to use this focuser with my DSLR and BYN and reach a good focus.

Thanks to Gina for showing the multi camera and stimulate me to try to do that.

I will post photos when I reach a good prototype ;-))

Didier S-C

I'll see what I can do but it may be a while before I get time to do any more work on the project. Feel free to make any changes to the code for your own use. There is a free version of Visual Studio you can download and use to compile your own driver. There are some tutorials on the Ascom website about getting started and this one that I found useful https://www.scribd.com/mobile/doc/135503114?width=1280
  • Like 1
Link to comment
Share on other sites

Just got UNO board today and try to test the sketch. I could upload 2.2 nano sketch and my modified UNO sketch, but both failed when I open ASCOM driver.

What could be the reason?

Good morning :)

You need to create the directories c:\trace\AAF2 by hand in your c driver and rerun to test.

  • Like 1
Link to comment
Share on other sites

I'll see what I can do but it may be a while before I get time to do any more work on the project. Feel free to make any changes to the code for your own use. There is a free version of Visual Studio you can download and use to compile your own driver. There are some tutorials on the Ascom website about getting started and this one that I found useful https://www.scribd.com/mobile/doc/135503114?width=1280

Even if I think that Silios is right, the good way is to make more compatible the driver with regional settings of the computer, I tried an other way.

Because, I just started to learn Arduino with this project and I absolutely don't know C#, so I have tried to modify your sketch in Arduino.

It is dedicated for computers using comma to separate digits.

I can share my humble modified lines :

At line 38 of original file, I inserted :

// START : MY MODIFICATIONS
     char     PositionPoint;          // Calculate the point position in the string
     String   Temperature = "";       // String to receive the numerical value of temperature
// END : MY MODIFICATIONS
And at line 146 of original file, I inserted :
     // START : MY MODIFICATIONS
         Temperature   = String(GetTemperature(),DEC);              // copy decimal value in string
         PositionPoint = Temperature.indexOf('.');                  // find the dot position
         Temperature   = Temperature.substring(0,PositionPoint+3);  // remove the end of string
         Temperature.replace('.', ',');                             // Replace dot "." by comma ","
         Serial.print(Temperature);                                 // Print on serial port the temperature
      // END : MY MODIFICATIONS
It is now working well with BackYardNIKON, where Temperature is shown with comman and I can order the stepper-motor.
Didier S-C
  • Like 1
Link to comment
Share on other sites

Even if I think that Silios is right, the good way is to make more compatible the driver with regional settings of the computer, I tried an other way.

Because, I just started to learn Arduino with this project and I absolutely don't know C#, so I have tried to modify your sketch in Arduino.

It is dedicated for computers using comma to separate digits.

I can share my humble modified lines :

At line 38 of original file, I inserted :

// START : MY MODIFICATIONS

     char     PositionPoint;          // Calculate the point position in the string

     String   Temperature = "";       // String to receive the numerical value of temperature

// END : MY MODIFICATIONS

And at line 146 of original file, I inserted :

     // START : MY MODIFICATIONS

         Temperature   = String(GetTemperature(),DEC);              // copy decimal value in string

         PositionPoint = Temperature.indexOf('.');                  // find the dot position

         Temperature   = Temperature.substring(0,PositionPoint+3);  // remove the end of string

         Temperature.replace('.', ',');                             // Replace dot "." by comma ","

         Serial.print(Temperature);                                 // Print on serial port the temperature

      // END : MY MODIFICATIONS

It is now working well with BackYardNIKON, where Temperature is shown with comman and I can order the stepper-motor.

Didier S-C

Very good work. Im curious how that is affecting the comma that the driver returns to the BYN as it is a double.

The chain of events is:

nano -> AAF2 Class -> Driver.cs -> BYN

Both the AAF2 class and Driver.cs are part of the ascom driver.

nano returns a string (e.g. 3,45)

AAF2 class converts string to double. At this point the comma is lost.

Driver.cs takes double and just passes it on

BYN gets double from driver and converts to string for display, putting local decimal character in it.

Unless I misunderstand how this all works. Maybe the driver is adjusting your decimal settings based on the comma it sees in the input. It would need to change them in a way that BYN would also be affected. Maybe someone who understands Windows internals or COM objects could comment.

EDIT: After thinking a bit longer I think I know what is happening. Because your PC has been set to use a comma as the decimal separator the AAF2 class is now correctly converting the string with a comma in it to a double. Using the original sketch that passes a string with a dot confuses it and it converts it to a double incorrectly. It is the string --> double conversion in the AAF2 class where the problem is.

A good solution might be to take the punctuation out of the temperature and always pass it as 100ths of a degree. This can then be divided by 100 after conversion to a double. This would work in all localisations.

Edited by tekkydave
  • Like 3
Link to comment
Share on other sites

Does anyone know if this pulley will work?

http://www.robotdigg.com/product/116/2gt-pulley-40-teeth-5mm-bore

I want to get 40 teeth and 16 teeth to get 2.5 reducer, which will give me 1000 steps, fine enough to be used with corse focuser. 

I wanted to get 3.3x5mm coupler for fine focuser but I could not find any. Is there such coupler on the market?

Link to comment
Share on other sites

Does anyone know if this pulley will work?

http://www.robotdigg.com/product/116/2gt-pulley-40-teeth-5mm-bore

I want to get 40 teeth and 16 teeth to get 2.5 reducer, which will give me 1000 steps, fine enough to be used with corse focuser. 

I wanted to get 3.3x5mm coupler for fine focuser but I could not find any. Is there such coupler on the market?

What are the diameters of the shafts you want to use them on? The centre bore of these is 5mm so it could be filed or drilled out carefully by a small amount if needed. I had to file mine out to fit over the stepper motor I used. The only sure way to know is give it a try. A trick to find out what belt you need is use a piece of string over the pulleys to get the correct length :grin:

Link to comment
Share on other sites

Release 2.3.0 is now available on the SF site https://sourceforge.net/projects/arduinoascomfocuser/files/Mark2/Software/V2.3.0/

Highlights:

Changes in Version 2.3.0

Enhancements
* The Arduino now saves it's current position in EEPROM (non-volatile memory). It will remember the position it was at between
  focuser and client application restarts / disconnects. The chooser dialog has been modified to enable you to override the initial
  starting position if required.
* Some users in countries other than the UK reported issues with the temperature not being interpreted correctly due to the use
  of a dot as the decimal separator. This has been removed and the Arduino now returns the temperature in 100ths of a degree (no decimal).
  The driver has been updated to divide by 100 prior to returning the value to the calling client program. Windows should put
  the correct decimal separator in the value according to the PC's international settings.
  I have also blocked the reading of the 1-wire temperature sensor whilst the motor is moving as it interferes with smooth movement.
  During movement it will return the last read value. When the motor is not moving it will re-read the sensor. This is because many
  client applications seem to read it every second which seems excessive. The FocusAAF2 test program now also reads every second for testing.

Bug fixes
* Changed some int variables to unsigned int
* Fixed a minor bug in the motor hi/lo speed detection - it was only working in one direction.

 

Can anyone who had problems with the temperature decimal separator please test to confirm this is now fixed. Thanks.

I still haven't fixed the driver registration issue - I wanted to get these enhancements out asap.

Enjoy.

  • Like 4
Link to comment
Share on other sites

Release 2.3.0 is now available on the SF site https://sourceforge.net/projects/arduinoascomfocuser/files/Mark2/Software/V2.3.0/

Highlights:

Changes in Version 2.3.0

Enhancements

* The Arduino now saves it's current position in EEPROM (non-volatile memory). It will remember the position it was at between

  focuser and client application restarts / disconnects. The chooser dialog has been modified to enable you to override the initial

  starting position if required.

* Some users in countries other than the UK reported issues with the temperature not being interpreted correctly due to the use

  of a dot as the decimal separator. This has been removed and the Arduino now returns the temperature in 100ths of a degree (no decimal).

  The driver has been updated to divide by 100 prior to returning the value to the calling client program. Windows should put

  the correct decimal separator in the value according to the PC's international settings.

  I have also blocked the reading of the 1-wire temperature sensor whilst the motor is moving as it interferes with smooth movement.

  During movement it will return the last read value. When the motor is not moving it will re-read the sensor. This is because many

  client applications seem to read it every second which seems excessive. The FocusAAF2 test program now also reads every second for testing.

Bug fixes

* Changed some int variables to unsigned int

* Fixed a minor bug in the motor hi/lo speed detection - it was only working in one direction.

Can anyone who had problems with the temperature decimal separator please test to confirm this is now fixed. Thanks.

I still haven't fixed the driver registration issue - I wanted to get these enhancements out asap.

Enjoy.

Awesome work again Dave, this project is really getting it's boots on now. I haven't got around to fitting a temp sensor yet but I will get round to it soon.

I've had quite a lot of use out my focuser and couldn't be more pleased but I have a word of caution with using pre-set and known focus positions. The motor does have some backlash (mine is about 1/4 to 1/2 a step) so every time it changes direction it will introduce some error and the focus point will drift away from the previously known position.

As a side note the autofocus routine in AstroArt 5.0 is supreme. It takes a user defined number of exposures at each focus position and then moves the focuser back to the best point. I do one pass of 5 steps for each position followed by a fine focus pass of 1 step for each position.

Link to comment
Share on other sites

Awesome work again Dave, this project is really getting it's boots on now. I haven't got around to fitting a temp sensor yet but I will get round to it soon.

I've had quite a lot of use out my focuser and couldn't be more pleased but I have a word of caution with using pre-set and known focus positions. The motor does have some backlash (mine is about 1/4 to 1/2 a step) so every time it changes direction it will introduce some error and the focus point will drift away from the previously known position.

As a side note the autofocus routine in AstroArt 5.0 is supreme. It takes a user defined number of exposures at each focus position and then moves the focuser back to the best point. I do one pass of 5 steps for each position followed by a fine focus pass of 1 step for each position.

Thanks. Backlash correction is something I want to look at in the future as I have noticed quite a lot on mine. The Ascom driver model doesn't cater for backlash correction so it's something built in to the arduino only. It would have to be tweaked by the user for each individual device. It could be configurable on the chooser dialog I suppose and stored in the EEPROM. There's plenty of space - I'm only using 2 bytes at the moment :grin:

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.