06 Configure Your AirPi








OK so far we have:

Built the AirPI, tested the card, configured the raspberry pi now it's time to put it all together!.

READ THIS SECTION CAREFULLY!

Step 1:

Connect the AirPI to the raspberryPI and boot the raspberryPI. When it boots open a terminal window and ssh to the raspberryPI (or if you are on the raspberryPI directly open a terminal in the GUI.)

then....


cd ./git/Airpi 

then type
 ls

This will show you a listing of the files in the folder. There are 3 files that control the airPI:
            • sensors.cfg
            • settings.cfg
            • outputs.cfg
Lets look at each of them starting with settings.cfg. Any thing following a semicolon ( ; ) is a comment. The config files are pretty well commented. They are reproduced here....
settings.cfg
[Main]             ;anything in the square brackets is a section heading
uploadDelay = 600   ;how long to wait before uploading again in seconds
                  ;600 seconds is is 10 minutes. This is an ok setting
                  ;1800 seconds or every 30 minutes is also good.
                  ;set it to 20 for testing - don't go less than that.
redPin=27           ;tell Python that the RED LED is connected to GPIO 27 - don't change
greenPin=22         ;tell Python that the GREEN LED is connected to GPIO 22 - don't chamge


outputs.cfg


[Print]               ;section heading. The [print] section prints the staus on the screen
filename=print         ; the filename of the module to load. Do not change
enabled=on             ; to switch this on set enabled to on to switch it off set it to off

[Xively]               ;This is another IoT service but it's not free so don't use it
filename=xively
enabled=off
APIKey=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
FeedID=XXXXXXXXXX

[Thingspeak]           ;YAY! here is our IoT service name
filename=thingspeak     ;load the thingspeak module from the folder
enabled=on             ;Switch it on
APIKey=29LA6S8V9QKOSLUR ;This is you channel 1 WRITE API Key

                     ; you can write to your second channel by copying the entire 
                     ; Thingspeak section and renaming it [Thingspeak2]
                     ; change your write key to the channel 2 write key




finally the big one...

sensors.cfg

sensors.cfg

# Airpi sensor config file
#This file is used to switch sensors on and off and set various parameters for use by other services. Key parameters include:
#
# filename:
[BMP085-temp] ;Barometric Pressure Sensor
filename=bmp085 ;Load the correct python file
enabled=on ;Switch it on (only switch it on if you have the sensor)
measurement=temp ;Tell the module to measure temperature
i2cbus = 1 ;tell Python where the module is located could be 1 or 0. Usually 1
fieldID = field7 ;Tell Thingspeak which field this reading goes in to.

[BMP085-pres] ;Barometric Pressure Sensor. note we have called this a seperate section
filename=bmp085 ;load the file
enabled=on ;switch it on
measurement=pres ;tell it to measure pressure
mslp=on ;tell the module to calulate the pressure as mean sea level pressure. Turn this off for local pressure
i2cbus = 1 ;tell the module where the module is located
altitude=40 ; for mlsp we need to know our altitude
fieldID = field4 ;Tell thingspeak which field to put this in

[MCP3008] ;this is the analog to digital converter module
filename=mcp3008 ;load the module for the correct module file
enabled=on ;switch it on. Note: this module is essential for all analog to digital conversions

[DHT22] ;DHT 22 humidity and temperatue module
filename=dht22
enabled=on
measurement=humidity ; tell it to measure humidity
pinNumber=4 ; the the Pi which pin the module is connected to
fieldID=field2 ; tell thingspeak what field the humidity is stored in

[DTH22T] ;create a new section for the DHT22 to read the temperature
filename=dht22 ;load the module
enabled=on ;switch it on
measurement=temperature ;tell it to measure temperature
pinNumber=4 ; locate the device
fieldID=field1 ; store the output in field one on thingspeak

[LDR]
filename=analogue
enabled=on
pullUpResistance=10000
measurement=Lux
adcPin = 0
sensorName = LDR
fieldID = field6


[UVI]
filename=analogue
enabled = on
measurement =UVI
adcPin = 4
sensorName =UVI
fieldID = field3

[TGS2600] ; Air pollution sensore
filename=analogue ; use the analogue module
enabled=on ; switch it on
pullDownResistance=22000 ; tell the module what the pull down resistance is in ohms
measurement=Smoke_Level ; name the reading
adcPin=1 ; tell the pi which adc pin the sensor is on
sensorName=TGS2600 ; name the sensor
fieldID=field5 ; store the value in field 5.

[MiCS-2710] ;Not used
filename=analogue
enabled=off
pullDownResistance=10000
measurement=Nitrogen_Dioxide
adcPin=2
sensorName=MiCS-2710

[MiCS-5525] ;Not used
filename=analogue
enabled=off
pullDownResistance=100000
measurement=Carbon_Monoxide
adcPin=3
sensorName=MiCS-5525

[Mic] ;Not used
filename=analogue
enabled=off
measurement=Volume
adcPin=4
sensorName=ABM_713_RC


Step 2: How to run the airPI software


type:

cd ~/git/AirPi


then

sudo python ./airpi.py


Then watch the output.



Comments