marlon360 / opcn3-arduino

An Arduino library for the Alphasense OPC-N3 dust sensor. Compatible with NodeMCU, ESP8266.
9 stars 4 forks source link

ESP32 Gives problem with SD Card #2

Open rajeshdoshi opened 2 years ago

rajeshdoshi commented 2 years ago

Hi, I am using this library along with SD Card interfaced to ESP32. Individually both of them work fine. But as soon as they are connected together, both start to malfunction.

I have used different pins for SS.

Thanks..

yash-dahima commented 1 year ago

Hi Rajesh,

Can you please help me with running only OPC with ESP32? I am getting all values 0 except temperature which also is wrong. Below is the code:

include

// create new instance (specify SS pin in constructor) OPCN3 myOPCN3(15);

void setup() {

Serial.begin(9600);

// turn on laser, fan and set high gain myOPCN3.initialize(); delay(1000);

}

void loop() {

delay(10000); HistogramData hist = myOPCN3.readHistogramData();

// Get Temperature Serial.print("Temperature: "); Serial.println(hist.getTempC());

// Get Relative Humidity Serial.print("RH (%): "); Serial.println(hist.getHumidity());

// Get PM values Serial.print("PM 1: "); Serial.println(hist.pm1);

Serial.print("PM 2.5: "); Serial.println(hist.pm2_5);

Serial.print("PM 10: "); Serial.println(hist.pm10);

}

Below is the output on serial monitor in Arduino IDE:

Capture

rajeshdoshi commented 1 year ago

I had similar problem. I did not use it with ESP32. OPC is not using standard SPI. It needs dedicated data pin.  On Monday, September 4, 2023 at 04:03:51 PM GMT+5:30, Yash Dahima @.***> wrote:

Hi Rajesh,

Can you please help me with running only OPC with ESP32? I am getting all values 0 except temperature which also is wrong. Below is the code:

include

// create new instance (specify SS pin in constructor) OPCN3 myOPCN3(15);

void setup() {

Serial.begin(9600);

// turn on laser, fan and set high gain myOPCN3.initialize(); delay(1000);

}

void loop() {

delay(10000); HistogramData hist = myOPCN3.readHistogramData();

// Get Temperature Serial.print("Temperature: "); Serial.println(hist.getTempC());

// Get Relative Humidity Serial.print("RH (%): "); Serial.println(hist.getHumidity());

// Get PM values Serial.print("PM 1: "); Serial.println(hist.pm1);

Serial.print("PM 2.5: "); Serial.println(hist.pm2_5);

Serial.print("PM 10: "); Serial.println(hist.pm10);

}

Below is the output on serial monitor in Arduino IDE:

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yash-dahima commented 1 year ago

Thanks Rajesh for prompt response :)

I'm new to this, so some more explanation will really help. Can you please explain more on "It needs dedicated data pin" and what you mean by standard SPI?

rajeshdoshi commented 1 year ago

I tried to use OPC with ESP32 about 2-3 years back. I found when used with SD Card, it was failing. I am not able to recollect the details right now. Finally I used an 8 bit controller to read OPC and it communicated with ESP32 over serial. 

On Monday, September 4, 2023 at 08:50:22 PM GMT+5:30, Yash Dahima ***@***.***> wrote:  

Thanks Rajesh for prompt response :)

I'm new to this, so some more explanation will really help. Can you please explain more on "It needs dedicated data pin" and what you mean by standard SPI?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yash-dahima commented 1 year ago

Thank you so much Rajesh for clarification! All The Best!