Difference between revisions of "Understanding the SDS011 particle sensor"

From RevSpace
Jump to navigation Jump to search
(The sensor)
(Understanding the SDS011 particle sensor)
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:STM32 f031k6.jpg|thumb|F031K6, photo Cmpxchg]]
 
== Particle sensor SDS011, understanding its inner workings ==
 
  
On March 3rd, Cmpxchg and Oberoid placed the infamous SDS011 particle sensor on the dissection table at Revspace.
+
== Understanding the SDS011 particle sensor ==
 +
 
 
The SDS011 is extensively used for citizen science projects when air quality is in doubt.
 
The SDS011 is extensively used for citizen science projects when air quality is in doubt.
  
Our goal is to create a new algorithm for its micro-controller which can be published in the public domain and is therefore open for the scrutiny of others.
+
The SDS011 is also the preferred sensor in most citizen science campaigns of governmental initiatives in Germany, The Netherlands and Belgium. For example in the monitoring campaign “de Schone Luchten” [TODO link], the SDS011 plays a central role in gathering date for the public dialogue about dust exhaust of a local steel mill. Within the scientific community as in the groups of concerning citizens there is a growing concern about the the scientific significance of the data collected by the  SDS011. [Citation needed]
 +
 
 
This article is a log of our findings while opening up the sensor and also a description of the process of understand the physics behind the functioning of the device.
 
This article is a log of our findings while opening up the sensor and also a description of the process of understand the physics behind the functioning of the device.
  
== Operation of the SDS011 ==
+
Ideally we would like to create firmware that comes with a description of what physical properties of the incoming air it can
 +
measure, and how accurate it could or would be, if all specified pre-conditions are met.
 +
 
 +
=== Definitions ===
 +
 
 +
PM1
 +
 
 +
PM2.5
 +
 
 +
PM10
 +
 
 +
=== Claims of manufacturer and datasheet ===
  
In the SDS011 particles are detected by recording the light that is scattered by the dust particle when hit by a laser beam. The scatter patterns are picked up by a photo-diode which signal is amplified and then fed to a micro-controller. The micro-controller interprets the data stream and relates it to known properties of representative dust samples. The algorithm behind the this fitting is unknown.
+
[TODO]
  
== Closed Firmware ==
+
=== Claims by users of the device ===
Recently a number of scientific articles appeared that try to assess the validity of the SDS011 sensor.
+
 
However, little is published about the exact physical inner workings of the device, nor on its pre-programmed firmware. Until now researchers take the functioning of the device as a black box, its firmware is considered corperate property and therefore cannot be tinkered with.
+
[TODO]
  
The SDS011 is also the preferred sensor in most citizen science campaigns of governmental initiatives in Germany, The Netherlands and Belgium. For example in the monitoring campaign “de Schone Luchten”, the SDS011 plays a central role in gathering date for the public dialogue about dust exhaust of a local steel mill. Within the scientific community as in the groups of concerning citizens there is a growing concern about the the scientific significance of the data collected by the SDS011.
+
=== Operation of the SDS011 ===
  
To estimate the scientific value of the data gathered by the SDS011, we think that it is important that the working of the device should be open to the public. Therefore we decided to open up the apparatus and investigate its inner workings.
+
Scattering particles are detected when being hit by a laser beam. The scatter patterns are picked up by a photo-diode which signal is amplified and then fed to a micro-controller. The micro-controller interprets the data stream and relates it to known properties of representative dust samples. The algorithm behind the this fitting is unknown.
  
The goal of this project is to not to crack the corporate code of the SDS011, but instead to reprogram its micro-controller with a new algorithm that forms the basis for future development of particle sensors in the public domain.
+
=== Closed Firmware ===
 +
Recently a number of scientific articles appeared that try to assess the validity of the SDS011 sensor.
 +
[TODO link them]
 +
However, little is published about the exact physical inner workings of the device, nor on its pre-programmed firmware.
 +
[TODO describe which parts are described]
 +
Until now researchers take the functioning of the device as a black box. Its firmware is considered corporate property and therefore cannot be tinkered with.
  
People that are interested in this project can visit the RevSpace Hackerspace, which is accessible every tuesday on the social night.
+
To estimate the scientific value of the data gathered by the SDS011, we think that it is important that the working of the device should be open to the public. Therefore we decided to open up the apparatus and investigate its inner workings.
 +
=== Assumptions made by firmware ===
  
 
== Reverse engineering ==
 
== Reverse engineering ==
The follow effort needs to be done to get more information about the pcb board and the sensor.  
+
The follow effort needs to be done to get more insights about the pcb board and the sensor.  
 
This info can then be used to feed a physicist with a theoretical model of potential measurements that can be performed with this setup.
 
This info can then be used to feed a physicist with a theoretical model of potential measurements that can be performed with this setup.
 +
 
=== The board  ===
 
=== The board  ===
The board might be reverse-engineerable.  
+
[[File:Optical Chambre SDS011, photo Cmpxchg.jpg|thumb|Part optical chambre]]
 
 
 
To do:   
 
To do:   
 
# Determine the GPO and GPI of the STM32 while processing  
 
# Determine the GPO and GPI of the STM32 while processing  
 
# Measure the control circuit of the laser module.  
 
# Measure the control circuit of the laser module.  
# Create a matching circuit, filtering and gain of the instrumentation amplifier analysed.
+
# Create a matching circuit, filtering and gain of the instrumentation amplifier analyzed.
  
 
=== The sensor ===
 
=== The sensor ===
The following actions need to be done
+
To do:
# Determine type of the photosensor
+
# Determine type of the photosensor.
# Measure size of size of hole before sensor.
+
# Measure size of size of hole under the detection area.
 
# Create a layout of the lightbox. Angles of second order reflections drawn.  
 
# Create a layout of the lightbox. Angles of second order reflections drawn.  
# Measure air speed.   
+
# Measure the speed of the airflow.   
# Estimate the focus area of laser beam on the airflow.  
+
# Estimate the focus area of laser beam on the airflow.
 
 
  
 +
=== Re-flashing the STM32 ===
 +
[[File:Cut off pins, photo cmpxchg.jpg|thumb|Pins cut off]]
  
== Firmware update process ==
 
 
A complication for re-programming the STM32 is that the programming pins (SWD) are cut off in the manufacturing process, see photo.
 
A complication for re-programming the STM32 is that the programming pins (SWD) are cut off in the manufacturing process, see photo.
 
We discerned three possible scenario's for re-flashing the firmware.
 
We discerned three possible scenario's for re-flashing the firmware.
# reconnecting the copper ends of the cut-off SWD pins
+
# Reconnecting the copper ends of the cut-off SWD pins
# via the UART, with help from the BootP pin.
+
# Flashing via the UART, with help from the BootP pin.
# replace the microcontroller on the pcb with a new one, and put an opensource booloader on it
+
# Replace the microcontroller on the pcb with a new one, and put an opensource bootloader on it.
 
 
== Software control ==
 
=== Firmware update ==
 
Can probably be done via a bootloader and application, over UART.
 
Needs to be explored.
 
  
=== Experimental Drivers ===
+
=== Develop "bare-metal" drivers ===
 +
[[File:Connection SDS011, photo Cmpxchg.jpg|thumb|Connections]]
 
Create bare-metal drivers for:
 
Create bare-metal drivers for:
 
# Blink a led, visual debugging
 
# Blink a led, visual debugging
Line 65: Line 78:
 
The drivers can be tested with short burst of raw measurements, to be output over UART.
 
The drivers can be tested with short burst of raw measurements, to be output over UART.
 
The developing of the drivers using a easy to use tool chain needs to be established.
 
The developing of the drivers using a easy to use tool chain needs to be established.
 +
 +
 +
 +
 +
 +
 +
.
 +
 +
=== Scheduling tasks ===
 +
We are not going to use a RTOS. How we are going to schedule tasks is yet to be determined.
 +
 +
