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.

I was thinking out loud again. :P I am trying to get this put together to your specs, so, I will attempt to learn to keep my opinions out of the setup. As I understand it now, The Neon pin, and, the Argon pin will be to read inputs from the phototransistor/photodiode to tell whether the Lamp is actually on, correct?

No worries....

I was thinking "But it works!?!  I saw it work...."  It's a part of the project which is done so I'm glad it can stay.  I look at pictures I took of the circuitry in that box before I closed it up and am really glad I don't have to open it again. :P

I should use the button phrasings as you've shown too....

Name - Pin Type - Device - State - Button Phrases

Calibration Lamp Power - Output Pin - Relay - State 0/1 - Off/On

Calibration Lamp Type - Output Pin - Relay - State 0/1 - Neon/Argon

Neon Lamp - Input Pin - CdS LDR - State 0/1 - Off/On

Argon Lamp - Input Pin - CdS LDR - State 0/1 - Off/On

Yes, the Input Pins are just reading the LDR, so I actually know the lamp turned on because the two Output Pins to choose On and a lamp type might show it should be on but the LDR confirms it.

Have a great weekend.

Steven

http://www.youtube.com/watch?v=uRLRpSGcJ0c

This is no April Fools joke. It just so happens I am updating this today. :) 

...that would have been cruel.  It looks amazing! :D  I've just notified the wife that lit looks like I'll be spending some money on a slit, lenses, and the 1800 lines per millimeter grating..., now that some code really appears to be on the horizon.  They up until now haven't been purchased because they are non-refundable and have very little value on the used market.  The 8" guidescope was just mounted on the 36" a couple weeks ago which will allow me to, with an auotoguider camera, verify the stability and accuracy of the scope's tracking, with a goal of keeping a 30-50 micron star in a 35 micron wide slit.  The spectrograph will do it not through the C8 scope but rather with the reflected light off the slit's backside (what doesn't go through the slit), but I'll get an idea of the magnitude of work to get the scope to the tracking level needed.

Wow, thanks again....

Steven

http://youtu.be/hLEoRUAZ0uk

Hopefully, the ideas get across.

...now that's cool....

So this code could be altered for another project to, for instance, create a different worded button, of a different shape if need be, that when pointed to an Output pin of MEGA (Uno too?) would activate a motor if pressed, or change the color of the button if an input were found to be high?  And is capable of Save-As with any changes for that other project?

The only thing that didn't at first appear compatible in the YouTube video was the slider bars as you described them.  The hardware to move a motor would be set up with two relays, one for direction and the second to jog it in the direction chosen.  This made it intuitive when using the Firmata_Test derivitive code picture I attached recently and the button would change text In to Out when it was pressed and then the second botton made moved the motor move changing text from Stop to Start until is was clicked again to then read Stop.  There is a linear slide pot whose wiper is attached to the moving part associated with that motor and therefore it sends a variable voltage within the range of 0-5VDC to the analog input on MEGA and at the limits of travel there are dual throw switches that break the circuit to stop the motor in that direction and send 5VDC to an input on MEGA indicating limit reached.  The other motor direction is then the only option until the made limit switch is unmade.  That slide pot voltage is on an input and should be displayed as a bar graph of some sort giving some indication of where between the limits it is.  Again, the project as it was moving forward was made compatible with Firmata_Test and possibly something I could understand to create something for the next project.

Three motors would be set up this way with the fourth, the calibration mirror motor, not needing a slide pot because it will be in or out and never inbetween.  The calibration mirror motor would stop when its limit switch is reached sending that 5VDC to a MEGA input via the dual throw.

The Neon or Argon lamps are also set up on two relays, one is for choice and the other is to supply 120VAC to the chosen lamp.  The way it appears in the video is great as it has choice and on/off!

I'll try to attach two pictures.  The first is the motor wiring integrating limits that stop the motor and send to inputs.  The second is the diagram of the system, showing the cable supplying power to the lamp calibration box and within it is also the voltage converters needed for the spectrograph box containing the circuit board of relays/transistors and MEGA.  The one is bolted to the other and amphenol conectors are used.  You'll see the Grating Rotation was without limits, highlighted in red, and that was due to use of Uno.  MEGA provides enough pins now and this Excel file has not been updated due to not knowing if the project mechanics would get code.  All the parts except those within the bolded box labelled Spectrograph are done and the circuit board of relays/transistors is also done, just not the special order parts.

You can change the wording of the buttons. You can change the shape, as long as it has 4 sides and 2 pairs are parallel to one another. I believe buttons could be given a shape, but, the shape would be due to an image, and, not actually be a different shape.

