Notifications
Clear all

Programing PMSA003I + BME688 in ESP32 I2C

8 Posts
4 Users
0 Likes
449 Views
(@jaz939)
Member
Joined: 7 months ago
Posts: 13
Topic starter  

Hi guys,

I'm nooby in Arduino, but I would like to extend my knowledge in the area.

My goal is to have Air Quality system for my CNC room. My controller is ESP32. I want to connect two sensors: PMSA0003I and BME688 and connect it with I2C. My sensor libraries are Adafruit_PM25AQI and bsec.

When I'm running both sensors separately (using examples from the library), this works, but I don't know how to use both together.

Additionally to this, I would like to integrate NEXTION NX4024T032 display and relay for regulating the air ventilator. In the program, I should have the possibility to manually start the ventilator. 

 


   
Quote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@jaz939

Welcome to the forum.

Running both together shouldn't be a problem as long as they have different I2S addresses. To combine them into one sketch just start with a working sketch for either one of them and copy the relevant sections from the other sketch.

This means including the library, copying any declarations, copying any setup() commands required to properly initialize the device and copying to loop() any commands to read the device and print the result. If either/both have timing considerations (i.e. needs 2 seconds between readings, etc) then use the longer of the two periods. 

If you have problems, just select an appropriate forum and ask specific questions therein.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@jaz939)
Member
Joined: 7 months ago
Posts: 13
Topic starter  

Hi

I have tried to do so but I get an error that I can't use two databases. Are there any tutorials that can help me understand how to connect a multi-I2C device to one void routine?

Also, I have difficulty uploading the program or errors.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@jaz939 Sorry, but you will need to use language that is standard so we can understand. I suspect you meant LIBRARY not DB. Please clarify.

I see two errors you are encountering.

The first is a compile error and the second is an upload error. If you can't compile, you can't upload.

If you would give us a link to the code you are using we can try to compile it and help you fix any errors.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@jaz939)
Member
Joined: 7 months ago
Posts: 13
Topic starter  

Hi,

sorry for this let me first upload the error messages:

AirQualityV1.ino: In function 'void loop()':
AirQualityV1.ino:120:14: error: conflicting declaration 'bme68xData data'
bme68xData data;
^~~~
AirQualityV1.ino:90:17: note: previous declaration as 'PM25_AQI_Data data'
PM25_AQI_Data data;
^~~~
AirQualityV1.ino:127:19: error: no matching function for call to 'Bme68x::getData(PM25_AQI_Data&)'
bme.getData(data);
^
In file included from AirQualityV1.ino:14:
clibraries\BME68x_Sensor_library\src/bme68xLibrary.h:297:13: note: candidate: 'uint8_t Bme68x::getData(bme68xData&)'
uint8_t getData(bme68xData &data);
^~~~~~~
libraries\BME68x_Sensor_library\src/bme68xLibrary.h:297:13: note: no known conversion for argument 1 from 'PM25_AQI_Data' {aka 'PMSAQIdata'} to 'bme68xData&' {aka 'bme68x_data&'}
AirQualityV1.ino:129:38: error: 'PM25_AQI_Data' {aka 'struct PMSAQIdata'} has no member named 'temperature'
Serial.print("Temp: "+ String(data.temperature) + "°C, ");
^~~~~~~~~~~
AirQualityV1.ino:130:42: error: 'PM25_AQI_Data' {aka 'struct PMSAQIdata'} has no member named 'pressure'
Serial.print("Pressure: "+ String(data.pressure) + "Pa, ");
^~~~~~~~
AirQualityV1.ino:131:42: error: 'PM25_AQI_Data' {aka 'struct PMSAQIdata'} has no member named 'humidity'
Serial.print("Humidity: "+ String(data.humidity) + "%, ");
^~~~~~~~
AirQualityV1.ino:132:37: error: 'PM25_AQI_Data' {aka 'struct PMSAQIdata'} has no member named 'gas_resistance'
Serial.print("Gas: "+ String(data.gas_resistance) + "ohm, ");
^~~~~~~~~~~~~~
AirQualityV1.ino:133:23: error: 'PM25_AQI_Data' {aka 'struct PMSAQIdata'} has no member named 'status'
Serial.println(data.status, HEX);
^~~~~~

exit status 1

Compilation error: conflicting declaration 'bme68xData data'

 

My issue is how to set the Arduino program to read first PMSA and then BME688 sensor.

BR

Roman


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7076
 

@jaz939 There are a bunch of errors there. They are all fairly simple and easy to fix. Without the source code I can't help.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1709
 

Hi @jaz939,

  These are typical error messages, which you will begin to recognise with experience, but are reallly confusing when you start.

First, please recognise that this part of the forum is under'Arduino',

image

which has the introduction

Arduino 

Wiring and Sketches for the Arduino family and ATmega series of microcontrollers.

As your problem is about ESP32 and two sensors, please spend a few moments looking at the overall structure to the forums as a whole, and find a part that is aimed at providing space for forum members to discuss these devices. It should be obvious that this helps others find a part of interest to them, without being overloaded with other stuff.

Then, as @will suggested in his reply above, start a new thread with some more information, in a more appropriate place within the overall forum website.

In the new thread, I suggest you post your present programme listing, together with your question(s). Please be careful how you do this. There are links to instructions towards the top right of each forum page, under "Help Forum Menu" title.

When you think you have composed your new message, BUT BEFORE HITTING ADD REPLY, find the 'extra' choices of "Preview" "Revisions" and, "Save Draft" or "Saved", which are just below and to the left of the ADD REPLY button.

If it says "Save Draft", click it (if it says "Saved" then it has done it automatically).

When it says "Saved", click "Preview"

You will then see a preview of what your message will look like, when you post it. At this point  you can edit your original version, repeat the "Save Draft" and "Preview" presses, and continue, until it looks right.

In particular, check your code listing. If it looks like your error message listing above, it needs replacing. It should be in a neat 'box', maybe something like:

; some good code
int answer = 42;

And please make sure the code does NOT have line numbers.

Sorry about all the preaching, but you are asking someone to point out the problems, and it helps and encourages them if they can do a simple copy and paste into their machine.

When you are satisfied with the result, click ADD REPLY.

Then whilst you are waiting and hoping for a positive reply, have a final extra glance at your post. You have about an hour whilst you can still re-edit the post ... it is amazing how typos can suddenly appear just after you post!! (While it is to me, anyway)

Best wishes, Dave


   
ReplyQuote
(@jaz939)
Member
Joined: 7 months ago
Posts: 13
Topic starter  

Hi guys,

thanks for all advice. I will do as you are instructed. When I will have new topic set at right spot I will let you know the link on this topic. Give me some time to compose it.

BR

Roman


   
ReplyQuote