Let's Make Robots!

Computer GUI to Control Arduino/Adafruit

Ok, it's time to face facts..., I'm no programmer.

I'm building a spectrograph for my 36" telescope and since this device could be 13 feet in the air I'd like to remotely control it. I've built the Adafruit Motor Shield and have attached it to my Arduino board. I'm hoping there is a path to create a GUI with buttons I can mouse-click on that will activate a relay to turn the power to one of two calibration lamps, argon and neon, slowly turn three reversible DC motors that will be geared to two micrometer stages and rotate a 200mm camera lens focus, plus, while I was planning on a fourth DC motor to rotate in a mirror to divert the calibration light into the device but I think it may be better to use a servo there to slowly go from 0 to 180 to bring that optic in and back again. I know Arduino can control 4 DC motors and I think it can do 3 DC's and 1 Servo.

The computer on the telescope, that'll control the spectrograph, is part of an adhoc network where I remote desktop control it from 20 feet away.

A description of what I'd like is;
GUI buttons within a frame to; turn on the lamps via relay activation (I may need to add a Light Dependent Resistor so Arduino can determine that the lamps actually lit which then may require an indicator light within the GUI frame), buttons to rotate each of the DC motors slowly (PMW?) reversibly, and a button that would slowly rotate the servo to 180 and slowly back again when its button is clicked again.

The spectrograph will have two CCD cameras for me to see visually something that indicates the motors have turned or optic rotated in.

I know what I need. I have an idea how it's all supposed to work. I'm good at mechanical, electronics and optics but some pieces (coding) elude me. Is there anyone who could design the code to make a computer GUI that looks like the attached picture with described buttons?

I hope there is....

Thanks, Steven

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

While the construction of the spectrograph has not progressed, there was one big item needed from the telescope; autoguiding, accurate autoguiding.
The ServoCAT servo motor system was installed, but then, as its deficiencies were found it pretty much meant every single piece of hardware that came in the box had to be rebuilt to make a 1700-pound telescope move well (so the ServoCAT install is coming up on two years now but it has worked for visual purposes). Then, all the gears in the gear box of Alt and Az were put on the drill press and pinned to their shafts when I was finding set screws coming loose (only one per gear is absurd). And, in addition to that, extra brackets were made to eliminate sources of mechanical flexure causing backlash with using a spool and knurl on long shafts to move Alt/Az so that then software backlash compensation would only have to take care of the expected gear mesh slop and nothing more. http://darkskyobserving.com/ServoCAT.html. StellarCAT offers a Jr. and Deluxe model. Starting with Deluxe, what I've created is now the Monster model.

As such, I'm happy to say that just two weeks ago, after all was completed and installed I set the speed of the system software to 7.5-arcseconds per second, and, at 400x in a reticle eyepiece I did not see any noticeable delay when moving the scope or reversing the direction. My estimate is under 2-arcseconds of backlash. The software setting for backlash was set to zero.
Last night I battled the software drivers for Orion's Starshoot Autoguider and it's now working. Next time I go up to the property I'll be seeing for the first time if the autoguider placed in the guidescope, a C8 bolted to the side of the 36", autoguides and I can look into an eyepiece in the 36" and see it stand totally still.
I appear to have nailed the backlash, if the motor/gears system is robust, to enable the the spectrograph project to continue.  The backlash problem was a project, enough to stop science from happening on the scope if the scope couldn't hold a star still using autoguiding. 

Birdmun, may I ask for continued help in a self-installing disk that would contain the software parts needed for the GUI design as we've discussed to control the Arduino using buttons and sliders? 


—since you are entering the realm of stallar spectroscopy, I am actually wondering where you are taking it? What I mean is are you looking towards chemical makeup of stars, nebulae or possibly even using it to try and catch glimpses into the make-up of exo-planets?  [Yes, I realise that takes advanced techniques to block out the light from the parent stars to pick up planetary information.]

Not sure how hard they would be to locate from a ground-based scope, but there are now over 500 "rogue" planets located that seem not to be orbiting any stars, but floating free. Considering how dark they would be I bet they could not be seen from the ground.


Hi Dan, I'm not doing the spectroscopy on exo's, as that does require way more sophisticated equipment.  A friend of mine here in the Phoenix area is detecting them, though, using a smaller scope than yours; http://var2.astro.cz/EN/tresca/transits.php?pozor=Parijat+Singh&submit=show+...

My interest in spectroscopy is in regard to the details one can get about what's physically going on, particularly in interacting binary stars called Wolf-Rayet stars, and becoming a co-author on the scientific papers generated.  The Pro-Am group I'm trying to get involved with, with this spectrograph project, is called Convento Group.  Plus, to me, a 36" scope should do more than just show pretty objects and being science-minded like I am I'm trying to get the scope to the level needed, which is way better tracking than is needed for any visual observing, actually no tracking is needed for visual....  So it's a very challenging assortment of systems that I must get to play nice with one another.



