I'm hoping this is the right place to get some expert advice on putting an app together.

I have a Beaglebone Black (BBB, a credit card sized Linux platform) that collects bursts of sensor data. Even though I'm relatively new to Linux, I'm pretty comfortable with the data collection end of the application. But I want to give people nearby access to the data displayed as a line chart along with some additional calculations.

My current thinking is that I'll run a server on the BBB that users can browse to using a PC, tablet, or smart phone, that provides the display. This is where my experience comes up short and I need your help. What is the best way to get the graphs and other data to possibly 6-8 users while minimizing resource usage in the BBB?

Should I use Google's Chart Gallery, Bootstrap, or ??? I look forward to learning some new (to me) technology, but I need to get a working prototype together pretty quickly and don't want to wade through a month of mistakes. Can anyone weigh in on what options I have and what the tradeoffs are?

I've had tremendous success using a bit of a cheat - I have a Python script that fires and generates HTML pages that are served on a Raspberry Pi (very similar to your setup) that includes JSON data required to draw charts with http://www.chartjs.org/ - This job fires every few minutes, and I have an auto-refresh directive on the pages, so they reload automatically with the new data every minute, creating quite a neat, ever-updating effect.

All I do is I overwrite the HTML file(s) in the standard Apache web-server, providing me with a simple and effective way of sharing information with users.

@Ewald - I'm pretty shallow on Python, javascript, and have only a little experience with Apache running on a RPi, but what you describe sounds like a nearly perfect fit. Charts.org is a gem that I hadn't seen before.

Thanks for pointing me in a good direction. Is there any chance you could share the Python script or at least some snippets to get me started?


@Ray - Sure thing, what I have is a cron job that just runs a simple Python script (foundation source at http://www.decalage.info/fr/python/html) - the tricky part is of course reading the sensor data.

What format do you output this data, in CSV perhaps? I am happy to modify my code and put it here, I just need to remove a few bits that the company won't want shared.

@Ewald - the sensor is an accelerometer connected using SPI. I'm waiting on it to arrive, but it is capable of generating an interrupt and automatically starting data collection when motion occurs. So I may be able to collect the block of data from a Python script and write it to a RAM-based file. Then I would overwrite the HTML file with new data as you describe. Is there a way to code the HTML file to point to a separate data file so that I don't rewrite the entire file?

Thanks again!

Ah, that is interesting. In that case, you might not need to go the Python route. Basically, any programming language that you are familiar with will do the job, as long as it can output text to a file.

Am I correct in understanding that it supports Node JS? If that is so, then you can actually write a Node JS server that will read the data from a RAM-based file and output the required HTML. In fact, this is probably an even simpler solution.

Ewald - this is a training excercise for me, so I'll probably do multiple versions. I could certainly do a C++ data collection, but first I have to learn how to set up the I/O on BBB using the device tree, then set up a good Linux/BBB development environment. But there's already a Python library for DIO and SPI, and I want to learn Python anyway so I thought I might start there. I suspect the performance will not be enough though, and I'll then move to the C++ version.

On the web interface side, the BBB does support node.js, and that is the complete sum of what I know about java. So any guidance you can provide for the Python/Apache senario or the node.js senario would be wonderful.


Ah, make no mistake - Python is often more than fast enough, in fact, I've done a bit of system monitoring, and even realtime payment transaction programming in it, and I was surprised at how easy it was to code, and how efficient the code performed.

Well, given that there's already a Python library, I think it's a cool idea to get to know Python a bit. Do yourself a favour, and visit http://www.codecademy.com/ - they have a great little tutorial on getting started in Python. The exercises there will give you a good feel for the language.

I asked around, and the general concensus is that you should serve the HTML directly from Python, avoiding any other overheads that you do not need. There are tonnes of simple Python-based web server code examples, but that's for later, after you've collected information and managed to, for example, output it to the console.

I'd be happy to help, I'm by no means a Python expert, but I have some time over weekends to tinker and this sounds like an interesting project.

By the way, Java and JavaScript are two completely seperate beasts, the semi-similar name is a point of tremendous confusion.

Ewald - my hardware should be here next week and I will practice Python in the meantime (as time permits). Thanks for your insight; I may post again when I have the data collection side working.

One additional Python question: can Python provide multiple 'threads', so that I could service multiple clients and collect data concurrently?


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.