User Tools

Site Tools


doc:appunti:hardware:raspberrypi_air

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
doc:appunti:hardware:raspberrypi_air [2017/10/09 12:37] – [Other setup] niccolodoc:appunti:hardware:raspberrypi_air [2018/10/03 06:05] – [Basic Raspbian Setup] niccolo
Line 32: Line 32:
 {{.:raspberrypi:airpi_fritzing-view.png?direct&480|AirPi breadboard view with Fritzing}} {{.:raspberrypi:airpi_fritzing-view.png?direct&480|AirPi breadboard view with Fritzing}}
 {{.:raspberrypi:airpi_components.jpg?direct&480 |AirPi components}} {{.:raspberrypi:airpi_components.jpg?direct&480 |AirPi components}}
 +
 +====== Software setup ======
 +
 +===== Basic Raspbian Setup =====
 +
 +The base system is a **Raspbian GNU/Linux 9**, based on **Debian Stretch**. Some system configurations are accomplished using the **raspi-config** tool, we run at least:
 +
 +  * **Interfacing Options**
 +    * **Enable SSH** to get remote login via SSH.
 +    * **Enable I2C**, on this bus we have the BME280 sensor and the DS3231 clock.
 +    * **Serial**
 +      * **Disable Serial Login Shell**, our software will use the serial line instead.
 +      * **Enable Serial Port**, we have the PMS5003 sensor attached to it.
 +  * **Localisation Options**
 +    * **Change Locale**, choose the locales you nedd (e.g. en_US.UTF-8).
 +    * **Change Timezone**, set the proper timezone. Data timestamps will be stored in UTC time.
 +    * **Change Wi-fi Country**, to use the proper frequencies, etc.
 +  * **Advanced Options**
 +    * **Memory Split: 16**, we use only the text interface of the GPU.
 +    * **Expand Filesystem** (no longer required: Raspbian Stretch does it automatically at first boot).
 +
 +Be sure to have all the latest updates:
 +
 +<code>
 +apt-get update && apt-get upgrade
 +</code>
 +
 +The scripts to run the AirPi station require several **Debian packages**; install them all:
 +
 +<code>
 +apt-get install build-essential busybox-syslogd git i2c-tools \
 +    nginx php7.0-fpm php7.0-sqlite3 \
 +    python-dev python-requests python-smbus python-serial python-tz \
 +    rrdtool snmp snmp-mibs-downloader snmpd sqlite3
 +</code>
 +
 +Because we installed **busybox-syslogd** to get system log facilities, we can remove rsyslog:
 +
 +<code>
 +dpkg --purge rsyslog
 +</code>
 +
 +There are some packeges not strictly required by the AirPi station, but that I find very useful:
 +
 +<code>
 +apt-get install dselect dump mc minicom nmap screen setserial sniffit tcpdump vim
 +</code>
 +
 +Edit **/etc/nginx/sites-available/default** to enable PHP into the Nginx web server, then reload Nginx.
 +===== DS3231 RTC Clock =====
 +
 +If you instelled the Real-Time Clock module edit **/etc/modules** and **/etc/rc.local** as explained in **[[#Enabling RTC at bootstrap]]**, then you should remove the **fake-hwclock** package:
 +
 +<code>
 +vi /etc/modules
 +vi /etc/rc.local
 +dpkg --purge fake-hwclock
 +</code>
 +
 +===== Python Libraries =====
 +
 +The **Adafruit library for the GPIO** lines is required by the Adafruit BME280 library to access I2C bus. It is advisable to install also some packages **from the Raspbian distro**, otherwise the python setup will try to download and install a local version:
 +
 +<code>
 +apt-get install python-dev python-setuptools python-spidev
 +</code>
 +
 +The Adafruit Python library is installed from the Git repository:
 +
 +<code>
 +cd /usr/local/src/
 +git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
 +cd Adafruit_Python_GPIO
 +python setup.py install
 +</code>
 +
 +The setup procedure will download and install also the **Adafruit_PureIO** library. Everything will be installed into the **/usr/local/lib/python2.7/dist-packages/** directory.
 +===== Serial Line =====
 +
 +Setting the serial line via **raspi-config** as exposed above should suffice, for more info see **[[#More on Serial Line (Manual Setup)]]**. The kernel will expose the serial line at bootstrap using the device **/dev/ttyAMA0** (Raspberry Pi 2) or **/dev/serial0** (Raspberry Pi 3). Read the kernel messages using the **dmesg** command.
 +
 +===== AirPi software =====
 +
 +This software collection will bring you:
 +
 +  * The scripts to read sensors data (BME280 and PMS5003).
 +  * The cronjobs to gather data periodically.
 +  * The web interface to display sensors data.
 +  * The configuration web interface.
 +
 +Everything is stored into the **[[https://github.com/RigacciOrg/AirPi|GitHub AirPi repository]]**, there is a Makefile included, which should do the installation.
 +
 +<code>
 +cd /usr/local/src
 +git clone https://github.com/RigacciOrg/AirPi
 +cd AirPi
 +make install-lib
 +make install-config
 +make install-html
 +make install-webconfig
 +</code>
 +
 +Edit the **/etc/airpi/airpi.cfg** configuration file and make sure you have the rights //bme280// **I2C_ADDRESS** and  //pms5003// **DEVICE**. Now you should be able to read the sensors, using these commands:
 +
 +<code>
 +vi /etc/airpi/airpi.cfg
 +/usr/local/lib/airpi/bme280-snmp
 +/usr/local/lib/airpi/pms5003
 +</code>
 +
 +FIXME Configuration using the web interface uses a custom framework, which is not yet released. Everything you change from the **%%http://<station>/config/%%** web pages is not actually applied to the various configuration files. So you have to edit the configuration files stated above, manually.
 +
 +====== Hardware Setup and Test ======
  
 ===== DS3231 RTC Clock ===== ===== DS3231 RTC Clock =====
Line 148: Line 261:
  
 <code> <code>
-apt-get install build-essential python-dev python-smbus git+apt-get install git build-essential python-dev python-smbus python-setuptools python-spidev
 cd /usr/local/src/ cd /usr/local/src/
 git clone https://github.com/adafruit/Adafruit_Python_GPIO.git git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
Line 357: Line 470:
 ==== Export to DXF ==== ==== Export to DXF ====
  
-In OpenSCAD we use the menu //Design// -> //Compile and Render (CGAL)//. If the object is only bi-dimensional it will be rendered with a red outline and cyan filling. Only in this case we will be able to //File// -> //Export// -> //Export as DXF...//.+In OpenSCAD we use the menu //Design// -> //Render//. If the object is only bi-dimensional it will be rendered with a red outline and cyan filling. Only in this case we will be able to //File// -> //Export// -> //Export as DXF...//.
  
 ==== Using Inkscape to add writings, logos and to layout the pieces ==== ==== Using Inkscape to add writings, logos and to layout the pieces ====
Line 377: Line 490:
 To lay out the shapes into a single project, you should follow the guidelines of the laser cutting services that you will to use. Generally they **provide some templates** (Inkscape is well supported), which shows you how big is the cutting area, and the stroke and the fill that you have to use. To lay out the shapes into a single project, you should follow the guidelines of the laser cutting services that you will to use. Generally they **provide some templates** (Inkscape is well supported), which shows you how big is the cutting area, and the stroke and the fill that you have to use.
  
-=====Software setup ====== +===== More Software Setup =====
- +
-===== Basic Raspbian Setup ===== +
- +
-The base system is a **Raspbian GNU/Linux 9**, based on **Debian Stretch**. Some system configurations are accomplished using the **raspi-config** tool, we run at least: +
- +
-  * **Interfacing Options** +
-    * **Enable SSH** to get remote login via SSH. +
-    * **Enable I2C**, on this bus we have the BME280 sensor and the DS3231 clock. +
-    * **Serial** +
-      * **Disable Serial Login Shell**, our software will use the serial line instead. +
-      * **Enable Serial Port**, we have the PMS5003 sensor attached to it. +
-  * **Localisation Options** +
-    * **Change Locale**, choose the locales you nedd (e.g. en_US.UTF-8). +
-    * **Change Timezone**, set the proper timezone. Data timestamps will be stored in UTC time. +
-    * **Change Wi-fi Country**, to use the proper frequencies, etc. +
-  * **Advanced Options** +
-    * **Memory Split: 16**, we use only the text interface of the GPU. +
-    * **Expand Filesystem** (no longer required: Raspbian Stretch does it automatically at first boot). +
- +
-Be sure to have all the latest updates: +
- +
-<code> +
-apt-get update && apt-get upgrade +
-</code> +
- +
-The scripts to run the AirPi station require several **Debian packages**; install them all: +
- +
-<code> +
-apt-get install build-essential busybox-syslogd git i2c-tools \ +
-    nginx php7.0-fpm php7.0-sqlite3 \ +
-    python-dev python-requests python-smbus python-serial python-tz \ +
-    rrdtool snmp snmp-mibs-downloader snmpd sqlite3 +
-</code> +
- +
-Because we installed **busybox-syslogd** to get system log facilities, we can remove rsyslog: +
- +
-<code> +
-dpkg --purge rsyslog +
-</code> +
- +
-There are some packeges not strictly required by the AirPi station, but that I find very useful: +
- +
-<code> +
-apt-get install dselect dump mc minicom nmap screen setserial sniffit tcpdump vim +
-</code> +
- +
-Edit **/etc/nginx/sites-available/default** to enable PHP into the Nginx web server, then reload Nginx. +
- +
-===== DS3231 RTC Clock ===== +
- +
-If you instelled the Real-Time Clock module edit **/etc/modules** and **/etc/rc.local** as explained in **[[#Enabling RTC at bootstrap]]**, then you should remove the **fake-hwclock** package: +
- +
-<code> +
-vi /etc/modules +
-vi /etc/rc.local +
-dpkg --purge fake-hwclock +
-</code> +
- +
-===== Python Libraries ===== +
- +
-The **Adafruit library for the GPIO** lines is required by the Adafruit BME280 library to access I2C bus: +
- +
-<code> +
-cd /usr/local/src/ +
-git clone https://github.com/adafruit/Adafruit_Python_GPIO.git +
-cd Adafruit_Python_GPIO +
-python setup.py install +
-</code> +
- +
-===== Serial Line ===== +
- +
-Setting the serial line via **raspi-config** as exposed above should suffice, for more info see **[[#More on Serial Line (Manual Setup)]]**. The kernel will expose the serial line at bootstrap using the device **/dev/ttyAMA0** (Raspberry Pi 2) or **/dev/serial0** (Raspberry Pi 3). Read the kernel messages using the **dmesg** command. +
- +
-===== AirPi software ===== +
- +
-This software collection will bring you: +
- +
-  * The scripts to read sensors data (BME280 and PMS5003). +
-  * The cronjobs to gather data periodically. +
-  * The web interface to display sensors data. +
-  * The configuration web interface. +
- +
-Everything is stored into the **[[https://github.com/RigacciOrg/AirPi|GitHub AirPi repository]]**, there is a Makefile included, which should do the installation. +
- +
-<code> +
-cd /usr/local/src +
-git clone https://github.com/RigacciOrg/AirPi +
-cd AirPi +
-make install-lib +
-make install-config +
-make install-html +
-make install-webconfig +
-</code> +
- +
-Edit the **/etc/airpi/airpi.cfg** configuration file and make sure you have the rights //bme280// **I2C_ADDRESS** and  //pms5003// **DEVICE**. Now you should be able to read the sensors, using these commands: +
- +
-<code> +
-vi /etc/airpi/airpi.cfg +
-/usr/local/lib/airpi/bme280-snmp +
-/usr/local/lib/airpi/pms5003 +
-</code> +
- +
-FIXME Configuration using the web interface uses a custom framework, which is not yet released. Everything you change from the **%%http://<station>/config/%%** web pages is not actually applied to the various configuration files. So you have to edit the configuration files stated above, manually. +
- +
-===== Other setup =====+
  
 === SNMP === === SNMP ===
doc/appunti/hardware/raspberrypi_air.txt · Last modified: 2020/08/14 10:17 by niccolo