Another Python training

Many colleagues of Arba Minch Water Technology Institute (AWTI) showed interest in attending the Python training which I offered last March. I therefore offered another round of the same training. You can find the training materials through this link.

Based on the previous round, I made a couple of changes:

  • I introduced practice sessions. Experience from the previous round showed that participants mainly followed the training sessions, but did not practice much by themselves. By offering assignments and sessions for working on those assignments, I hoped to stimulate personal practice.
  • Training assistants joined the sessions. From the earlier training I invited colleagues to help during the training. In this way, there were multiple persons available for personal support of the participants. I was assisted by Daniel Asele, Getachew Enssa, Manyazwal Getachew and Samrawit Dereje.
  • I included the possibility of earning a certificate. Earlier, I was unaware that a big reason for joining trainings is to get a certificate. I do however not believe in handing out a certificate based on only training attendance. Therefore, participants need to make a final assignment to be eligible for a certificate, by using their own data.

Interest versus application

The interest in the training was high (66 registrations). However, similar to the previous round, there was quite a difference between interest and actively participating in the full training. 54 persons attended at least one session, but 32 of these attended most sessions for the four core modules. At the moment, only the fifth (bonus) session on multidimensional (satellite) data remains to be offered. Apart from participating in the training, there is also the gap between following a training and using it yourself. Many participants do not realize that skills in Python depend on personal application much more than on following a training. Initially I thought that I could help 60+ persons towards better data processing. I have to adjust my expectations, and I must be happy with the five to ten colleagues that truly get started on using Python.

Air pollution course 2021

The first semester of academic year 2019/2020 I offered two air pollution courses, in which 33 groups of students collected air pollution data. The corona outbreak upended the academic calendar, so that this year’s air pollution course for year 4 Water Supply and Environmental Engineering students became scheduled from April 2021 instead of October 2020. This year’s batch was three sections, with a total of 101 students. One of the lessons of previous round was a lack of time. While a full research project requires due attention for all parts of the research cycle (from formulating research questions all the way to presenting findings), it is challenging to squeeze that into a single course. Therefore, for this year I decided to cooperate with my colleague (Bewketu Aweke), who would offer the course Research Methods to the same batch. From his course, he could cover research methodology, and from my course, I could cover air pollution. The students would conduct one research project that would be assessed for both courses.

Condensed course outline

An oncoming election upended a well-constructed schedule. In the first week of the course, we were informed that there would be six instead of the usual 12-15 weeks available. Students would be sent home after six weeks, and only come back a month later for conducting a final exam. We let the students execute a condensed form of the project, with the following outline:

  • Week 1: topic and instrument introduction, start on proposals;
  • Week 2: deadline of proposals.
  • Weeks 3-4: data collection.
  • Week 5: Data analysis.
  • Week 6: Draft report. Based on feedback on the draft report, students could submit a final report some weeks later.

Simultaneous to the project activities across these weeks, there were the course lectures of the two courses. These lectures covered the theoretical course contents, but also provided input for the project activities. In total 21 groups of students conducted measurements of PM2.5, CO and/or CO2 at self-selected locations on or around campus.

Individual assignment

Apart from time limitation, a lesson of the earlier project was that with group work, it was difficult to let all students participate equally. This year, all students were sent to their hometown after six weeks. This provided a unique opportunity to let students individually apply what their group found during the measurements. Every student got the individual assignment to interpret their groups’ measurement for their hometown situation. This resulted in 101 students thinking about their family members or neighbors that might encounter situations in which they had conducted measurements. For example, a group member that measured during coffee preparation:

We measured an average concentration of 288 microgram/m3 PM2.5 during preparation of coffee ceremony at the campus coffee place. In my hometown we have coffee ceremony. My mom spends three hours of the day in coffee preparation. If my mom is exposed for three hours to a concentration of 288 μg/m3, her 24-hour average will be at least 3*288/24 = 36 μg/m3. Likely, it will be higher, because during the other 21 hours of the day she also cooks food for us. So, her average exposure is most likely higher than the standard of 25 μg/m3. I recommend to my mom to use electric stove.

Or, a group member that conducted measurements close to waste burning:

We measured for 51 minutes while waste was burning. We measured an average concentration of 874 μg/m3. My sister works as a waste collector. She works probably for about two hours per day close to waste burning. If she is exposed for two hours to a concentration of 874 μg/m3, then her 24-hour average exposure will be at least 2*874/24 = 72.83 μg/m3. I recommend that the community reduces waste, and that instead of burning it, they use other waste disposal methods. My sister needs to be careful, wear a mask and stay far away from burning waste.

