element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
RIoTboard
  • Products
  • Dev Tools
  • Single-Board Computers
  • RIoTboard
  • More
  • Cancel
RIoTboard
Documents RIoT Board Web Server Demo
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RIoTboard to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: Former Member
  • Date Created: 10 Dec 2014 3:16 PM Date Created
  • Last Updated Last Updated: 8 Oct 2021 8:04 AM
  • Views 493 views
  • Likes 1 like
  • Comments 0 comments
Related
Recommended

RIoT Board Web Server Demo

RIoTboard and Xtrinsic Sensor Webserver Temperature Logging Demo for IoT Application

 

This is a summary of both Tushar's RIoTboard webserver blog and my single webpage project that extends Tushar's webpage project. For more information and a detailed walk through of both projects please follow the links above.


Okay so the link to the SD card image of the finished project is at the bottom of the page, but before I just hand it over I am going to tell you roughly everything that has been done to get this demo working. This will be a very brief overview of both projects literally just highlighting the changes. I will not be going into any specific details.


 

Getting Started with RIoTboard:


Okay so the first thing we need to do is to get the Ubuntu image that element14 has provided onto the board.

We then need to install the packages needed for the web server and for the code for the Xtrinsic board

  1. apache2image
  2. mysql-server
  3. mysql-client
  4. php5
  5. php5-mysql
  6. libapache2-mod-php5
  7. php5-cli
  8. php5-gd
  9. libmysqlclient-dev



These can all be very easily installed using the "apt-get install " command as they are all in the package repository.


The webserver now runs and can be accessed by entering the boards I.P.  address in a web browser (i.p can be found by typing "ifconfig" into the terminal). But this is the default apache page, we need to change that.



Getting Started with Xtrinsic Sensor Board:


So to get the Xtrinsic sensor up and running there is quite a bit of C code which we then need to compile and run ("xtrinsic_temp.c" and "xtrinsic_mysql.c"). We used gcc compiler for everything.

We also need to set up the SQL server for our sensor data by adding a new database and table.

 

More C code ("current_temp.c") is then run to populate the SQL table with some data from the Xtrinsic sensor board.

 

This is the c code that needs to be run every time we boot the RIoT board in order to keep live data coming from the xtrinsic sensor board

The Xtrinsic sensor is now running.

 


Getting the Web Pages Running:


Now we need to get the basic web pages up and running, this includes 3 php pages to display "current temperature", "temperature graph", and "control the LED". This is just a matter of copying them into the "/var/www" folder.

 

Next we need to link them into one webpage.

 

image

To do this we are going to use an HTML page which has "iframes" showing the php pages in a table layout to make it a bit more attractive.

 

This HTML page will be called "index.html" so it is auto loaded by apache whenever someone accesses the server, and it will display all the php pages through "iframes".



Fine Tuning the Web Pages:


Now we are going to fine tune the web pages to give them a more professional look and to make them more user friendly.

 

To do this I have changed all of the php files ever so slightly, this gives them better control and integration into the HTML page.

 

I have removed all the text from the php files, got the led control file to load the appropriate bulb picture depending on whether the LED is on or off, got the current temp php file to display a °C sign, and got the graph to delete any data in the sql database that is older than 15 mins, this speeds load time and reduces excessive data.



Add Some Graphics:


Every web page needs some pictures and this is no different, we are going to add a RIoTboard logo and an element14 logo at the top of the page, and a background behind everything.


We are also going to add two LED pictures so the "led_blink.php" file can load the appropriate one; depending on if the led is ON or OFF.



Running Everything on Boot:


We now need to get everything to run automatically on boot so that we can run the server headless every time.

 

To do this we are going to write a script that will run the necessary C code ("current_temp.c") at boot up and set the permission of the www folder (to read and execute only, and the bulb images and the led control file to full access) so that they are set correctly and so we wont need to do anything.


The custom boot script is in the "/etc/init.d" folder, then it is made executable, then we tell linux to include the script in its boot process at the end using the command "sudo update-rc.d script_name.sh defaults 99".


If you are going to use the image below you will need to enable the start.sh script before you use it using the command:

sudo update-rc.d script_name.sh defaults 99


In the script we run the C code and set the permissions for all the images and the led control file to full access, and everything else in the "www" folder to read and execute access.



Reboot and you're off:


The header says it all really.

 

 

To download the complete SD card image click the button below, extract the image file, flash onto an SD card, and boot your board, you can download it HERE

image


You will need to enable the start.sh script before the web server will work. To do this use the command "sudo update-rc.d script_name.sh defaults 99". Then reboot the board.

 

The static I.P of RIoTboard for my image is 10.11.128.116 . Just type that into your web browser once you have your board up and running and connected to the internet and it should load the web server.

 

 

THE DOWNLOAD BELOW CONTAINS THE FILES USED FOR THE SERVER, THESE ARE NOT NEEDED IF YOU ARE USING THE IMAGE ABOVE AS THEY ARE ALREADY INCLUDED.

THE DOWNLOAD BELOW IS IN CASE YOU WANT TO LOOK AT THE FILES USED WITHOUT DOWNLOADING THE IMAGE AND FLASHING AN SD CARD.

Attachments:
0564.single_webpage_RIoT_server.zip
  • webserver
  • riot_board
  • web
  • riotboard
  • xtrinsic
  • riot
  • iot
  • server
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube