Giter Club home page Giter Club logo

python_c_serialcomparison's Introduction

Python_C_SerialComparison

This project is to perform a comparison between a custom C driver for serial communication and PySerial Python's library.

Description

I used an Arduino UNO with a simple program to test diverse forms of comunications that could happen in real life.

Used 115200 bauds for tests.

Tests made:

  • orderAndAck(): sends order and receives one byte
  • dataRequest(): sends order and receives 2 data bytes and an ending byte. The idea would be to set the desired number of byte return and processing that could happen in our project.
  • nResponses(n): we send order and receive n data bytes and one ending byte.

Instructions

  • First upload to Arduino with Arduino IDE the program in arduinoSerial/arduinoSerial.ino
  • You may want to check the desired Arduino port (current /dev/ttyACM0)
  • Then execute testSerial.py with Python3
  • Compile and execute driverSerial.c
  • Then show graphs with showResults.py

Results

The results scores of multiple executions is measure with the average time. One execution may not be fair but multiple executions could have noisy steps but we are interested in this because that would be the closest to a normal run.

Other way of measure is taking the best score of multiple executions to take the best case (other processes in OS could affect) but I thought it is not useful to a real scenario (but could be done for curiosity).

1Executions 10Executions 100Executions

Conclusions

  • PySerial is great because you can make the program fast without much trouble.
  • C takes more developing time and a learning curve of Linux API to make the driver.
  • If you have to process data one after the other the time in PySerial rises a lot compared with our C program.
  • For time critical aplications we need to use C.

python_c_serialcomparison's People

Contributors

manucorrea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.