Advanced Excel training with sixty participants

The past week I have offered a training on Advanced Excel for data processing. Experts in several fields world-wide use Microsoft Excel. In scientific circles, programming languages like Python, Matlab or R are often mentioned. However, Microsoft Excel is encountered a lot in the work field. Advanced use of Microsoft Excel (wildcards, array formulas, nested formulas, assigning variable names, etcetera) enables data processing on a professional level. I gave a training in Python recently. An increased knowledge in Excel helps colleagues as well.

Due to high interest in the training (68 registrations), I offered the two-day training in two shifts. One of the shift was even in two simultaneous sessions. Daniel Asele, Samrawit Dereje and Geertje Dingemanse assisted me in offering the sessions. A small part of the training consisted out of one-way communication with slide presentations. The main part of the training required participants to work themselves through worksheets with step-by-step instructions, under supervision of the instructors.

I divided the training into five modules: assigning names, conditions and searching, grouping data, array formulas and miscellaneous topics. The training materials are available on an OSF repository.

A sample of the Advanced Excel training instructions.

Python training on environmental data processing

Over a period of five weeks, I have offered a five-day Python training for environmental data processing. You can find the training materials on my OSF repository.

During the year 2020, I found myself with a lot of time (students were sent home due to corona) and data (during air pollution courses I offered, students collected data across 30 situations). I decided to spend my time on learning to use Python for data processing. [UPDATE: this resulted in data visualizations for an article about the students’ data collection.] To foster my newfound Python addiction, I decided to turn what I learned into a training for colleagues of the Arba Minch Water Technology Institute. This resulted in a ‘Basic Python for Environmental Data Processing’ training. The training ran from the absolute basics (variables, functions) up to data processing and visualization (Pandas, Matplotlib) and working with multidimensional data (NetCDF).

PowerPoint slide with the outline of the Basic Python for Environmental Data Processing training

The training leaned heavily on lecture slides and participants simultaneously practicing on their own laptop. I offered four modules and one bonus-day, distributed over five weeks (one day per week). To keep groups small, I offered a singe module four times to four groups of participants. While the interest in Python appears to be high (48 participants at the start), the motivation to actively participate in all sessions lacks behind (17 participants followed all sessions). I will have to find out in future trainings whether that is something I can influence.

GMB to donate 30 laptops

GMB, a Dutch civil engineering company, has promised to donate 30 used but well maintained laptops to the air quality laboratory of Arba Minch University through their “Sociaal Fonds GMB“.

My students (undergraduate Water Supply and Environmental Engineering) have hardly any exposure to computers. The few computer classes they take are plagued by electrical outages and absent computer lab assistants. I saw this in their work in the previous two air quality courses. For typing a few sentences or making one graph in Excel, students spend hours, often frustrated about the inability to get the result they want. The few students who can afford their own laptop have considerably better computer skills, simply because they are exposed more.

When the laptops will arrive, I will include Excel lab classes in my course, and lend laptops to (groups of) students in need of a laptop. This gift of GMB leads to more practically educated water engineers, which will contribute in a more efficient way to Ethiopia’s environment and infrastructure.

LoRa gateway installed

Mekuanint Hailemichael, a colleague of Arba Minch University (senior network manager) has installed a LoRa gateway at a high building of the Nech Sar Campus of Arba Minch University. Installation of the gateway is part of our research project titled “Determining the feasibility and reliability of a do-it-yourself air quality sensor network in Arba Minch, Ethiopia.”.

The building with the gateway is in the middle of Arba Minch, at Nech Sar Campus.

We are planning to install and test multiple Arduino-based particulate matter (PM) sensor systems in Arba Minch. Apart from testing their operationality and data quality, we want to test the possibility of real-time online data through LoRa functionality. The sensor systems transmit small packets of data over a frequency of 868 MHz. A well-positioned gateway can receive this data and put it online. For this purpose, Mekuannint (co-investigator in the research project) has installed a Lorank-8 gateway together with antenna and lighting protection. It is connected to the Arba Minch University network.

Arduino PM sensor system 3/3: sensor data online

In a series of three posts, I share my road towards a PM sensor system with help of Arduino and the SPS30 Sensirion PM sensor. This third post: getting the PM sensor data available online.

