Go Down

Topic: Computer GUI to Control Arduino/Adafruit (Read 6070 times) previous topic - next topic


Hi guys,

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.  I've found AutoHotkey and SmartGUI, but are these what I really need?

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.

Does this sound do-able?  What software would be easy for a programming newbie?
Thanks, Steven


Code: [Select]
Does this sound do-able?

What software would be easy for a programming newbie?

Ummm. There don't seem to be any. Every language trips up any number of users. Personally, I like C# for GUI development, and it's ability to interface with the Arduino, via the serial port. The only difficulty is that the GUI runs in one thread, and serial communication takes place in another thread, so you need to code in the GUI to allow the serial thread to update the GUI.

I have a sample C# app that I could share. PM me with an e-mail address if interested.



As an alternative, there are a number of GUI widget libraries for Processing.


Thanks, I'll look into it.

I've also found FirmataVB Sample Applications; http://www.acraigie.com/programming/firmatavb/sample_applications.html.  I'm too new to programming to know what's what though....



that's a kind of plug-in to make it easier to communicate with the arduino. It's for Visual basic, which is an easy language to learn, since you can just drag buttons, textboxes etc to a form and start from there.
The serial communication is easy too


Thanks Steen,

So while I muddle around in C# I can also look at VB/Processing as it seems more wysiwyg.  The examples at that link I posted doesn't show reversible DC motor or servo control.  They do though seem capable of giving me feedback on the light dependant resistor's change when either lamp is on, and, the outputs seem to have adaquate indication that I've asked a relay or two to turn on those lamps.  Is there a reversible motor control in the VB library?


Apr 27, 2012, 08:30 pm Last Edit: Apr 27, 2012, 10:06 pm by StevenA Reason: 1
Ok, it's time to face facts..., I'm no programmer.

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


The ability to select baud rate appears to be missing from your GUI, as is a connect button.

Also missing is what each button should send to the Arduino when it is pressed.

Building a C# app that looks like that, with all the buttons functioning (when I know what they should send) wouldn't take more than a couple of hours. I could do something like that on Monday afternoon, if you need.


Thanks Paul, I think I need the Arduino code too, that which gets sent by a button click.  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 perforated 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.  The three DC motors are jog in forward or reverse.  They are geared motors and should go slow in PWM.  The servo needs a 90 degree turn, or back.  I haven't worked with any code besides my limited web-building.  I think I'd need the code for Arduino as well.... 



Hi Paul, I can see having a connect button, but would the baud rate be something changed often, or set once when the connect button would be pressed.  I can see the need for setting the port because there will be 6 USB cables plugged into the laptop after it gets bolted to the scope (the computer does not stay attached when not observing) and they could be switched to different ports than the previous time.  Is auto port detection an option?



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


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?

Thanks for considering it.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131