Your go-to language/dev enviroment for MCU - PC host software - Page 1
Forum section: electronics / projects

author: Buriedcode
author_rank: Super Contributor
timestamp: April 11, 2017, 04:31:29 pm
content: I'm sure this question has been asked many times, often vaguely with 'what PC language do you use?' but I will try to make this more specific.A long time ago when I found out how cool it is to be able to hook an MCU to a PC (back then it was mostly serial, but quickly became USB, ethernet, now WIFI, or bluetooth) I started making windows apps in... VB6, then VB.NET, then realised how gastly VB is, switched to C# but still using .NET most of the time. After years of reading hackaday articles, and reading posts on here it seems we are spoiled for choice in terms of what language we use for the 'PC host side'. Be it for full compiled apps using .NET/C# or scripted languages, python, java, processing etc.. safe to say I have very little experience in the latter examples.So, for jobs where you've made your MCU-based hardware... say.. for sensors or human interface etc.. what did you use for the PC host software? And do you still use good 'ol serial (be it RS232, USB-serial adapters, or RS-485) or is it more common to choose USB (HID class rather than CDC?) or Ethernet, for remote systems.I constantly feel like I'm 'missing out' by not knocking up python scripts or java applets when I need a bit of bespoke software for my own projects, even though I can probably get a half decent GUI quick 'app' knocked up in visual studio using .NET in a few hours. - an example of that would be a small app that imports a *.wav file and sends it to a AVR MCU via serial port to load in a flash chip for playback.I'm sure there is 'better' (as in faster, neater, easier?) way to make such applications and also it would be good for me to learn some scripting languages (mostly java .. but python seems very popular too). But I'm asking if people on the forum actually use these. I have always wanted to add 'data visualization' to applications (graphs, dials etc..) but being locked into .NET's tools I think is stifling. So what are the common languages and tools you use?

author: ajb
author_rank: Super Contributor
timestamp: April 11, 2017, 05:06:49 pm
content: I've been thinking about this recently as well. I've done a bit of python, which has of course a lot of available extensions including several GUI toolkits. I've used matplotlib to do some basic trend plots and that works fairly well, although implementing user interaction with the graphs (pan, zoom, etc) seems to be a bit cumbersome.One option that's caught my eye isElectron. I'm sure people will respond with how it's automatically terrible for being all web-derived, but the possibility of leveraging the layout and styling power of HTML/CSS and the rich user interaction capabilities of javascript (including many of the popular JS frameworks) for cross-platform desktop applications is pretty appealing. Apparently there is support for accessing serial ports from within Electron, but I haven't investigated that or any other connectivity facilities yet. I assume it's possible to tie into backend stuff written in other languages where necessary.

author: max_torque
author_rank: Super Contributor
timestamp: April 11, 2017, 06:16:30 pm
content: It's an interesting question and one i also would be fascinated by the answer (which i suspect will not be straight forward, as there are so many options to choose from!)I am spoiled because at work, i use a tool chain that costs thousands, and it means i can design a model in Mathworks Simulink, auto code it to the target controller, then flash and calibrate that target using ETAS INCA over CCP/XCP etc. As a tool chain, that's a multi thousand £££ capability.What i'd love is a simpler, hobby version, with a robust software front end, that loads standard target descriptor files (probably .xml format) and enables relatively seamless system optimisation without rewriting the code every time!

author: rstofer
author_rank: Super Contributor
timestamp: April 11, 2017, 06:55:54 pm
content: I am more than willing the use VB for the host side regardless of the type of communications. Serial, HID, Ethernet, doesn't matter.Lately I have been playing with C# but I haven't done anything on the outside. I suspect it will work fine. I did play around with Microsoft's IoT platform for a while but I don't have an application. All my toaster needs to do is make toast. I don't expect it to display Headline News.My watch does that... No it doesn't!Interesting project: Add knobs, switches and dials to Microsoft Flight Simulator using an AVR on the sensor/display end with HID transmission to a bit of C code connecting to a library provided by Microsoft. If I were more interested, I would build a full function cockpit for the F106. At the time, I didn't have room. Now I have a 4 car garage and the cars stay outside so it would be possible. Hm...

author: sanwal209
author_rank: Regular Contributor
timestamp: April 11, 2017, 06:58:09 pm
content: From last 10 years I have used different softwares to design GUI. I did start from VB6. Best choice would be either .net or Labview. In Python you need to make gui by coding int text and trust me its so much time consuming. Debugging is 75% guess work, 25% magic powers. For me its the matter of time. Try making a simple uart string dump from python and you will get the idea.

