We’re trying to get a real-time graph of the PID system we’re working on. Currently, we’re using Hyperterminal to log the data sent back over the program port, and then importing it into Excel for graphical goodness.

I’m open to any suggestions on how to make this real-time. I was looking into LabView and getting horribly confused; anyone have any good tutorials on this?

All I really need is something like the UNIX read/write functions; from there, I can hack up a graph in SDL or something. So I’d be perfectly happy with a C serial port interface tutorial.

Any other teams doing this?


I’m not quite certain what you’re looking for - are you looking for help on writing serial I/O programs on Windows, or UNIX?

I recently wrote a decent, very simple serial API wrapper that compiles and runs on both. The code should be simple enough to read (it is extremely similar to the POSIX read/write functions) that you can learn the TTY API for both OSes quickly and modify it to suit your needs.

Attached are the files, it should compile just fine with default options to MSVC or gcc. If that wasn’t what you need or if you have any questions, feel free to PM me :slight_smile:

serialio.c (6.04 KB)
serialio.h (1.38 KB)

serialio.c (6.04 KB)
serialio.h (1.38 KB)

probably the best way to do this would be with LabVIEW…
if you look at some VISA examples for LabVIEW online im sure you could get a working serial communication working just fine. from there it is just parsing the output string.

If you want to do it wirelessly though… well good luck. the only thing i can think of is to send the OI a user byte, but that wouldn’t be real-time-y enough for this application

If you’re looking to plot the data from the serial port in real time so you can quickly adjust your PID gains, I use DataMaster2003.

You have to write a small program in VBScript to interpret the data coming from the serial port and set up the plot but it’s pretty easy.

I’m really just looking for any way to visualize this in real-time. Shinigami2057, that C interface is pretty nice; I’ll probably end up just using that and SDL.

TimCraig, I’ll have to give DataMaster a shot, though. After all, it IS free. :slight_smile:

I figured LabVIEW was the logical choice, but I’m dumb and couldn’t figure it out or find any good tutorials. Thanks for the pointer, though.

Use the Dashboard port.

Look up the Dashboard spec at IFI, and put whatever variables you need in the packet. Then just link up with any serial-enabled program (like Sean Witte’s .NET based Dashboard viewer) and you have the data at your disposal. You can then put it into a spreadsheet, graph it in realtime, etc.

If you haven’t made something for this yet yourself, I’ve almost finished a java program that graphs information sent over the dashboard port (I was planning on using it for tuning PID). If you’re interested send me a PM and I’ll be able to upload it tomorrow.

Knoppix or Cygwin? In all seriousness, you could take advantage of the UNIX read/write functions using knoppix to boot your machine into linux, or cygwin to emulate UNIX. From your post, it sounds like you are looking for a way to use UNIX read and write functions in windows, and both of those options should work. I am not 100% sure about Cygwin, but it “Should Work”.

The dashboard port is great if you need high-level debugging (eg, is your arm at the end of its travel). By the sound of it, some kinda of serial stream from the RC is the best way for you to go.

As for the PC side, it depends on how you want to use it. I’ve never used Labview, but for just real-time graphs, it may not be necessary. I’d be willing to bet that there is OSS that can take a stream. (Under unix, you can probably do some FIFO/piping magic so that you can point software to it and the software will read it like an endless file. :rolleyes: )

I’ve never had a serious need for this, so I’ve haven’t done the research. I do know, though, that SourceForge has a project for practically everything. Do some digging on there.