Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Computer software to control Arduino


Gina

Recommended Posts

I've decided to look into controlling some of my Arduino projects from a computer.  I know I can control it using the serial terminal and typing in ASCII bytes or integers but I would like something a bit more user friendly.  Some time ago I would have been well on top of this but my programming skills have virtually rusted up except for Arduino sketches.  First candidate will be my Arduino quad focuser :D

The Arduino web page suggests "Processing" and I'm downloading it ATM.  Anyone have any experience of this of other software, please?  Any suggestions and recommendations gratefully received :)

Link to comment
Share on other sites

  • Replies 80
  • Created
  • Last Reply

Hi Gina

I control my Arduino projects using Visual Basic using Visual Basic Express 2010. This effectively provides a windows front end for sending and receiving data through the Arduino serial port ..... And it's free.

Let me know if you choose to have a go and need some help.

Steve

Link to comment
Share on other sites

Hi Gina

I control my Arduino projects using Visual Basic using Visual Basic Express 2010. This effectively provides a windows front end for sending and receiving data through the Arduino serial port ..... And it's free.

Let me know if you choose to have a go and need some help.

Steve

Thank you Steve :)  That looks good - I've used Visual Basic in the past.  I'll check it out :)

Link to comment
Share on other sites

Why won't anything work? :(  Took the plunge on a download - the setup.exe is in the downloads but it won't run :eek:

Maybe time I returned to my sick bed :D

Found the problem - MalwareBytes has blocked a virus in the download.  Just as well I've got that protection :D

Link to comment
Share on other sites

I don't want to do much to start with.  Just a 4 way selector switch to choose which focuser I want to control and 5 buttons to emulate the 5 buttons on my electronic remote control box.  These to be clicked on with a mouse/trackpad/trackball.  It would be sufficient if the result of setting the focuser sends a code via the serial terminal and likewise the 5 buttons.  Surely not a difficult job?

I just want to control my focussing system from indoors via TeamViewer.  I suppose I can make do with typing A, B, C or D to choose focuser and 12345 for the buttons.  The Arduino sketch already returns the focuser chosen and the appropriate focus count.

Link to comment
Share on other sites

Try downloading Visual Basic Express 2010 from here, This is the site I used a while ago.

http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx#

Thank you John :)  I didn't think of getting Visual Basic as part of Visual Studio - I thought it was different software :D

OOOPS problem - needs a Microsoft account :(

Link to comment
Share on other sites

Hi Gina et al.,

As before, inspired by:

http://www.technicana.com/physical-computing/73-connect-to-the-arduino-with-c-.html

I did eventually write a Windows Forms interface based on Visual C# Express:

I downloaded the trial vs (I will have to investigate re-licensing the product?)

I am using one of those Velleman arduino shield interfaces:

http://www.velleman.co.uk/contents/en-uk/p582_ka05.html

Got the Arduino to assemble a data buffer with 6 Analogue + 6 Digital  inputs

Bitwise(?) data sent / received for the setting of the relays on and off etc. 

My C# windows interface for Observatory Control then contained something like:

private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)

 {
//        RxString = serialPort1.ReadExisting();
          RxString = serialPort1.ReadLine();
          if (RxString.Length >= 24) // 24 bytes + <CR>
          {
              this.Invoke(new EventHandler(DisplayText));
          }
   }
   private void DisplayText(object sender, EventArgs e)
   {
//          Debug.Write(RxString.Length);
// Print out the buffer, fill the interface form etc. etc.
Unfortunately, the project ran out of time / funding. <sigh>  :o
The program was a bit glitchy -- Worked MOST of the time. :p
Never did completely solve problems of asynchronous comms
with the Arduino. First time round the data buffer may well (will)
contain incomplete data! I did try to check / discard this, but...
Just looking for a bit of programmer genius, I guess? <hint>  :D
Link to comment
Share on other sites

I run my pic stuff with the Ftdi serial to I2c adapter straight from the command line using vbscript because once I have debugged it I can drop it straight into vb or use the cscript parser or even a web page to run it.

The dome controller uses vb if you want some code.

Mike

Link to comment
Share on other sites

Thanks all :)

Got a MS account and now installing Visual Studio :)  Seems there's a lot of it :D  Still, should finish sometime today :grin:

Don't really care if I use VB or C++ though I'm more used to C++ :)

Link to comment
Share on other sites

Going by some examples on the net I've added some code into the control events and the did a Build - 17 errors :D  No surprise there then! :D

Ordered a couple of books from Amazon - one scheduled for delivery today and the other tomorrow.  Hopefully they will tell me some of the basic fundamentals that people posting examples online forget.  Nothing is obvious to the beginner.  Or in my case re-beginner :D  It's decades since I last used VB.

Link to comment
Share on other sites

Re-arranged some code blocks and an "End Class" and got errors down to 6 :)  I'm struggling with my brain and the flu (I've concluded that it's flu going by the symptoms and that it's been going on for 5 days now.

Found a useful piece of info here for reading data from the Arduino in VB.

Link to comment
Share on other sites

I think I might be better trying just a simple tiny Arduino control and expand on that.  I could start by turning a LED on and off :D  I'll dig out a Uno and plug it into my desktop.

Link to comment
Share on other sites

Well that idea went out the window :(  Can't find an Arduino that works that isn't built into something.  Think I'll have to go back to bed - feel dreadful :(  I guess if I'm not better by Monday I shall have to call the doctor out :(  No chance of driving in my present state.

Link to comment
Share on other sites

Oh dear - It seems to be "doing the rounds", this year. Hope you feel better soon. :o

Yes, that should do it! Thanks for link - Should help my "mostly working" C# version.

I was being lazy not handling errors properly and the program bombs sometimes. :D

At the Arduino end, I'm switching relays, depending on toggle buttons on the interface.

Nothing clever, just checking first for Serial.available() then... looping on Serial.read()

with a big "switch" depending on reception of a Capital 'A' (lower case 'a') B, C etc. :p

I stack a number of analog.Read()'s and digital.Reads()'s into a *buffer* and send it

back via serial.Println(buffer) - Or was that serial.Print? <g> The sampling rate is fixed

at the Arduino end, via a delay(100) etc. But if you come up with any cooler ideas...  ;)

Won't be resuming just yet - I was using Visual Studio 2010 and the newer version will

require a system upgrade to Win7+ (Support for latter expires in Jan 2015 seemingly!)

But they keep it ticking over for a further five years, I believe... :)

Link to comment
Share on other sites

Talking on the phone this afternoon to a friend who's well into coding and has used various programming languages, he said the language he liked best was Python, which was what I programmed my weather station in.  So I Googled "Arduino and Python" and it seems Python is actually the easiest language to use to communicate with the Arduino over the USB/serial interface :)  Python is multi-platform and works in Windows, Linux and Mac OSX.  I actually designed and ran the weather station software on a Linux box but it can be compiled to run on any OS.

Link to comment
Share on other sites

Indeed a possibility? Looks like Python comes with "Tk" (Tcl?) for GUIs? ;)

I'm not overly attatched to Visual Studio(s)? Fun at first - But you can spend

a whole lot of time dragging widgets into place... One spurious click and you

have written a whole raft of irrelevant code? lol. Removing stuff by hand can

lead to a "loss of synch" with the resource files and days of work lost!  :angry8:  :p

A think, for a simple window, for personal use, on one machine, *absolute*

positioning of elements via program call has a lot of merit. We keenly await

your solution for the communications bit though? [teasing] :D Keep Well! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.