The first thing we did was read the documentation a bit and verify what are the options to implement external sensors and actuators of the M5Stack.
Port A consists of an I2C connection (including the 5 VDC power supply), care must be taken as there are some sensors that work with 3.3 VDC voltages. In this port we will connect the atmospheric pressure sensor BMP280 and the very versatile ADS1115 which is a digital analog converter with 4 inputs to 16 sampling bits.
General purpose port B has GPIO26 and GPIO36. Which we will use as the digital inputs for the DHT11 sensor and the PIR sensor.
I made my own port extension cables with electronic recycling.
My project I preferred to develop with Visual Studio Code and the Arduino extension. For the sensors I basically used all the Adafruit libraries and the ones supplied by M5Stack Core2.
I concentrated on the ADC converter since I would connect an LDR to measure the brightness in this module and I would also connect my MQ135 sensor to measure the air quality. With the option to expand the project, two ADC channels became available for later use.
I was testing each of the stages and adding them in the project.
Apart from the serial monitor visualization I wanted to use the included screen and also took advantage of using the GRB LEDs based on SK6812 that are included.