Preferably, the measurement data is available real-time online. With the setup of the previous post, we can only access the data by getting it from the SD card. To an Arduino system, a WiFi module can be added to provide online functionality. However, in and around Arba Minch the availability of WiFi is unreliable and limited. I therefore chose to add LoRa (Long Range) functionality to the sensor system, to get the PM sensor data available online.

With LoRa, small packets of data are sent over frequencies of around 433 or 868 MHz. On this frequency, data can be sent over large distances (10+ km). A receiver with internet connection (‘gateway’) can pick up these transmissions and put them online. For small-scale and personal projects, TheThingsNetwork provides network servers for these transmissions for free. In this way, only at one position (the gateway) internet is needed, while within range of that gateway sensor systems can transmit their data.

1 Materials

Individual sensor systems get LoRa functionality through a Dragino LoRa shield. Apart from that, a gateway is needed to receive the data transfers of individual sensor systems. I bought this gateway.

2 Software

To run the LoRa transmission on an arduino board, I used the LMIC arduino library. Apart from that, I created an account on TheThingsNetwork. On that account, I registered an application, and under that application, I registered individual sensor systems as devices.

3 Connections

I mounted the LoRa shield on an Arduino Mega, and connected the SPS30 Sensirion, SD module and DS3231 to the Arduino Mega according to below connections.

SPS030......Mega
1 VCC.......5V
2 SDA.......SDA
3 SCL.......SCL
4 Select....GND
5 GND.......GND

SD module...Mega
GND.........GND
VCC.........5V
MISO........12
MOSI........11
SCK.........13
CS..........53

DS3231......Mega
GND.........GND
VCC.........5V
SDA.........SDA
SCL.........SCL

I had difficulty in getting both the LoRa shield and the SD module to work. Somehow, the communication over MISO/MOSI disturbed each other. While for the default SD library, on the Arduino Mega pins 51-53 are used, I managed to get it working by using SoftwareSPI of the SDfat library and using pins 11-13.

4 Sketch

I used the following sketches for the components:

I combined these sketches to create a full sketch that operates all parts together. In that sketch, for every individual sensor system I had to provide the TheThingsNetwork device’s NwkSKey, AppSKey and DevAddr.

Show code of the whole sketch

5 Operation

In The Things Network, I activated the Storage Integration. In Python I wrote a script that, when ran, downloads the data from TheThingsNetwork, saves it locally as a csv file, creates a graph, and uploads this graph to a website. See the code below.

Downloading the data

Creating a graph

Uploading the graph

This all resulted in a graph on my website, provided that I had a sensor system running, a gateway connected to the internet, and the Python code running.

Arduino PM sensor system 2/3: sensor data on an SD card

In a series of three posts, I share my road towards a PM sensor system with help of Arduino and the SPS30 Sensirion PM sensor. This second post: storing the data on an SD card.

In the previous post I described how I got the sensor data on my computer. Preferably, measurements are done without continuously having a computer around. I wanted to add local data storage to the sensor system with a memory (micro SD) card.

1 Materials

Next to the setup part 1 materials, I bought the following materials:

I found out that for a memory card, it was better to have a relatively small card (< 1GB). Furthermore, after running into battery failure of the real-time clock multiple times, I learned that the DS3231 charging system could destroy non-rechargeable batteries. To resolve this, the charging circuit had to be disabled (for example by removing resistor 201 from the DS3231 shield).

2 Software

Both the real-time clock and the SD card work with libraries that by default are included in the Arduino IDE installation. Additional software was not needed.

3 Connections

I made the following connections between the Aduino Mega and the SD and real-time clock modules:

SD module...Mega
GND.........GND
VCC.........5V
MISO........50
MOSI........51
SCK.........52
CS..........53

DS3231......Mega
GND.........GND
VCC.........5V
SDA.........SDA
SCL.........SCL

I also put the micro SD card in the SD module.

4 Sketch

I used the following sketches for the components:

In the below sketch, these are combined.

See sketch

5 Operation and next

After uploading the sketch to the Arduino board, it started to collect data and store it on the SD card. I could get the data from the SD card. This is already sufficient for many measurement projects, but online real-time data would be even nicer. Post three: adding LoRa functionality to the sensor system.

Arduino PM sensor system 1/3: sensor data on a computer

In a series of three posts, I share my road towards a PM sensor system with help of Arduino and the SPS30 Sensirion PM sensor. This first post: getting the sensor data on a computer.