Fantastic. I have great interest in exo-planets, myself, and am looking that Czech. site over carefully. Thanks.

As to your scope, I agree that it would be a waste to not take advantage of the increased seeing given you by that greater aperture.  I really should try getting into spectroscopy. Even at my smaller aperture, I might be able to get some meaningful data out of it. For instance, I would love to nail down some new information on one of the exo's that showed it more Earthlike than their first observations indicated... :-)

About all I've done so far with my equipment is astrophotography. I recently purchased a peltier module to play around with and plan to make a "cold-box" for my camera.  The quantum noise speckles on the photos can be an irritation. You can get rid of a lot of it by stacking the photos, but it would be better if they were not there in the first place hence the cold-box may work out well.

Anyway, good luck on the current project. I am watching it with interest, and I have previously looked your page(s) over. A lot of good work went into those. I bow to your commitment.


I originally planned to get into astrophysics, but along the way I ended up in quantum physics instead. (long story) 


(double posted. ignore this one.)


Let me know if there are any changes you would like me to make, or, if there is something you would like me to explain better. I can tell you that the button choices are not currently saved. I will be sure to set the program up to read the potentiometers before anything else happens. The drop down for Calibration Lamp Type is disabled. I don't understand how you need to set a pin for that particular label.


The lamp power and selection are each on separate relays.  The power is the easy one, the power, 120VAC, is on the NO contact so power is sent to one of two lamps on the second relay only when the power relay is energized.  The two lamps are on relay 2 and on the same pole but different throw directions; NC contact is Neon, and NO is Argon.  So when NO contact is held closed the Argon will light as long as Power relay button is pressed.  Each lamp has photoresistors currently wired to Arduino Analog Input pins.


Can the slide bars, if they are that length, get a number included to the right of the slide to show the rough position like 0 to 1000 (or something)?


My gosh, I can choose the I/O pin, save the I/O configuration (though I may have to re-choose the Com Port that's ok), and it will come up with the same button names after rading the limit switch states and pot wipers?  And I can do a Save-As with whatever name I want (or does that require that I recompile?), and, if I'm clever I can rename buttons for some future robot board project as long as it's MEGA (and again recompile?)?  How would I, for instance, change it from Telescope GUI to something else?

This is sooooo cool.


http://pastebin.com/5tQUeTwY This link is set to expire in a month.
zip containing everything you "should" need https://dl.dropbox.com/u/28951892/Telescope%20GUI.zip except for
Python http://www.python.org/download/ 2.7.3
and, PySerial for the version (x86 or 64bit and 2.7) that you download from above http://www.lfd.uci.edu/~gohlke/pythonlibs/ (near the bottom 1/3 of the page)

Re: sliders. There is in fact code that will add numbers to the right of the sliders as they are updated.

I still have a fair bit of code that will get the program to talk to the arduino. I have one that I can use to test bits of code to get everything hopefully working.

Re: the Calibration Lamp - Type. I was mistakenly thinking this choice would need two pins. It does not. A single pin with output will be either Neon, or, Argon. The power pin above will control whether or not the lamp is turned on. A NOT gate will be required on the arduino end of this setup to make all of this work, then, the pins for Neon and Argon will have the responses from the photoresistors. Bottom line, I will reenable that pin selector.

Thanks birdmun, I copied all the files but the scope laptop is rather old and had an unusually small hard drive, so I'll try to get them set up on my home-use laptop which one day will most likely be the one eventually mounted on the scope, moreso if the code is installed and works.  then a new home-use will be in the control room used to control the scope via remote desktop.  Is there anything I should look out for in installing all these files?

I hope not, but were you waiting on me for anything?

Thanks, Steven

Thanks, I've downloaded everything and I'll try to install it.

Regarding the lamps, it's 2-relay (2-button) configuration is the same as any of the motor 2-button.  The calibration lamp box already works with Arduino Uno using the Firmata_Test.  For the lamps, 2 output pins are used going to one of two relays.  They should make a button change to Off/On when de-energizede/Energized by the Arduino Output Pin.  The second Arduino Output Pin, same thing; output Off is set to NC contact on relay and energizing the lamp type Output Pin then closes the Contact enabling Argon.


0 - 0 =Off-Neon; No light comes on, so no detection on Input Pin with photoresistor so Power Button shows Off and Neon Button stays showing Off.

0 - 1 =Off-Argon; No light comes on, so no detection on Input Pin with photoresistor so Power Button shows Off and Argon Button stays showing Off.

1 - 0 =On-Neon; Neon light turns on and Input Pin Neon goes high so Power Button shows On and Neon Button changes from Off to On.

1 - 1 =On-Argon; Argon light turns on and Input Pin goes high so Power Button shows On and Argon Button changes from Off to On.


I don't see a need to put an inverter on it, and really hope I don't have too....