#62 Periodic serial port acquisition

v1.0 (example)


I did not find any forum to discuss this great module, so let's try here.
I am using this module to monitor my electricity production and consumption.
I capture data coming from my meter every 10 minutes.
What is the best practice:
- open, read then close every 10 minutes ?
- open at the beginning of my daemon then simply read and let the port open ?

For the moment, I put my code in a scheduler task that open, read then close.

Thanks for your advices and congratulation for this module!



  • Chris Liechti

    Chris Liechti - 2014-07-31
    • status: open --> pending
    • assigned_to: Chris Liechti
  • Chris Liechti

    Chris Liechti - 2014-07-31

    that's tricky. there are drivers on some OS that may get into trouble after a number of open/close operations while others may work better by opening and closing the port...

    generally, leaving the port open should work well. In case you want to handle cases where the serial port may fail (e.g. USB-serial adapters that get un- and re-plugged), reopening the port after an SerialException may be a good solution.

    Apart from the port handling itself you may need to make the same considerations also for the application layer. Do you need to initialize the device? is such an initialization needed every time the port open/closes or also after a timeout? maybe it's only needed after a power outage?

  • Chris Liechti

    Chris Liechti - 2015-08-05
    • Status: pending --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks