SPI – Show PM2.5 Concentration On ILI9341 TFT LCD

If you are not familiar with SPI, please read Introduction to SPI first.

Preparation

  • AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1

  • ILI9341 TFT LCD with SPI interface x 1

  • Plantower PMS3003 or PMS5003 x 1

Example

This example extends previous PM2.5 example to show the PM2.5 concentration on the LCD.

AMB21 / AMB22 and QVGA TFT LCD Wiring Diagram:

Note

PMS3003/PMS5003 sensor requires 5V voltage

../../../../_images/image169.png

AMB23 and QVGA TFT LCD Wiring Diagram:

../../../../_images/image1-24.png

BW16 and QVGA TFT LCD Wiring Diagram:

../../../../_images/image1-35.png

BW16-TypeC and QVGA TFT LCD Wiring Diagram:

../../../../_images/image1-42.png

AMB21 / AMB22 and Adafruit 2.8” TFT LCD Wiring Diagram:

../../../../_images/image265.png

AMB23 and and Adafruit 2.8” TFT LCD Wiring Diagram:

../../../../_images/image2-17.png

BW16 and and Adafruit 2.8” TFT LCD Wiring Diagram:

../../../../_images/image2-25.png

BW16-TypeC and and Adafruit 2.8” TFT LCD Wiring Diagram:

../../../../_images/image2-34.png

Open the example, “Files” “Examples” “AmebaSPI” “ILI9341_TFT_LCD_PM2.5”

../../../../_images/image343.png

Compile and upload to Ameba, then press the reset button.

Then you can see the concentration value of PM1.0, PM2.5 and PM10 on the LCD.

../../../../_images/image432.png ../../../../_images/image524.png

Code Reference

In this example, first rotate the screen by 90 degrees, and draw the static components such as the circles, the measuring scale, and the title text. After the concentration value is detected, it is printed inside the circle.