We will continue setting the hardware, we will talk about the environmental sensors and the display. We had available the DHT11 sensors, the popular temperature and humidity sensor, the MQ135 Air Quality Meter, the MQ7 CO sensor and the sensor supplied by Infineon DPS368 Pressure Shield2go that allows us to measure Barometric Pressure and also allows us to read temperature, and finally we add an LDR to obtain the luminosity data in the environment.
The MQ7, MQ135 and LDR sensors are analog output sensors in this case we take advantage of the Analog In pins of the XMC4700. We made the signal captures with a resolution of 12 Bits.
The DHT11 sensor sends the data through a serial communication that is supported by its own library "DHT.h"
The DPS338 sensor uses I2C communication and we have the library supplied by Infineon <Dps368.h>
Although we can see all the data through the serial port of the PC. I also wanted to add a screen to the project and conveniently had an LCD2004 Display that had previously been added by the Backpack PCF8574ATPCF8574AT with I2C communication.
To prototype use a Datalogger Shield (we will not use the Dataloger block for now) we only make the connections with headers to the sensors.
We connect the inputs of the board to the outputs of the analog sensors like this:
MQ7 pin AO
MQ135 pin A1
LDR pin A2
DHT11 pin 2
DSP368 I2C (A4, A5)
LCD2004 display (A4, A5)
Taking great care to supply each device with the correct voltage (MQ7, MQ135, DHT11 and LCD to the 5 Vdc source)
LDR sensor and DSP368 sensor to 3.3 Vdc source.
As I mentioned in Blog # 2 You have to link some libraries manually to use the Visual Studio Code editor. (From my own experience, I didn’t use Platformio because when using it, I found it more complex and gave me certain headaches in other projects).
Now I explain how to take advantage of VSC resources even if it is not fully supported. As some libraries do not appear the Arduino Library Manager, (although we have previously installed them). There is a way to link them manually, and this is by copying the path of the "library.h" in the file c_cpp_properties.json inside the "includedPath"
As I show you with the DPS368 Pressure Shield2go sensor library that we previously downloaded from the link bellow:
https://github.com/Infineon/DPS368-Library-Arduino
This is how it’s done with each of the project's libraries:
DHT sensor library (Adafruit supported library)
LiquidCrystal_I2C (library supported by DFRobot)
Then we also add the compiler path of c/cpp which in my case by default the Microsoft Visual Studio compiler, I preferred to use Ming-w64 following the instructions on the link below:
https://code.visualstudio.com/docs/cpp/config-mingw
I make sure to adjust the cStandard c11 and cppStandard c ++ 17 and the intelliSenseMode gcc-x64
Having ready the hardware connections and our Visual Studio Code IDE, with the Arduino extension, Linked Libraries, c/cpp compiler, J-Link Programmer. All in order. At this point we are ready to focus on the code of our project application.
In the next Blogs we will explain the code...