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.

There is no image attached. I am sure there are a number of people here that could produce something like what you want, if they knew what it was you wanted. :)


Thanks Birdmun, I 'added' the pics but didn't see a 'submit', so I thought they loaded....  I'll try here again.  There are descriptions below the graphic of the type of buttons to mouse-click on, momentary to jog motors in the operational section at the top of the graphic, or, click and it does something until the opposite action button is pressed for the calibration section at the bottom of the graphic.  The button that's been clicked becomes highlighted indicating it's in use.  In the graphic the servo motor with its pickoff mirror is pivoted 'in' to position to divert calibration light towards the slit, the calibration lamp is turned 'on', 'Argon' is the chosen lamp type, and the purple indicator is bright (not greyed out like the neon that's not on at the moment), which feedback is provided to Arduino by the photoresistor beneath each lamp. 

Right now Arduino shows up on port 4 so I thought it might be a good idea to have the choice drop-down.  The Arduino board will be one of six USB devices running while doing spectroscopy, the others being the main CCD camera, the autoguider CCD camera, a thumb drive for image storage, the telescope tracking servo motor system, and, GPS timing so the images are properly time-stamped.


Thanks, Steven

This graphic is just for reference.  It's the system diagram showing cameras, motors, lenses, grating, micrometer-driven stages, Arduino, and, the outer triangular shaped shoe-box that will enclose all the components.  The pink rectangle is the main CCD camera attached to the camera lens with the Arduino board shown beneath it.  The telescope is shown as the brown arc on the left with the 2" focuser as the dark grey rectangle with the round knob.  The autoguider CCD is at the top left, and the round feature to the left of the actual Arduino is the grating rotational stage.  It'll weigh ~20 pounds and could be 13 feet in the air possibly, so I thought it best to automate any operation or calibration.



Yes, my 'robot' looks funny, not your 'normal' robot....

Do you need code for the arduino too?

And... are you in a hurry? I may be able to help but I can't give you any time guarantees. Tomorrow is a holiday so I may have some time to look into it more closely.


Thanks Antonio, yes, I think I'd need the code for Arduino as well....  As for when..., earliest convenience.  I appreciate that those smarter than me would help.  To see the telescopes you can visit my site; http://darkskyobserving.com/, or pick up the June issue of Astronomy magazine and turn to page 60.

I have just ordered what I think are the remaining components for the calibration lamp box; a perferated project circuit board, two 5vdc relays, and TIP120's to connect the inverter circuit board to the custom lamp board.  I already have the other needed resistors and diodes, and, NE45 and AR3 lamps. 

The calibration box will tie to the main spectrograph box via cable containing two photoresistor input lines to Arduino indicating either lamp lit condition, two output lines from Arduino to operate the two relays that turn on a lamp and select which lamp, plus 5vdc and ground.  Once completed I'd need to know which pins you've called out for those two inputs and two outputs to be connected to.  The motor shield is built and the DC motors are on M1, 2, and 3.  The servo is on number 1.  I've already soldered in the remaining sockets on the shield. 


Thanks for looking at it.


Here's a graphic describing each button's action as I understand things.  Does it help?

I think the Servo should be swapped out for the fourth DC that Arduino can handle. It too will rotate Forward when button 7 is pushed and stop when the limit switch is detected tripped on Arduino input. And then Reverse and stop when the other limit switch is detected tripped on a different Arduino input. If the system fails while this is midway it's easier to recover from than a servo who only knows 0 or 90 and it's at something inbetween. It may think that something inbetween is a 0 or 90 and I'd be in trouble.

The Arduino might have enough inputs to be configured with limit switches on them. If it can, which initial inspection suggests I'd have two left unused if all four DC motors had two limit switches.  Is it possible for the code to look for the limit switches and stop that direction of travel of that motor?


Thanks, Steven

I was talking with someone and they mentioned Windows could get caught up doing other things, or crash, and, it would need to be recoverable....


The servo is maybe the most problematic in this regard, so I'm hoping it's not too much trouble to change servo1 for DC motor M4.  I've reposted the graphic for buttons.  The other three motors could also possibly use limit switches too.

IA2LimitM1 F
IA3LimitM1 R
IA4LimitM2 F
IA5LimitM2 R
ID13LimitM4 F
ID12LimitM4 R
ID~10LimitM3 F
ID~9LimitM3 R

Here's the button descriptions with the DC Motor4 addition which replaces Servo1....