2

What's the best/easiest software to make a PC-Arduino interface? Ideally, I need to create a .exe that shows up a simple graphic interface, where the user can display data acquired from sensors connected to the Arduino (eg. Voltage, current etc.) and from there he should be able to control Arduino outputs through graphical buttons/switches.

To say that I am not a programmer, so if there's some sort of 'graphical coding' or 'non coding' software to make such things it'd be great!

Thanks for your help!!!

UPDATE:

Image of how the user interface should look like:

Image of how the user interface should look like

closed as off-topic by Anonymous Penguin Feb 8 '15 at 16:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Arduino, within the scope defined in the help center." – Anonymous Penguin
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I always like to show this; youtube.com/watch?v=YlA3qJi2q9c And it has gotten a lot better since. But it is talking to an Netduino, which was replaced by an Arduino now. – user6569 Feb 5 '15 at 23:40
  • Welcome to Arduino SE! This question is off topic since it's not about Arduino, it's general programming (with an Arduino connected to the computer, but that's not even really significant in the question). Thanks! – Anonymous Penguin Feb 8 '15 at 16:03
3

The "best" software for me is the free Visual Studio Express for Desktops.

Using C#, I would add a SerialPort component to the form, configure it for the same COM port as the Arduino/FTDI, then send commands to it.

VS Visual Studio is "stupid simple" (I'm not implying anything :D). Double-click Button in the toolbox(1) and it creates one. Double click the button(2), and it outlines the code and attaches the Click event to it for you. Double click Components>SerialPort(3) to create one. My code is highlighted in blue to the right and this took all of 1 minute to create.

To point you in the right direction on the Arduino side, here is the structure of the "command" I sent in the screenshot:

XXXYYYZZ
Where:
XXX = 000b for "turn off", 001b for "turn on", 010b for "toggle", 011b for "read pin"
YYY = Pin number //Max = 111b = 7 (+ 0) = 8 uniquely addressable pins (using 3 bits)
//Pin number does not have to match the MCU port/pin designations
//MCU will convert logical pin #'s 0-7 into the correct physical port+pin
//For more pins, steal another bit from ZZ; Max for YYYY = 1111b = 15
ZZ = Spare bits //Tell the Arduino whether to acknowledge or not, etc.

00100100b = "Set pin 1 high"
01001000b = "Toggle pin 2"
10000000b + 0xAA (two byte command) = "Reply with contents of register 0xAA"

Additional commands can be created to tell the Arduino to reply with a specific variable or status.

bool isRegisterRead = false;
bool isMultiByte = false;
while (true)
 if (wasByteReceived) //This flag is set in the RX interrupt and the byte is saved to byteReceived
  if (isMultiByte) //Second byte received
  {
    if (isRegisterRead)
    {
      //We need to read and send the value of the register at the address in byteReceived
      ReadAndSendRegisterValueAtAddress(byteReceived);
      isRegisterRead = false;
    }
    else DoSomethingWith(byteReceived);
    isMultiByte = false; //Start over
  }
  else //First or only byte received
  {
    //Consider using a ZZ bit to indicate more data instead of listing them explicitly
    if (byteReceived == 0x80) //A multi-byte "read register" command
    {
      isMultiByte = true; //Next byte received is money
      //For my example we need to set a flag somewhere to indicate that we are reading a register
      //isRegisterRead should be set to true by DoSomethingWith
    }
    //Is there any processing for the "command" byte? (i.e. extract and save the pin number)
    DoSomethingWith(byteReceived); //Process one-byte command or first of two-byte command
  }
  • Answer tip: to view image in full size, right click and open image in new tab (chrome) or save it on your PC. Thumbs up for excellent answer btw. – cyberponk Dec 22 '16 at 2:32
2

Almost impossible to answer really. Questions with "best" are always going to yield opinions which probably won't apply to your situation. For example, I would do a C# desktop application because that's what I do, and nothing in that environment hinders communication with an Arduino. So, what's best for me is best because of "familiar and will work" and we can't decide what meets those criteria for you.

If you will update your question to describe more about your application, details about your interface, users, and what skills you have, then I will update this answer, but as it stands "the world is your oyster" because almost any programming environment capable of making an application will be able to interface with Arduino in some way.

For "graphical" programming look into LabView - I can think of a lot of reasons to not go that way though. http://www.ni.com/labview/

Here's a tutorial for interfacing a c# application with Arduino: http://www.codeproject.com/Articles/473828/Arduino-Csharp-and-Serial-Interface

The gist of it is this:

  1. Some version of Visual Studio up and running - you can use the free version mentioned in Jon's answer (Express version for desktops).
  2. A working Arduino connected to your computer with the USB.
  3. Create a new Windows Forms Application and drop whatever controls you need onto the form
  4. Write your Arduino-connecting code into the events of the controls

That is the basic method of creating Windows Forms apps regardless of what you're doing. You create forms with controls and your custom code goes into the events of those controls. If you read the tutorial it explains how that code works, but here's a sample... (In the tutorial, they are doing a WPF app, which is slightly different from Windows Forms in how the controls are defined, but the code is basically the same). This is an event of the serial port - you respond to the event by displaying the received data into a text box. Very simple!

void mySerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) {
    string data = mySerialPort.ReadTo("\x03");
    myForm.myTextBox.Text = data;
}
  • Thanks for your answer Jasmine! Agree, "best" is not the right term in this situation. I am trying to make an application to monitor voltages and currents fed back from a number of Arduino units wirelessly to a PC. The user, through the application, should also be able to control simple high/low output states on the Arduino (under the control panel - see updated image above). I am not particularly skilled in software programming, that is why I asked for a graphical software. However I can pick up the logic quickly as I know some C, VHDL and Assembly. Why wouldn't you recommend LabView? – Andy Feb 5 '15 at 21:00
  • LabView "apps" are hard to distribute. The software itself is expensive ($1000 base). The controls have a 'rustic' look. LabView as a skill is hard to market because the industries which use it are fairly narrow - aerospace, hard sciences mostly. So, learning it to do this simple task wouldn't be worth it. – Jasmine Feb 5 '15 at 21:27
  • And, have you considered using physical controls, making the device self-contained? This would be better than using a computer interface, but a little more expensive in parts cost. – Jasmine Feb 5 '15 at 21:28
  • The device is also self-contained. I need the application to run the manual mode so the user can manage them at any time. Any other suggestion about what programming language or software is most suitable to make such app? – Andy Feb 5 '15 at 21:31
  • No, even with the additional information I would still go with a c# desktop app. There's a lot of good ways to do it. – Jasmine Feb 5 '15 at 21:48
1

3 votes for visual studio and a windows desktop, although I would chose WPF. Win32 (Winforms) is a slightly out of date architecture. WPF has a steeper learning curve, but worth it if you want to become proficient. If it is a one off application, don't bother, use winforms.

I'll add a couple of points. Debugging Arduino sucks. I am being kind. The Arduino IDE deploys on com port 1, and prints debugging messages on com port 1, so if you need to communicate un-interrupted by debugging and deployment, what do you use? Not com port 1 for sure. Look at software serial in the beginning and assign ports around its requirements.

Second, writing your own com stack is dumb, yet is done 99% of the time. Look at MQTT if ethernet is available, MQTT-SN if it is not, CmdMessenger or CommandSerial or something similar or spend days designing, writing, re-writing and debugging your own, your choice.

Not the answer you're looking for? Browse other questions tagged or ask your own question.