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.

we could get larger versions of those pictures? I can make out that there are pin names, selection boxes, and either, on/off, or, yes/no boxes, maybe.

Here's a, hopefully, larger version....

 

Thanks, Steven

Here's an updated graphic correlating the Firmata_Test pin to the dedicated Input or Output needed, relative to the Arduino pin and the action regarding use of a relay, photoresistor or limit switch....  The only error I see in the third pane, last picture, is that the button labels shown would be everything in the off state but I've inadvertantly put 'Ar' instead of 'Ne' for the lamp type since the Neon lamp is on the NC contacts of the Lamp Type relay, so upon startup up the Neon lamp is connected but needs the 'Lamp Power' button pressed to turn it on....  The Calibration Mirror position would normally be 'Out' of the light path and so Arduino would see 5vdc from that switch upon startup and therefore 'Calibration Mirror Out' is 'Yes'.

 

Best,

Steven

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.

Hi Birdmun, thanks!  I was unaware you might be helping.  As I became more fully aware of the complexity of interaction with Arduino, the GUI as I originally envisioned it, it appeared, was so fanciful and therefore possibly a pipe dream.  I'm not a programmer and when I looked at it and got info from those knowledgable in C++ or C#, that it was obvious it wouldn't get done in my lifetime if I had to do it myself.  I was completely happy to lower my sights, and have something as basic and rudimentary as Firmata_Test where it was changed to MEGA board number of pins when Jorgen offered to help. 

If there still is a possibility of a GUI, taking the IO pins of MEGA that would be sweet!  The MEGA_Firmata_Test seemed a more straight forward, less time consuming path to get something to work.  In the emails with Jorgen, the use of the linear slide pots on analog pins was an awesome addition.

Since I don't know the magnitude of what I'm asking for in terms of time and work, because I'm not a programmer, would what you've shown above, if also adding the analog scales for the slide pots, would this duplicate the effect that Jorgen has done, only in a different way?  I would really like to have a code set I could use and know the spectrograph could actually be finished, (and also where I can open it in some software, and understand how it was constructed).  To use a can of code without knowing how it does it is fine too, but should something need to be tweeked I'm try to be self-supporting.

Are Jorgen's and your option different paths to the same thing, more or less?  Do you want to work with Jorgen?  I only need one path to know the project is alive, but it's difficult for me to know there is a path that'll happen....

Thanks, Steven

**After looking over the start of this reply, I would have to guess my English skills are about as good as my Python skills at the moment. :D That is bad, considering I am a 42 year old American. :P

I am merely dabbling with Python and Tkinter to generate the GUI you are asking for. The one bit that really does not work at this time is the Port Scanner. If you can lower your sites to manually entering the COM port, or, one of the knowledgeable Python coders here pop in for assistance to fix it, I believe the whole of the GUI can be assembled in fairly short order.

I have posted some of the code to pastebin for short periods, only because I see no reason to clutter the interweb with my poor Python programming. :) I honestly have no trouble sharing the code. I might need to add some helpful comments here and there, as I have just been bashing on the keyboard, and, working with what comes out. :D

The next fun bit will be getting the GUI to talk, and, listen to the arduino. I doubt it will really be too terribly difficult. I just have never done it. More new things to learn. :)

I have no known issues working with others. From the icon in the corner of his application, it looks like he might be using JAVA. As long as someone has a clue, and, opinion as to how the layout should look, I am willing to work with them. As far as you supporting the code yourself, Python really doesn't seem too bad to muck around with. Most of what I have done was accomplished via reading stuff found on the web.

Wow, thanks.  When I was one pin shy for the project using Arduino Uno to know teh state of everything, Jorgen suggested MEGA.  That certainly gave me more than enough pins and then the slide pot idea was born, connecting the slider to the motor-driven linear bearing carrying the focus-related parts, one attached to the rotational stage (accepting the tangent error that would occur), and one for the camera lens which focusses the spectrum onto the large CCD chip.  The calibration mirror is in or out, never inbeween, so with these other three giving a voltage value shown as a rough bar graph and number I could estimate where between the limits I was with any of them.

Jorgen happen to have a MEGA board but not an Uno, so I ordered a MEGA board too to get it up and running while he coded.  The driver was giving me the fits, finally it installed right and I could run the Firmata_Test for Uno he changed to show all 56 MEGA pins.  The programming paused a bit as he was swamped at work.  He says he's still interested.

What I had hoped for, with the albeit manual reconfiguing the Firmata_Test to proper inputs or outputs (they get reset each time it starts), was if I could understand the updated coding changes Jorgen would do, then I could replicate that for other projects using a MEGA board.  With Firmata_Test you can't do save-as and it remember what it was when you reopen it.  If Jorgen created one with a save-as, and I could figure out the pin naming schema and how to set pins as Digital I/O, or Analog O, then I would have a path for other projects....  My english is bad too, and hopefully this was understandable, but I'm proud I can type with 10 fingers not just 2.

 

A GUI would be nice, but even the Firmata_Test if changable and savable, would take me far if I could open it, alter it appropriately, and save it for the new purpose.  I've learned to make my own websites, so too, I hope to understand this code.

http://youtu.be/hLEoRUAZ0uk

Hopefully, the ideas get across.