To explain, you might be able to use an image of a circle as the cover for a button. The actual button outline will still be square, but, what the user would see would be a circle. It would take a good bit more programming to make it work.

My thinking on the sliders is this, the slider will denote the position of the affected component. Since the computer will know where they are, moving the slider means the computer can tell them where to go. Hence, a slider moved to a particular position will both show where an object is, and, where it should move to. The control would all be in the programming. If the arduino is expecting specific outputs to tell it when and where to move, it can still receive them. But, if you really want buttons and scales. I can give that to you too.

It would seem that for the mirror object I could either leave the slider, and, it will show you where in the cycle between In/Out it is, or, I can add a couple buttons, and let the scale show you where it is, or, I can lose the scale, and just have a pair of buttons.

Color changing on command is no problem.

Ahhh, I see.

 

Yes, I may need the slider to only be a representation of approximately where within the limit switch range it is based upon the voltage seen on the wiper; 0VDC<x<5.0VDC.  To explain why, if I move the 36" diameter primary mirror in or out slightly in the collimation process of lining up all the optics, that forward or backwards movement then changes where the cone of light is within the range of the linear stage holding the slit, and the slit must be put at the cone point.  I'll have the guiding CCD camera focused on the slit's reflection (only the target starlight goes through the slit and starlight around the target is used for autoguiding or the remnent target stars light that couldn't fit in the slit), so too if the stars are fuzzy because the cone moved I will need to move the linear bearing stage to a new position, at focus, and this becomes the new '0'.  If I were to see the slider value continue to creep up because collimation is a critical thing, then I'd remember next time to back the adjuster screws out, to bring the focus closer to the mid-point of the stage travel and the attached wiper.

There would be less of that type of movement for the rotational stage slider, minus the tangent error of a linear slider, but so too I'll be viewing a pattern of brighter and dimmer lines of the Neon and Argon calibration light spectrum and determining the starting and ending wavelength seen on the main CCD camera, rotating the stage to get the right segment into view (I won't be able to see frmo blue to red, only about 344 Angstroms.  If the lines happen to be blurry, the motor rotating the camera lens focusing the spectrum onto the main CCD is will be used to make it sharp.

For all aspects of setting up the system there's a visual cue I will use to make appropriate adjustments, button clicks, except the calibration light mirror being entirely in the out position.  Where as the 'in' position shows me the calibration light spectrum on the main CCD camera I would definately need to see the 'out' limit switch made.  A slider is not needed there....

If it looked like this picture and worked I'd be dancing....

Jørgen, aka Vendorf70, has been kind enough to work with me offline.  The Arduino Uno was upgraded to a 56-pin MEGA board to allow all states of limit switches to be known.  With the extra pins it also allowed the use of slide potentiometers thereby visualizing where within the limits a component of the spectrograph might be by using an 0-5VDC and the slide voltage tap translated to a analog value somewhere inbetween, where at either high or low analog values I'd soon see an overtravel limit switch activated if I kept going.  This has the potential, if relatively stable, to then move a the grating stage to an analog value and it be close to the wavelength I want to image on the main camera.

So if there's an 'Out', there's an 'In', 'On' there's 'Off', or, 'Neon' or 'Argon' choices, then the limit switches to verify that a component is in position like the calibration mirror and photo cells showing the lamp turned on.

Jørgen is still interested in the project.  I've done nothing with the construction, beyond making the operational calibration lamp box, due to the parts are expensive and have nearly zero resale value.  Without code the project is dead as this spactrograph could be 14 feet in the air and it's dangerous to drag a laptop up a ladder at night to manually control and move these parts.  The lamp box is a salable item to others doing this type of work, if the code never materialized.  But, I'm so glad to hear there's still interest!!!  I will try to attach an image of the Arduino interface as Jørgen and I have envisioned for the MEGA board.

With this method seen below,, the upper section is for setting everything up. I chose a direction for the motor and then move or stop the motor, for each required moving part.  The lower section indicates status of the lamps or overtravel of a component.

Thanks, Steven

I thought the list of I/O that you have listed were part of a configuration page. In truth you moved away from the rectangle with labels and arrow buttons. Next question you say you are still waiting on code. The code you are waiting for is still the GUI code? As I said in the email that garnered this update, I have been working on a rendition of your GUI images.

Making one, or, both of the above windows function as you want "shouldn't" be too much work. I will cease work, if you really don't need it though.

**Side note: The image above was shrunk to a width of 500px. The original is 654px wide x 440px tall.