author: krho
author_rank: Regular Contributor
timestamp: April 11, 2017, 07:18:21 pm
content: Quote from: ajb on April 11, 2017, 05:06:49 pmIt is terrible just see what a memory/CPU hog Slack desktop app that uses it is.You can also look at Lazarus if you are more in Deliphi/Pascal watters

author: ^_^
author_rank: Regular Contributor
timestamp: April 11, 2017, 09:31:32 pm
content: I remember I had to write PC-side UART receiver once, that would work at 3.5 Mbps. I have chosen Visual Studio C# for that and it's serialport control.It worked and it would even display the data in chart control in real time as well as log the data into a file. The app was multi-threaded and the chart thread as well as receiver thread would sit at 100% core load (which was 50% overall at 4-core PC I was using).The point is, if you need something simple, then high-abstract stuff like you mentioned (Python, Java) is probably the way to go.But... if you need performance, then C# or C++ are still irreplaceable.IMHO.

author: Buriedcode
author_rank: Super Contributor
timestamp: April 11, 2017, 09:47:34 pm
content: So it seems that many still use .NET and create stand alone applications. I'm surprised, and kind of relieved as I thought I was completely behind. Also surprised that people still use the serial port, although not that much as the few 'industry' people I know regularly do serial port stuff.I guess I asked because I was looking to finally get to grips with Java, python, and possibly other languages and as I'm very much an electronics guy - looking for example projects where people had created PC-side apps as part of it. Also.. does anyone use processing? I've used it a couple of times to visualize the waveform for an optical pulse sensor but never in earnest.

author: tggzzz
author_rank: Super Contributor
timestamp: April 11, 2017, 10:05:22 pm
content: Usually the language is the least important consideration.Far more important are the libraries for GUI and/or processing, libraries for comms, compatibility with deployment considerations, and familiarity with the development environment.Having said that, some languages enable you to concentrate more on solving your problem, other make you concentrate too much on solving the language and implementation problems.

author: ebclr
author_rank: Super Contributor
timestamp: April 11, 2017, 10:12:17 pm
content: Radstudio is a very power optionPro's cross-platform , easy to use, lot of legacyCons'sPrice

author: lem_ix
author_rank: Regular Contributor
timestamp: April 11, 2017, 10:23:17 pm
content: Python, bloody simpleFrom not knowing it to poorly plotting data from a wireless sensor network took 2-3 days.

author: danmcb
author_rank: Regular Contributor
timestamp: April 12, 2017, 01:03:29 am
content: depends what. For a GUI app, c#/.NET. But I rarely do this. For messing with text files - perl. These days - python tends to crop up.

author: digsys
author_rank: Unknown
timestamp: April 12, 2017, 01:46:41 am
content: +1 for VB6 /.NET

author: Scrts
author_rank: Frequent Contributor
timestamp: November 22, 2017, 04:03:23 am
content: Hello,I want to bring this up just to check if there are any new opinions? I've never done any PC communication rather then LwIP with a web server, so now I struggle to find good examples for communications over USB. I just want some GUI with a button or a slider as well as indicator or something hooked up to STM32 over USB. Whether it's HID, VCP or whatever... Are there any good examples about this? Visual Studio C# or some Qt? Python maybe?There was Borland C++ builder in the old days, but now I'd prefer something available for free.

author: danadak
author_rank: Super Contributor
timestamp: November 22, 2017, 01:18:51 pm
content: You can try PSOC 5LP family, tool is free, Creator. has a number of USBexamples, host, client, boot, ADC.....Cypress also does a number of standcontrollers, with additional tools for design.Also a number of videos for training.http://www.cypress.com/site/search?keyword=usb#gsc.q=usb&gsc.tab=0&gsc.ref=more%3Avideos&gsc.sort=A tool example attached. You GUI drag and drop components onto schematic.Each component typically has 10's of prewritten APIs where you just make f()calls to implement coding. The analog and digital shown is onchip.Low end dev board ($ 10)http://www.cypress.com/documentation/development-kitsboards/cy8ckit-059-psoc-5lp-prototyping-kit-onboard-programmer-andRegards, Dana.

author: TomS_
author_rank: Frequent Contributor
timestamp: November 22, 2017, 01:48:59 pm
content: Quote from: sanwal209 on April 11, 2017, 06:58:09 pmIm working on a project where I am using serial to communicate with a PIC.I used the pyserial library and it wasverystraight forward.Unless you were trying to do something much more low level, which pyserial hides (kind of the point).

author: abraxa
author_rank: Frequent Contributor
timestamp: November 22, 2017, 01:54:17 pm
content: I would just like to point out that with Qt Creator / Qt Designer, there are RAD solutions available for Qt as well. There's no need to create the UI elements by hand, which of course is rather time consuming.

