Goal
The intention is to have a simple web server, that can be continuously powered on, to publish a website about the house.
There are some legal requirements in Belgium to provide a so-called "PID", which is a folder with documentation about the construction of the house with e.g.:
- electrical schema and layout
- layout plan with sewer, water, gas, ventilation
- manuals of all fixed electrical appliances (heater, oven, extractor, ventilation system, domotica,...)
- suppliers of special systems, contractor list
The owner of these documents should not be a person, but the house. This webserver could be mounted in the same box as the domotica system. Hence, even if the house is sold, the webserver will still work, and deliver the information to the new owners. Let's just hope they discover its presence on the ethernet network.
Design principles
To keep the system as simple as possible, we use:
Rationale for the choice of a Arduino Mega: No need to update the software ever, like is to be done if e.g. a Raspberry Pi was chosen.
Background info
The book:
title: | TCP/IP Lean: Web Servers for Embedded Systems (2nd Edition) |
---|---|
by: | Jeremy Bentham |
published: | 2nd edition (February 18, 2002) |
Development
Use the Arduino IDE or PlatformIO for development.
For PlatformIO you will need this folder structure:
Project-Node-HouseWebServer |-- platformio.ini |-- HouseWebServer | |-- HouseWebServer.ino |-- lib | |-- .... | | |-- ....cpp | | |-- ....h
Software examples
https://startingelectronics.org/software/arduino/web-server/basic-01/
The server software is from: https://github.com/maximilianKoeper/ArduinoWebserver
Building the SD card
See "buildindex.sh" script.
It copies the files from BRONDIR to DOELDIR:
BRONDIR=~/remote-repo/michiel/prive/huis/PID DOELDIR=`pwd`/SDcard-build
It also creates a "index.htm" in the root. All files are renamed to 8.3 format, since the SD library only supports short file names. The following files are used as top and bottom of the HTML file, these were borrowed from the output of a Linux tree command as shown:
index-template-part1.txt index-template-part3.txt tree -C -L 2 -T "Sint-Jozefsstraat 52 - PID" -H "" --charset=utf8 --sort=name -o SDcard-build/index.htm ~/remote-repo/michiel/prive/huis/PID/