Best way to publish Arduino sensor data on a web page?

I want to read sensor information from Arduino Uno . I already have a Java program that connects to the serial port and reads information from Arduino.

I want to publish this information on a web page (the Apache web server is currently running on my computer). I'm not so good at web development, but I can get by.

My plan is to save the sensor data that I read from Arduino to a file. I would update this file every 1 minute. Then, using some server-side scripting language (i.e. PHP), read the data from the file and create a web page that displays sensor information when the page is requested.

However, this approach does not seem very "elegant". Is there a better way to accomplish this task?

(Also, I'm using Arduino Uno with a USB port, I don't have an Ethernet shield .)

+5
source share
5 answers

I guess this really depends on how reliable the web page should be and how centralized you want your application to be.

If you are just looking for simple raw data, you can create a simple web server in your Java application to serve the contents of the file. This will centralize everything in one application. (Instead of apache + php + java)

, , - http://localhost/getData , . (, , - . Arduino , .)

, , , HTML. HTML- ( ), , .

+2

, Ethernet, - .

, json xml. , jQuery exmple.

, ajax . backbone.js jQuery.

- / -. - . -

Ethernet WiFi. Arduino , .

+2

- SensorMonkey... - arduino , Shimmer xBee. , facebook. , -...

+2

SensorMonkey.com, API -.

+1

To add, if you do not expect to receive many hits in a short period of time, dynamically generating the page, initiated when a request arrives (as described), works great. If you expect to receive many hits per minute (the indicated refresh rate for the data), you want to generate a page once a minute when updating the data, and then serve it for each requester, rather than regenerating the page every time there is a request.

0
source

All Articles