author: capt bullshot
author_rank: Super Contributor
timestamp: November 22, 2017, 02:02:35 pm
content: Just the same toolset I use for embedded development:Linux (or cygwin at work where I must use a windows machine), gcc, make, version control, editor of your choice.My favourite language is still plain C, my PC-side applications usually are console I/O to the user side, and CAN, serial or TCP/IP to the embedded device side.I stay away from USB since either the cables are too short or it just works unreliable or you're in driver hell.No GUI, command line parameters rockIf I need some graphing output, I write the data to a suitable file and place a bit of scripting around gnuplotAnother way is to feed the data into an RRD (round robin database) and use its PNG output inside a simple html page with a bit of php scripting.

author: asmi
author_rank: Super Contributor
timestamp: November 22, 2017, 02:25:23 pm
content: I use mostly .NET/C# (since I use it professionally at work so it's a no-brainer), unless I need to use some kind of vendor-supplied library, in this case it's usually C/C++. Case in point - FTDI's D2XX and D3XX API libraries that work with their ICs over USB.

author: Karel
author_rank: Super Contributor
timestamp: November 22, 2017, 02:28:33 pm
content: We write pc-side applications in Qt.Reasons: it runs virtually on every platform, it's fast, object oriented, very good documentation, active community and forum,comes for free but payed support is also available and there are already a lot of widgets available to start quickly.

author: Buriedcode
author_rank: Super Contributor
timestamp: November 22, 2017, 03:05:23 pm
content: Good to see people updating the thread!I've just downloaded Qt, and will write a few test apps. I've been meaning to make some bluetooth apps for my phone and tablet anyway, so this - along with using Xamarin - will be a good intro to it all.Although I'm more of a nuts 'n'bolts guy, swanky looking graphs and controls are always appealing - I used to code them from scratch many years ago, and they rarely looked good.Cheers!

author: Karel
author_rank: Super Contributor
timestamp: November 22, 2017, 03:33:18 pm
content: Some Qt libraries with interesting widgets (free for opensource only, needs a commercial license for closed source software):http://qwt.sourceforge.net/http://www.qcustomplot.com/As an example, this application is written in Qt as well:https://www.teuniz.net/DSRemote/oscilloscope_decode.png

author: rstofer
author_rank: Super Contributor
timestamp: November 22, 2017, 07:33:37 pm
content: If I need a 'forms' interface, it will most likely be done in VB - I'm lazy.OTOH, when I wanted to add physical buttons, knobs and dials to Microsoft Flight Simulator, I made the gadgets report as a HID interface and used C to tie the values into the simulator.The HID interface is pretty easy to work with but if I'm in a hurry, I'll use VCOM. Any of the Microsoft languages can deal with a serial port. In fact, I wrote a little shim code to support a serial port under GNU Fortran. I don't recall why... Maybe just because I could and I still use Fortran for numerical kinds of things.Matlab is another possibility. There's an Arduino toolkit that links Simulink with hardware. Matlab can provide a very interesting dashboard for external gadgets.As to environment, there are 3 general cases. First, the environment provided by the device manufacturer. Second, Microsoft Visual Studio and finally, Eclipse. It may also turn out that the manufacturers are using Eclipse as the IDE with modifications. All this for Windows... For Linux, it will be Eclipse or gedit and makefiles. I haven't done a lot of GUI stuff under Linux.I have played with Qt and Tkinter using Python.

author: Scrts
author_rank: Frequent Contributor
timestamp: November 22, 2017, 07:51:12 pm
content: Ok, I don't see anyone using LabView CVI?As for the middleware level - libusb doesn't seem to be popular as well?For Qt people - do you have a good website for examples with embedded platforms? I've never touched Qt, so a simple example would be a good place to start.

author: Karel
author_rank: Super Contributor
timestamp: November 22, 2017, 07:56:35 pm
content: Qt comes with lots of examples:http://doc.qt.io/qt-5/examples-widgets.htmlhttp://doc.qt.io/qt-5/qtwidgets-widgets-calculator-example.html

author: rstofer
author_rank: Super Contributor
timestamp: November 22, 2017, 09:42:40 pm
content: Quote from: Scrts on November 22, 2017, 07:51:12 pmThat's going to depend on what you mean by embedded. Most projects are going to use Qt->X11->Linux. Sure, that can be an embedded SOC like the Raspberry PI but it isn't embedded like Arduino (just to pick a tiny platform).There are lots of Qt/Python examples and books have been written on the subject.