Hello everyone,
Total noob here. I acquired bootloaded atmega 328p pu, but still didnt get a chance to try it out ( max 232 ttl converter didnt work so i have to buy usb ttl cable over the internet).
Anyway, I am practicing in the Arduino IDE for my telescope project.
Basically,it will be dobsonian telescope placed on EQ platform that only needs one axis (and therefore one motor) to track the sky. I am also planning to add second motor that will only turn on the press of a button, since i want to be able to do tracking corrections in two axes.
My first question is, since i ll be having 2 sets of 4 conditions (monitoring four buttons under 2 different speed settings)
, is it better to use if statements or switch? I wrote a program whee i have 2 while loops with four if else if conditions
All in all, my program has to be capable of continuouslyvdriving one stepper motor at constant speedwhile awaiting button inputs to modify motor speed or to briefly turn the other motor. Is arduino capable of continuosly driving one motor while briefly turning the other SIMULTANEOUSLY?
I plan on using no delay approach to make two motors running at the same time easier for arduino.
I also investigated hardware interrupts, but there are only two. I read that on some commercial EQ mounts Right Ascension (tracking) commands are serviced by interrupts while the Declinayion (the other motor I was talking about) commands are polled, obviously because right ascension tracking mustnt be interrupted while declination motor is moving.
Am i better off using hardware interrupts ( or pin change interrupts ) for right ascension commands instead of putting them under if or switch conditions? But then I lose serial communication capability, which i dont plan on using initially, but might be helpful down the road.
I know this is a long post but there are so much things circling in my head right now that i had to throw them out. Hopefully, some of you are familiar with telescopes or EQ mounts and will understand all this babble about tracking and guiding.
This demo several things at a time should illustrate how to use millis() instead of delay and how to detect switches while other things happen.
Unless you need to detect very brief events or count events that happen very quickly you probably don't need to use interrupts - certainly they are not needed for detecting switches that operate on human timescales.
Are you satisfed that a stepper motor is suitable? I don't know telescopes but I wonder if the stepping would be too abrupt. A low geared DC motor and an encoder would be another option.
...R
Edit to add link I had forgotten - humble apologies
Steppers are fine, they are used in £1k + commercial mounts as well as servos.
Anyway, buttons will be pressed manually and by pc via autoguider interface (which emulates button press, so no difference at all).
As i said, i have already implemented no delay approach to dec commands.in my prototype code.
I currently have 2 while loops with 4 if else if conditions (2 speed settings for 4 buttons).
Is there more efficient way of putting that up?
What type of stepper motor are you using and how much is it geared down by (how fast do you need to pulse it for tracking). To move a stepper motor you send pulses and to an MCU the time between sending each pulse could seem like an eternity. Plenty of time to send pulses to other steppers and read button presses.
Riva:
What type of stepper motor are you using and how much is it geared down by (how fast do you need to pulse it for tracking). To move a stepper motor you send pulses and to an MCU the time between sending each pulse could seem like an eternity. Plenty of time to send pulses to other steppers and read button presses.
It depends on the radius of the northern sector of the platform, but it will be between 30 and 62.5 Hz. That will get me down to 0.25 arcse
cond per microstep resolution (planning to use a4988 drivers with steppers with minimum 400 steps/rev).