Go Down

Topic: Building PC Software to interface with device (Read 1 time) previous topic - next topic

jtw11

Jul 11, 2013, 06:00 pm Last Edit: Jul 11, 2013, 06:20 pm by jtw11 Reason: 1
Hi all,

I guess this would be the best place to write this post - I want to start writing a piece of software to interface with a device I built, using an AVR MCU. I've got for example a lot of chips on the board that can be configured over SPI, amongst other things, and I'd like to be able to change some of these options without reloading bits of source code.

Currently the device is using the Arduino software, but soon i'll be rewriting software without the Arduino libraries, and using Atmel Studio...

I want to write a piece of PC based software, that allows me to connect to the device over USB (and possibly Ethernet on a planned new version of the device) and change a load of parameters stored in RAM, or to tell it to use a different bunch of parameters stored in flash.

I'm not looking to write a fancy piece of software, just a black screen with a list of configuration types that one can navigate using the keyboard, expand a change a few options - I would also like to be able to change the data stored in arrays in real time, i.e. a change made on the PC is instantly rectified on the microcontroller.

So a menu such as the following.

HARDWARE SETUP ->
COMMUNICATION SETUP ->
SOFTWARE SETUP ->

However, the only software I've ever written is embedded software for MCUs using the Arduino environment.

Where do I start in making software for a PC in this way, like I say - I'm not interested in pretty graphics, perhaps some black and white wireframe maps of 2D array data and that's it.

I'll give a better example - one feature of the boards is its ability to sense current draw from it's outputs, and shut those outputs down should current levels rise above a defined value, however - I'd like to be able to adjust these values, by plugging my board into a PC, and quickly changing a value in software, as opposed to reloading an updated source code to the file.

I.e. in a menu, change OUTPUT 1 CURRENT LIMIT, from say 2A to 4A.

Where do I start with this?

Ultimately, I would like in the future to build a touch version for iPad too - but let's focus on PC first...

Many thanks in advance

fungus

Parameters should go in EEPROM. Writing to flash is difficult and RAM is lost if the device resets.

On the PC end...first you have to choose a programming language/environment. Some would say do it via a web browser, some would write a standalone app, some would do it on their 'phone via. bluetooth. There's lots of ways to do it and the best choice depends on what sort of programming you're good at. Really it's up to you to decide how to do it.

The "USB" on an Arduino appears as a serial port. You open a serial port on the PC and send bytes to it. On the Arduino you look at incoming data on the serial port and decide what to do with it.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

jtw11

Hi there,

Thanks for your reply.

Writing to RAM isn't a problem in this application, as those parameters that would be adjusted in real time (i.e. during device calibration) once they are set to a satisfactory value, the device would be reset - and the calibration saved permanently into the device and permanently as a calibration file on the PC.

I would rather use flash space, as opposed to EEPROM - in fact, I'm not interested in using EEPROM at all. Writing to flash may be difficult, but that's what I'd like to do. If it makes it any easier, the board I've designed uses an SD card - so data can be stored into certain locations on that card.

Bluetooth and other wireless methods won't be any good in this application, a wired USB / Ethernet connection is what I am using. My first board version dosen't have any Ethernet support, just USB using an FTDI chip to convert between serial and USB.

I would like to develop a standalone piece of software, not do it inside a web browser...and as mentioned above, would need to be able to save and load calibration files to load to boards.

The environment is the advice I'm really looking for here, how to get started if you see :)

fungus


I would rather use flash space, as opposed to EEPROM - in fact, I'm not interested in using EEPROM at all.


Why not? That's what it's for...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

stephenholm

First thing I would do is get it working with "Serial Monitor" in the Arduino IDE.  That is, get the messaging working between it and your device.  You can pass text into your program by typing in the top box and hitting send.  Your program can respond back out.

Once it is behaving the way you want it to, you then move onto the desktop software.  At this point there is no change needed by your device, just have your desktop software connect to the com port and behave the same way you did with Serial Monitor. 

If you are on Windows I would suggest something like VB.net.  You can download a free version of Visual Studio Express which will allow you to do all you need.  You can design your page in a WYSIWYG editor, and there is good support for COM in .net.

Best of luck.

Steve

Go Up