== Calibrating ==
 +
Not yet decided upon how. Probably using climbing chalk.
  
 
== Sources and references ==
 
== Sources and references ==
[https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32f0-series/stm32f0x1/stm32f031k6.html Datasheet smt32f031k6]
+
=== Microcontroller stm32f031k6 ===
 +
[[File:STM32 f031k6.jpg|thumb|F031K6]]
 +
[[Stm32_F031k6_Reference|Stm32 f031k6 reference page]]

Latest revision as of 11:43, 9 March 2020

Understanding the SDS011 particle sensor

The SDS011 is extensively used for citizen science projects when air quality is in doubt.

The SDS011 is also the preferred sensor in most citizen science campaigns of governmental initiatives in Germany, The Netherlands and Belgium. For example in the monitoring campaign “de Schone Luchten” [TODO link], the SDS011 plays a central role in gathering date for the public dialogue about dust exhaust of a local steel mill. Within the scientific community as in the groups of concerning citizens there is a growing concern about the the scientific significance of the data collected by the SDS011. [Citation needed]

This article is a log of our findings while opening up the sensor and also a description of the process of understand the physics behind the functioning of the device.

Ideally we would like to create firmware that comes with a description of what physical properties of the incoming air it can measure, and how accurate it could or would be, if all specified pre-conditions are met.

Definitions

PM1

PM2.5

PM10

Claims of manufacturer and datasheet

[TODO]

Claims by users of the device

[TODO]

Operation of the SDS011

Scattering particles are detected when being hit by a laser beam. The scatter patterns are picked up by a photo-diode which signal is amplified and then fed to a micro-controller. The micro-controller interprets the data stream and relates it to known properties of representative dust samples. The algorithm behind the this fitting is unknown.

Closed Firmware

Recently a number of scientific articles appeared that try to assess the validity of the SDS011 sensor. [TODO link them] However, little is published about the exact physical inner workings of the device, nor on its pre-programmed firmware. [TODO describe which parts are described] Until now researchers take the functioning of the device as a black box. Its firmware is considered corporate property and therefore cannot be tinkered with.

To estimate the scientific value of the data gathered by the SDS011, we think that it is important that the working of the device should be open to the public. Therefore we decided to open up the apparatus and investigate its inner workings.

Assumptions made by firmware

Reverse engineering

The follow effort needs to be done to get more insights about the pcb board and the sensor. This info can then be used to feed a physicist with a theoretical model of potential measurements that can be performed with this setup.

The board

Part optical chambre

To do:

  1. Determine the GPO and GPI of the STM32 while processing
  2. Measure the control circuit of the laser module.
  3. Create a matching circuit, filtering and gain of the instrumentation amplifier analyzed.

The sensor

To do:

  1. Determine type of the photosensor.
  2. Measure size of size of hole under the detection area.
  3. Create a layout of the lightbox. Angles of second order reflections drawn.
  4. Measure the speed of the airflow.
  5. Estimate the focus area of laser beam on the airflow.

Re-flashing the STM32

Pins cut off

A complication for re-programming the STM32 is that the programming pins (SWD) are cut off in the manufacturing process, see photo. We discerned three possible scenario's for re-flashing the firmware.

  1. Reconnecting the copper ends of the cut-off SWD pins
  2. Flashing via the UART, with help from the BootP pin.
  3. Replace the microcontroller on the pcb with a new one, and put an opensource bootloader on it.

Develop "bare-metal" drivers

Connections

Create bare-metal drivers for:

  1. Blink a led, visual debugging
  2. Laser control, PWM
  3. ADC
  4. UART

The drivers can be tested with short burst of raw measurements, to be output over UART. The developing of the drivers using a easy to use tool chain needs to be established.




.

Scheduling tasks

We are not going to use a RTOS. How we are going to schedule tasks is yet to be determined.

Calibrating

Not yet decided upon how. Probably using climbing chalk.

Sources and references

Microcontroller stm32f031k6

F031K6

Stm32 f031k6 reference page