Introduction: Environmental Sensors Cooperate With Seeeduino XIAO
This is a demo based on Seeeduino XIAO and basic Grove sensors like DHT11 temperature & humidity sensor and light sensor to display the value on the SSD1315 OLED. And here is a Grove touch module for controlling the whole system and the OLED to display the data. Seeeduino XIAO is completely compatible with Arduino, so this demo is based on Arduino IDE. For details, you can click here to install the board in the Arduino IDE.
- Seeeduino XIAO - Arduino Microcontroller - SAMD21 Cortex M0+
- Seeed Grove - Touch Sensor
- Grove - Digital Light Sensor - TSL2561
- Grove - Temperature & Humidity Sensor (DHT11)
- Grove - OLED Display 0.96" (SSD1315)
- Grove - 4 pin Male Jumper to Grove 4 pin Conversion Cable (5 PCs per Pack)
- Seeed - 400 Point Solderless Breadboard for Raspberry Pi and Arduino Project
Step 1: Hardware
Both of the Light sensor and OLED display can be driven by I2C interface, but they have different I2C addresses. So they are connected with the same of the Seeeduino XIAO’s I2C interface as slaves. There aren’t any pull-up resistances in Seeeduino XIAO’s Pins, as a matter of fact, the communication might be unstable between Seeeduino XIAO and two slave modules. For stability in the real use, I strongly recommended you to add pull-up resistances at the end of the I2C interfaces. DHT11 temperature sensor and Grove touch module simply connect with the Seeeduino XIAO by digital Pins. The overall hardware connection is really easy. Here is the Pinout of the Seeeduino XIAO.
Step 2: Software
As for the software code, you can find most of the modules getting started codes and libraries from the Seeed Wiki. It is worth to mention that the SSD1315 OLED Display uses the common U8g2 library which is a functional library to display multiple fonts and images. U8g2 library supports many types of OLED screens and a great many fonts libraries. The demo code is available as follows. With the correct connection of jump wires and the code below, you can realize the demo of displaying the sensor values in the SSD1315 OLED display once you touch the touchpad, and the display will be cleared when you leave the touchpad. Due to the tiny size of Seeeduino XIAO, you are able to make it as a wearable environment detector to measure the values of temperature, humidity, and light everywhere you like.