Saturday, June 11, 2016

Live data plot with Arduino + Python

      This post is about my interpretation about live data plot using  Arduino and python. I say it is my interpretation because it already been post by a few people some scripts about that. I like very much the one posted by Mr. Paul McWhorter, its simple and very well explained.

http://www.toptechboy.com/tutorial/python-with-arduino-lesson-11-plotting-and-graphing-live-data-from-arduino-with-matplotlib/

     But the problem begins when you need high baudrates. Mr. McWhorter application is reading a temperature sensor relatively slowly. My application was a Gyroscope + Accelerometer MEMS sensor (MPU6050 by Invensense), and I needed faster rates. I don't know why, at least with my setup, Python 2.7, Ubuntu, Arduino Uno Clone and MPU6050, when the communication between computer and the microcontroller begins, Arduino sends some gibberish just in the very beggining, but it is enough to ruin the communication. My way around this problems goes in the script below.



     Here is the print screen of the script running, it's very cool to see real time data being plot.


     One final information: in the arduino side I used a Script by Jeff Rowberg, which can be found in https://github.com/jrowberg/i2cdevlib. 

Thanks for reading

Eddie

No comments:

Post a Comment