juanmb / ArduinoDomeController

An astronomical observatory dome controller based on Arduino (work in progress)
MIT License
3 stars 6 forks source link

Arduino Dome Controller #2

Open KevininWI opened 2 years ago

KevininWI commented 2 years ago

Hello Juan, My name is Kevin from US. Great work on the Arduino Dome Controller! Thank you for the heavy lifting! I am having some some difficulty, and hope you can steer me in the right direction.

I have set up a new dome, and the config is as follows: Dome is Polydome. Gear reduction DC motor 27:1 coupled to spur gear 14 teeth, meshed to dome with 178 teeth. Your notes indicate an encoder on a rubber wheel reading the rotation of the dome, so I have affixed an encoder to rotate with the dome. The encoder I am using is a 600 pulse per rotation, attached to pins 2 and 3 on the arduino. The rubber wheel turns 23.1 turns with every 1 revolution of the dome. I have also affixed a Hall sensor to pin 10. I am also using buttons to move the dome manually CW and CCW to pins 11 and 12. PWM and direction is connected to a Cytron MD30 motor driver. There is no current sense. The buttons (connected to Arduino pins 11 and 12 will move the dome CW and CCW when pressed.

I am successful in connecting to the arduino in Ascom, using the MaxDome II driver, and my telescope (Meade LX200GPS). The dome will move to the home position when connected. The Maxdome Ascom driver has the option to enter the number of ticks per dome revolution (I believe that number is 23.1 x 600= 13,860.) When I set this manually in the driver and controller.ino file , the dome slews unpredictably in rotation.
The driver also has a button to calibrate the number of ticks the dome will take in one revolution: (I believe the driver counts the ticks received from the encoder in one revolution after reaching home). when I press calibrate, the dome slews to home, but when the dome should rotate, it does not, and I receive a communication 4 error instead from the Maxdome Driver. The dome stops when the magnet activates the Hall effect sensor, and the Maxdome driver reports the proper azimuth when the dome stops (0), the Maxdome Driver continues to report "Finding Home". It seems like the controller.ino file never reports "Home_Reached"

Thinking the 600 pulse per revolution encoder may be too many pulses, I also built an encoder which reads the shaft rotation of the spur gear, which should output 187 pulses for one rotation of the dome (connected to pins 2 and 3). However with 187 manually entered in the driver, the dome slews unpredictably in rotation. Pressing the button to calibrate, also gives the communication 4 error.

I have updated the dome controller.ino file "Ticks per Revolution" each time I make a correction.

I am not sure where to go from here, hoping you might have a suggestion?

Kindest Regards, Kevin

juanmb commented 2 years ago

Hi Kevin. The 600 pulse encoder should work, but I never tested the software with such high resolution.

In my dome I have a three-phase motor controlled by a VFD. The Arduino is electrically isolated from the VFD with two optocouplers. In other domes I used DC motors powered by drivers like the one you have. I found that the encoder reading is much less reliable when using DC motors, because they introduce high-frequency spikes in the Arduino power line.

It is surprisingly difficult to get rid of the spurious ticks caused by the motor in the encoder. This may be the cause of your problem. You can try improving the cabling (the motor wires must not be close to the encoder wires) and adding some filtering capacitors to the lines. A better solution could be keeping the power sources isolated using optocouplers.

I don't know why the calibrate command doesn't work. Maybe the ASCOM driver sends a non implemented command. I don't currently have any Windows computer to test it.

Some time ago I started a new repository (https://github.com/juanmb/openDome) and it have a more recent version of the code, but I haven't documented it yet. It is based on Platform.io instead of the Arduino IDE.

I hope this information has been helpful.

Best regards, Juan

GoituilaHoang commented 9 months ago

Hello Juan, I'm Hoang from Vietnam. Thank you so much for sharing the dome controller. I'm having the following problem and hope you can take some time to guide me. First of all, I'm not good at programming. You know, I'm just looking for a solution for my upcoming dome. I bought all the devices you describe, which are very accessible from my Chinese neighbor. I am having trouble loading the code into the arduino. In the DomeShutter folder, I encountered many IDE program errors. This is the first error "Compilation error: SerialCommand.h: No such file or directory" I fixed it by changing the filename second error "Compilation error: 'ShutterStatus' does not set a type name; do you mean 'domeStatus'?" I fixed it by adding ; and the last error I got was "There is no suitable function to call 'SerialCommand::addCommand(const char [5], void (&)())' " With this error I really don't know what to do I'm not sure if I'm missing any steps I hope you will spend some time to help me answer the above question and if possible, you can guide me in doing this. If so, thank you very much

best regards Duy Hoang

juanmb commented 9 months ago

Hi Hoang, You can fix the compilation error by downloading the SerialCommand.cpp and SerialCommand.h files from here and copying them to the project folder, next to DomeShutter.ino. It should compile without errors. Please let me know if you encounter any more issues.

Best regards, Juan

GoituilaHoang commented 9 months ago

Hello Juan, Thank you so much for your feedback, I really appreciate it. The file you sent has fixed all previous errors but the problem still exists When I load the DomeShutter program into Arduino, it shows the following line : "Compilation error: no matching function for call to 'SerialCommand::addCommand(const char [5], void (&)())' " I still don't understand this part, please guide me, one more time thank you very much.

Best regards, Duy Hoang

juanmb commented 9 months ago

Hi Hoang, What kind of board are you using? These are the files you need to have in the project folder:

Best regards, Juan

GoituilaHoang commented 9 months ago

Hi Juan I am currently using board Arduino R3 I have added all the folders It can be added but it doesn't seem very promising because the above error still exists. Below is the Screenshot

Best regards. Hoang IMG_20231014_162010

GoituilaHoang commented 9 months ago

Hello I have fixed the error running on domeshutter But when uploading DomeController code to arduino and connecting to maxdomeII via com port 5, they cannot connect. I think it's faulty somewhere. Can you spare some time to help me? Thank you very much

Sincerely, Hoang image

juanmb commented 9 months ago

I can't test it on a recent ASCOM platform since all my computers run Linux. The last time I tried the firmware with the ASCOM MaxDomeII driver, it worked flawlessly. Have you attempted running a simple program to test the serial port first? There are some examples in the Arduino IDE