0
\$\begingroup\$

Currently, I am using Server Side Includes to transfer data from my microcontroller to my webpage. The issue with this approach is that if I want to graph the data I have to store the SSI value in a javascript variable, which gets messy (currently I am continuously refreshing a hidden iframe on the page that has an element whose value attribute is being modified with new data from the microcontroller, then my javascript variable reads that elements value to update a graph). Is there a better way to send/receive data?

Thanks!

\$\endgroup\$
  • \$\begingroup\$ It sounds like you might want to take a look at Ajax and JSON. The JSON format is pretty simple and shouldn't be too hard to do from a microcontroller when you're already serving pages. \$\endgroup\$ – PeterJ Jan 20 '15 at 0:57
  • \$\begingroup\$ I used AJAX at first but it would not work for me. When using Chromes Javascript console I could see the SSI tags getting updated but the javascript variable would only get the first update. \$\endgroup\$ – PacEE Jan 20 '15 at 1:44
1
\$\begingroup\$

Yes, use an internet of things (IoT) service.

e.g.

  • Xively
  • ThingSpeak
  • DeviceHub
  • Nimbits
  • Carriots
  • Zetta
  • and on and on...

Typically your device sends the data to the IoT server using whatever protocol they support. Then your webpage can request the data and generate graphs or tables. Most of the sites have built in graphs that you can simply embed in your page.

If you want to roll your own, this is what I have done:

  • Server with mysql database
  • PHP page that parses device data from GET requests (e.g. http://myserver.com/process.php?device_id=12345&data1=turtle&data2=34 and stores them in the database
  • Another page that queries the database and generates graphs
\$\endgroup\$
0
\$\begingroup\$

If your microcontroller needs to receive data in JSON you can use tiny-json. It's an open source C library.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.