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
Beginning point.
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’**
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
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.
Steven
Yes, my ‘robot’ looks funny,
Yes, my 'robot' looks funny, not your 'normal' robot....
I think I could help with the programming
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
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.
Steven
Here’s a graphic describing
Here's a graphic describing each button's action as I understand things. Does it help?
I think the Servo should be
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
Here’s the button
Here's the button descriptions with the DC Motor4 addition which replaces Servo1....
I was talking with someone
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.
I | A0 | Photoresistor1 |
I | A1 | Photoresistor2 |
I | A2 | LimitM1 F |
I | A3 | LimitM1 R |
I | A4 | LimitM2 F |
I | A5 | LimitM2 R |
I | D13 | LimitM4 F |
I | D12 | LimitM4 R |
O | D~11 | M1 |
I | D~10 | LimitM3 F |
I | D~9 | LimitM3 R |
O | D8 | Relay1 |
O | D7 | Relay2 |
O | D~6 | M4 |
O | D~5 | M3 |
- | D4 | Open |
O | D~3 | M2 |
- | D2 | Open |
Tx | D1 | Tx |
Rx | D0 | Rx |
The Neon/Argon calibration
The Neon/Argon calibration lamp box is complete and operates with mouse-clicks using Firmata_Test and Arduino Uno. The calibration lamp progress is at the bottom of the page; http://spektroskopieforum.vdsastro.de/viewtopic.php?t=3726&postdays=0&postorder=asc&start=50. The lamps are now computer-controlled using Firmata_Test. So, too, will be the other motors as I progress into laying out the optical parts to motorize. The device could be 14 feet in the air when in use hence my making it remote controlled. The motors to do operations will also be tied to other pins of Arduino. The problem is Firmata_Test Original does not remember input/output configurations that I’d set so those, right now, always need to be reconfigured when I restart it, but if the code were changed and re-compiled it would be awesome…
I have attached a picture which shows three panes of Firmata; (left)Original Firmata_Test, (center)Modified to show what the names of the pins should be, the new dedicated input or output (not needing selectable anymore), and, the two states the input or output should read (not High/Low anymore), and, (right)What the end file would look like (what I’d like it to look like) when each line is showing one state like it would in operation.
Is this possible? Can someone make such changes and re-compile Firmata like the right-hand pane? I still need to make a list of state (high/low) v. action (in/out/on/off)
Thanks for considering it.
Best,
Steven
Any chance
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 an updated graphic
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
Long overdue update…
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
Up to now
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
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
Actually, I sent you an email about this a couple days ago.
**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. That is bad, considering I am a 42 year old American.
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.
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
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.