Data acquisition with 2 serial ports

Started by bsrdjan, November 30, 2012, 09:44:56 PM

Previous topic - Next topic

bsrdjan

Hello,

I consider using A13 for data acquisition application, collecting data from 2 serial ports and hourly forwarding via HTTP(S), over LAN/WLAN. The data volume is low, ca. 10 readings per hour.

Would it be possible to use Python on A13 for that purpose or are there better alternatives?

Thanks,
srdjan

David Goadby

I am working on a similar type of application. In my case I have up to twelve analogue/digital inputs and eight outputs to manage. Instead of the serial port I am using I2C, but serial could have been used quite easily. Python has a serial module that you can use.

I am quite comfortably sampling all twelve inputs every 2 seconds, processing the data and writing a data file which is then processed using a second Python application.

Your network requirements are almost trivial in Python with all bases covered - you can even have your own web server. In my case the processed date is uploaded to a MySQL server every minute, also using a Python application.

An alternative I could have used is C; but Python has such a rich and complete armoury of reliable tools that I only use C if I need much faster processing and even then I revert to Python for non-critical stuff.

I am guessing that the serial data is not fetched and can arrive at any time. If that is the case then you need to use a non-blocking serial port reader which will keep checking the two receive buffers for data and process the data once complete data packet has been received.

Eric is quite a good IDE which will save some time. I would also recommend developing and testing the code on a PC initially to save time. Python is multi platform so, apart from a few subtle code changes, you can prove the code on a PC and then carry out final testing on the A13.

The bottom line is that I am confident that Python is more than adequate for your needs.

A final tip: If your timing is critical, or you need time-stamped records, then install the ntp server and your system clock will be initialised at power-up. I am working of a battery backup mod for the RTC chip in case network time is not available. I have suggested that Olimex implement this at the next board revision.

Have fun!

bsrdjan

Hi David,

I am in a doubtt whether to use iMX233 with 64 MB RAM, on which I tested already Archlinux and Python, but has LAN only. In case WLAN needed with iMX233 what to do?

Or to go for A13, with more RAM and WiFi, but which Linux? Arch ? In case LAN is needed with A13, what would be the best option?

Many thanks,
srdjan

lordlothar

I don't think there is a problem with imx233 + wifi. Even if you don't have the mini edition with the built-in wifi module, you can attach one with usb interface, which is fairly cheap.

If you decide to go with A13, olimex provides pre-built debian image and you can use this for lan capability.

David Goadby

Unless your budget prevents it, then go for the A13 as more ram is always nice to have ;-)

I use an Olimex recommended USB/LAN dongle and it has never been a problem. The only extra thing I do is use a 100mm USB extension cable to prevent excessive mechanical strain on the PCB.

The stock Olimex Debian Wheezy is quite solid now and I would recommend it.