doc:appunti:hardware:raspberrypi_air
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:hardware:raspberrypi_air [2017/10/06 00:02] – [Other setup] niccolo | doc:appunti:hardware:raspberrypi_air [2018/08/30 06:31] – [Export to DXF] niccolo | ||
---|---|---|---|
Line 32: | Line 32: | ||
{{.: | {{.: | ||
{{.: | {{.: | ||
+ | |||
+ | ====== 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, | ||
+ | * **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: | ||
+ | |||
+ | < | ||
+ | apt-get update && apt-get upgrade | ||
+ | </ | ||
+ | |||
+ | The scripts to run the AirPi station require several **Debian packages**; install them all: | ||
+ | |||
+ | < | ||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | Because we installed **busybox-syslogd** to get system log facilities, we can remove rsyslog: | ||
+ | |||
+ | < | ||
+ | dpkg --purge rsyslog | ||
+ | </ | ||
+ | |||
+ | There are some packeges not strictly required by the AirPi station, but that I find very useful: | ||
+ | |||
+ | < | ||
+ | apt-get install dselect dump mc minicom nmap screen setserial sniffit tcpdump vim | ||
+ | </ | ||
+ | |||
+ | Edit **/ | ||
+ | |||
+ | ===== DS3231 RTC Clock ===== | ||
+ | |||
+ | If you instelled the Real-Time Clock module edit **/ | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | vi / | ||
+ | dpkg --purge fake-hwclock | ||
+ | </ | ||
+ | |||
+ | ===== 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: | ||
+ | |||
+ | < | ||
+ | apt-get install python-dev python-setuptools python-spidev | ||
+ | </ | ||
+ | |||
+ | The Adafruit Python library is installed from the Git repository: | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git clone https:// | ||
+ | cd Adafruit_Python_GPIO | ||
+ | python setup.py install | ||
+ | </ | ||
+ | |||
+ | The setup procedure will download and install also the **Adafruit_PureIO** library. Everything will be installed into the **/ | ||
+ | ===== 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 **/ | ||
+ | |||
+ | ===== 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:// | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git clone https:// | ||
+ | cd AirPi | ||
+ | make install-lib | ||
+ | make install-config | ||
+ | make install-html | ||
+ | make install-webconfig | ||
+ | </ | ||
+ | |||
+ | Edit the **/ | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | FIXME Configuration using the web interface uses a custom framework, which is not yet released. Everything you change from the **%%http://< | ||
+ | |||
+ | ====== Hardware Setup and Test ====== | ||
===== DS3231 RTC Clock ===== | ===== DS3231 RTC Clock ===== | ||
Line 148: | Line 262: | ||
< | < | ||
- | apt-get install build-essential python-dev python-smbus | + | apt-get install |
cd / | cd / | ||
git clone https:// | git clone https:// | ||
Line 357: | Line 471: | ||
==== Export to DXF ==== | ==== Export to DXF ==== | ||
- | In OpenSCAD we use the menu //Design// -> //Compile and Render | + | 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 376: | 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 ====== | ||
- | ==== Basic Raspbian | + | ===== More Software |
- | 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: | + | === SNMP === |
- | * **Interfacing Options** | + | FIXME make configuration |
- | * **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 Timezone**, set the proper timezone. Data timestamps will be stored in UTC time. | + | |
- | * **Change Wi-fi Country**, to use the proper frequencies, | + | |
- | * **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: | + | < |
- | + | #!/bin/sh | |
- | < | + | SENSORS=" |
- | apt-get update && apt-get upgrade | + | SENSORS=" |
+ | for SENSOR in $SENSORS; do | ||
+ | snmpwalk | ||
+ | done | ||
</ | </ | ||
- | The scripts to run the AirPi station require several **Debian packages**; install them all: | + | === Logread Buffer Len === |
- | < | + | We installed **busybox-syslogd** instead of **rsyslog**, |
- | apt-get install build-essential | + | |
- | nginx php7.0-fpm php7.0-sqlite3 \ | + | |
- | python-dev python-requests python-smbus python-serial python-tz \ | + | |
- | rrdtool snmp snmp-mibs-downloader snmpd sqlite3 vim | + | |
- | </ | + | |
- | Because we installed **busybox-syslogd** to get system log facilities, we can remove rsyslog: | + | < |
+ | SYSLOG_OPTS=" | ||
+ | </ | ||
- | < | + | === PMS5003 Reset Line === |
- | dpkg --purge rsyslog | + | |
- | </ | + | |
- | There are some packeges not strictly required by the AirPi station, but that I find very useful: | + | We used the PMS5003 sensor quite extensively for about 9 months, 24h/24h with one reading every 15 minutes and sensor sleep in between: we never registered a failure. Neverthless the sensors has a RESET pin which can be used just in case. The pin is keept high by an internal pull-up resistor, so we can leave it vacant. In our experience it seems also that we can leave it attached to a Rapspberry' |
- | < | + | If you need, we have included |
- | apt-get install dselect mc minicom nmap screen setserial sniffit tcpdump vim | + | |
- | </ | + | |
- | + | ||
- | Edit **/ | + | |
- | ==== DS3231 RTC Clock ==== | + | |
- | + | ||
- | If you instelled | + | |
- | + | ||
- | < | + | |
- | vi /etc/modules | + | |
- | vi /etc/ | + | |
- | dpkg --purge fake-hwclock | + | |
- | </ | + | |
- | + | ||
- | ==== Python Libraries ==== | + | |
- | + | ||
- | The **Adafruit library for the GPIO** lines is required by the Adafruit BME280 library to access I2C bus: | + | |
- | + | ||
- | < | + | |
- | cd / | + | |
- | git clone https:// | + | |
- | cd Adafruit_Python_GPIO | + | |
- | python setup.py install | + | |
- | </ | + | |
- | + | ||
- | ==== 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 | + | |
- | ==== AirPi software ==== | + | |
- | + | ||
- | This software collection will bring you: | + | |
- | + | ||
- | * The scripts to read sensors data (BME280 | + | |
- | * The cronjobs | + | |
- | * The web interface to display sensors data. | + | |
- | * The configuration web interface. | + | |
- | + | ||
- | Everything is stored into the **[[https:// | + | |
- | + | ||
- | < | + | |
- | cd / | + | |
- | git clone https:// | + | |
- | cd AirPi | + | |
- | make install-lib | + | |
- | make install-config | + | |
- | make install-html | + | |
- | make install-webconfig | + | |
- | </ | + | |
- | + | ||
- | 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: | + | |
- | + | ||
- | < | + | |
- | vi / | + | |
- | / | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | FIXME Configuration using the web interface uses a custom framework, which is not yet released. Everything you change from the **%%http://< | + | |
- | ===== Other setup ===== | + | |
- | + | ||
- | FIXME SNMPD, logread buffer len, ... | + | |
- | ==== SNMPD ==== | + | |
+ | < | ||
+ | # ==== PMS5003 RESET pin ==== | ||
+ | # Set the GPIO pin to normal HIGH. The controlling program will bring | ||
+ | # it down for a short time, if device reset is required. | ||
+ | / | ||
+ | </ | ||
===== More on Serial Line (Manual Setup) ===== | ===== More on Serial Line (Manual Setup) ===== |
doc/appunti/hardware/raspberrypi_air.txt · Last modified: 2020/08/14 10:17 by niccolo