I have some experience with Arduino but never used Raspberry Pi.
I'm looking for the best way to show my sensors data via RPi. What I would want to do is:
Arduino to read sensor data and send it to RPi via serial.
RPi to get the data, process, and show it in a TV/Monitor.
I have some idea of all the steps but the last, and I wonder how would be the best way to show the data in the RPi?
I mean, I know I can show it in the console, but I would want to do some basic interface. Colors, font sizes, but not many more.
Which could be the best way to make this?
I'm thinking in a Python program to read the Arduino/Serial data, and show it, but I don't know which library could I use.
The languages I have some experience with are Python, C#, and maybe Javascript.
Would be some of this a good choice?
-
1Any of those are a good choice. The best method is to install a webserver, like nginx, create html files, or install the php CGI server, and use PHP to execute commands and send them to the browser usign AJAX. I think Python has a webserver too where you can do similar things. Essentially, you need to learn more about creating webpages, jQuery and jQuery plugins and AJAX.Piotr Kula– Piotr Kula2014年03月21日 20:57:14 +00:00Commented Mar 21, 2014 at 20:57
-
Consider Tkinter for the screen drawing part.Hello World– Hello World2014年03月24日 12:56:24 +00:00Commented Mar 24, 2014 at 12:56
2 Answers 2
It depends on how you want that output on the screen.
In the terminal / console / CLI: try NCurses (for python module_curses) or Bash colors (also available inside Python)
In the X / windows environment / GUI: try GTK (with PyGTK)
In a browser using PHP: try the PHP GD functions (for example imagefillarc()) inside Apache
In a browser using Python: try PyChart, PIL or GD module (same engine as php) through Apache or a Python simple HTTP server
If I had to make this I probably go with a browser option, so I can view it from any device available (including the one hosting it all)
You should use PySerial to communicate with your sensor.
You can save the data with a timestamp in a csv file, every second or whatever speed you want.
From inside the python program call GNUplot to generate a png file of the data every 10 seconds and then use a picture viewer, eog, to show the png file on the screen.
You should put the csv file in /dev/shm, which is essentially a ramdisk, for fast access and no sdcard wearout.
If you installed a webserver, you can put a link in index.html to the plotted png and voila, you can access it from anywhere.
The plots of GNUplot are good and only a few kb what result in a very fast webpage.