Nowadays, more and more Do-It-Yourself air quality sensors come available. A huge advantage of this is the price: while plug and play particulate matter (PM) instruments are (at least) 300, PM sensors can already be bought for under 20. The two main disadvantages are 1) you have to build it yourself, and 2) the reliability of the instrument might be unknown.

Because of the cost-advantage, I chose to discover these options, despite of the two disadvantages. Across three posts, I describe the development of a PM sensor system, based on the Sensirion SPS30 PM sensor, with help of Arduino. For me, the starting point was absolutely zero knowledge on this topic, hence the posts will cover the full learning curve. If you have more knowledge on this topic, it might well be that you can give me relevant advice on how to improve the eventual sensor measurement set.

1 Materials

Below a list of materials, with links to randomly selected suppliers.

2 Software

I installed the Arduino IDE, downloaded a SPS30 library, and placed it in my Arduino folder (Documents/Arduino/libraries).

3 Connections

The SPS30 has five pins: GND, SEL, SCL, SDA and VCC. I connected these pins according to the below schematic (where the two 10K resistors are connected to the SDA and SCL wiring and 5V as ‘pull-up resistors’).

4 Starting the sensor

I connected the Arduino board to my laptop, and in the Arduino IDE, I selected the right COM port (Tools -> Port).

In the example sketch sps30/Example1_sps30_BasicReadings, I edited the following in the sketch:

  • Line 161: #define SP30_COMMS I2C_COMMS

I uploaded the sketch, clicked on the serial monitor and put the baud rate on 115200. After hitting enter, I get PM readings on my screen.

5 What’s next?

Now I have PM data on the screen. The data is out there: but how to save it? Post two: storing the data on an SD card.

Personal exposure exceeding guideline values

For the 10 participants of a pilot study, personal exposures to Carbon Monoxide (CO) and PM2.5 concentrations exceed guideline values. You can read more about these measurements on the project page.

Guideline values

The World Health Organization (WHO) advises a PM2.5 guideline of 25 μg/m3 as 24-hour average (source), while Ethiopia uses a guideline value of 65 μg/m3 as 24-hour average (Guideline Ambient Environment Standards for Ethiopia, 2003).

For CO, guideline values are given at shorter time average periods, as health effects from CO can be more direct. Both the WHO and Ethiopia use guideline values at averaging periods of 15 minutes, 30 minutes, 1 hour and 8 hours of respectively 90, 50, 25 and 10 PPM.

Measured CO exposure

During the 24-hour measurements, peaks up to 400 PPM were measured. The figures show the measured CO concentration as boxplots for each of the participants, without and with values outside the whiskers.

24-hour average concentrations are below 6 PPM, and for all participants 75% of all data is lower than 5 PPM. There are however peak concentrations of sometimes up to 400 PPM.

To compare the measured concentrations to guideline values, we have to use 15 minute, 30 minute, 1 hour and 8 hour average concentrations. Each of these time averaging period have their own guideline value. To compare them in one graph, the below graph shows the highest average value of each of these time periods, relative to the guideline value for that averaging period. Averaging concentrations higher than 100% imply that the concentration exceeds the guideline value.

CO maximum average concentrations, relative to the respective guideline values.

Measured PM2.5 exposure

Comparing the measured PM2.5 exposure to the guideline value is more straightforward. Below figure shows the 24-hour average concentrations combined with the guideline values.

PM2.5 24-hour average concentrations.

At all households, the WHO guideline value (25 μg/m3) is exceeded. Only for the participant from household 6, the Ethiopian guideline value (65 μg/m3) is not exceeded.

However, during the 24-hour periods there is a large variability. Periods of relatively low concentrations are mixed with moments of high concentrations. Below figures show the CO and PM2.5 concentration during the whole period, for each of the participants.

TimePlot-HH01
TimePlot-HH02
TimePlot-HH03
TimePlot-HH04
TimePlot-HH06
TimePlot-HH07
TimePlot-HH05
TimePlot-HH08
TimePlot-HH09
TimePlot-HH10
previous arrow
next arrow
 
TimePlot-HH01
TimePlot-HH02
TimePlot-HH03
TimePlot-HH04
TimePlot-HH06
TimePlot-HH07
TimePlot-HH05
TimePlot-HH08
TimePlot-HH09
TimePlot-HH10
previous arrow
next arrow