EDVler-Blog.de: IT in der Praxis

Arduino simple Chart – Setup Howto (english)

Installation Guide

Here is an overview of all components needed.


Überblick über die zusammenhänge der einzelnen Scripte

Überblick über die zusammenhänge der einzelnen Scripte



Depending on how familiar you with the setup of a webserver, php and mysql it’s maybe better to choose a complete „appliance“. I recommend xampp. I used this to program Arduino Chart. Go to http://www.apachefriends.org/de/xampp.html and download the latest appliance. Extract it and you would be ready to set up the database and tasks. You don’t have to configure anything which belongs to the webserver and php.

If you don’t like an appliance you are free to use your own setup.

What componets are needed?

  • Webserver with php enabled. If you have one you could use this. If you don’t have you maybe want to use xampp or another „appliance“.
  • MySQL Server. If you have one you could use the existing one. The xampp appliance for example contains mysql.
  • Download the Highstock Version from http://www.highcharts.com/download
  • Download the latest GitHub Repository from Arduino simple Chart at https://github.com/edvler/Arduino_simple_chart/archive/master.zip


Where to install anything?

If you use xampp you could install it under c:\xampp\ (my suggestion)!

  • Extract the Arduino simple Chart zip. In the Zip file you will find a folder PUT_ON_YOUR_WEBSERVER.
  • Copy the folder arduino_chart to your document root folder of your webserver. On Linux it maybe /var/www. On Windows and xampp use c:\xampp\htdocs (if you followed my suggestion how to install xampp). Put the folder arduino_chart under the folder c:\xampp\htdocs.
  • Extract the HighStock zip File. In this Zip file you will find a folder called js.
  • Copy the folder js to your arudino_chart webfolder under js. Put the folder js under c:\xampp\htdocs\arduino_chart\.
  • All the other folders in the zip file not relay needed. This are examples an so on.

Now startup your webserver and your MySql database, if not already running.


Configuration  / Setup:

DB Setup Step 1:
Create a MySQL User. The easiest way to do this is with phpmyadmin.
If you using xampp open your browser and type
On Linux or other webserver installations the URL is often the same.

For the first setup it’s necessary to give the user full right’s on the MySQL Server.
In the next step the database schema would be setup.

DB Setup Step 2:
Open the Script db_config.php (located under <path_to_your_webroot>\arduino_chart\database)

1. Create a user in your MySQL which can create a schema (maybe you use phpmyadmin or MySQL Workbench)
2. Setup the connection parameters in the db_config.php script
3. Change the $setup variable to true!
4. Call this script in your browser (eg. If the script finished you will see how many SQL commands was executed and how many executed successfully. Only go ahead if all statements completed successfully.
5. Change the $setup back to false!

FINISHED DB Setup. Now proceed with uploading the Scetch to your Arduino.


Setup Arduino to get JSON over HTML:

Now you need the Arduino IDE (Install how to: http://www.edvler-blog.de/arduino-software-installieren/) . Please open the example Scetch WEBSERVER_JSON_SAMPLE included in the directory Arduino_code from the GitHub Repository.

Change your MAC, IP-Address and your Subnet to your needs. The network parameters are placed at the beginning of the code.

The most interesting section in the source code is the generation of the JSON String. You will find the source code below line 100.
Please look at the comments. There you will find an example how to get your values into the JSON format.

Upload the Scetch to your Arduino. Test it by opening the Arduino IP in your Browser.
Copy the JSON String to the website http://json.parser.online.fr to check if the JSON string is valid (see right side of the website).

Don’t proceed if the validation fails!


Setup tasks to collect data from your Arduinos:

To collect values from your Arduino devices you need to create a scheduled task. In Windows you could create a task with the taskplaner. In linux you could use crontab.
From the taskplaner or crontab call the script json_from_arduino.php located under your webroot/arduino_chart/call_from_taskplaner/ with the two parameters id and url.

Example Call (assumed u using xampp installed in c:\xampp\):

c:\xampp\htdocs\arduino_chart\call_from_taskplaner\json_from_arduino.php id=1 url=“http://ARDUINO_IP“

For the id you need to choose unique number to identify this Arduino in the database
The url parameter has to be a Webpage, which returns a pure JSON string.


Abstract (average your data) to get more performance on chart loading

As longer as you collect data from your Arduino’s as more datasets you will get. Maybe you log vales every Minute or shorter. This produces a lot of datasets. To get a good performance while working with the chart the values abstracted in more tables.
Each table holds averaged datasets for a specific time range. Tables existing are DataStore_hour, DataStore_day and DataStore_week

If you choose a time range of more days the used tables would be DataStore_day which holds less datasets as the original DataStore.
If you choose a time range of 3 month the used table would be DataStore_week and so on…

To abstract your data use the abstract_DataStore.php located in the webroot/arduino_chart/call_from_taskplaner folder with the taskplaner (windows) or crontab (linux).
I prefer to call this Script every 30 minutes.


Chart Setup

The last step is to set up the chart config. Open the chart_config.js in your webroot folder.

There you can configure some parameters.

  • Please place the url of your db_access.php. Replace the IP with the IP of your webserver!
  • The other parameters set the title and subtitle as well the loading message.



Open the browser and type the URL of your Arduino simple chart installation. If you installed the webserver on localhost the URL is

You will see a welcome Page with some example charts. Click on one of the pictures to choose the chart type. Each chart type could be used. You could use it even all parallel.


If you have any question  or problems contact me via the blog article „Arduino simple chart“. www.edvler-blog.de/arduino-simple-charts-diagramm-visualisierung-messwerte

You can follow any responses to this entry through the RSS 2.0 feed.

Wir verwenden Cookies! Durch die weitere Nutzung der Seite stimmst du der Verwendung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen" eingestellt, um das beste Surferlebnis zu ermöglichen. Wenn du diese Website ohne Änderung der Cookie-Einstellungen verwendest oder auf "Akzeptieren" klickst, erklärst du sich damit einverstanden.