I am creating a project using arduino nano, ESP8266 and DPS310 sensor. I uploaded the code for the same but the serial monitor wasn't displaying

I uploaded the code to the arduino but the serial monitor is not displaying anything. Please help.
this is my code:

#include <Dps310.h>

// Dps310 Opject
Dps310 Dps310PressureSensor = Dps310();

void setup()
{
Serial.begin(9600);
while (!Serial);

//Call begin to initialize Dps310PressureSensor
//The parameter 0x76 is the bus address. The default address is 0x77 and does not need to be given.
//Dps310PressureSensor.begin(Wire, 0x76);
//Use the commented line below instead of the one above to use the default I2C address.
//if you are using the Pressure 3 click Board, you need 0x76
Dps310PressureSensor.begin(Wire);

Serial.println("Init complete!");
}

void loop()
{
float temperature;
float pressure;
uint8_t oversampling = 7;
int16_t ret;
Serial.println();

//lets the Dps310 perform a Single temperature measurement with the last (or standard) configuration
//The result will be written to the paramerter temperature
//ret = Dps310PressureSensor.measureTempOnce(temperature);
//the commented line below does exactly the same as the one above, but you can also config the precision
//oversampling can be a value from 0 to 7
//the Dps 310 will perform 2^oversampling internal temperature measurements and combine them to one result with higher precision
//measurements with higher precision take more time, consult datasheet for more information
ret = Dps310PressureSensor.measureTempOnce(temperature, oversampling);

if (ret != 0)
{
//Something went wrong.
//Look at the library code for more information about return codes
Serial.print("FAIL! ret = ");
Serial.println(ret);
}
else
{
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" degrees of Celsius");
}

//Pressure measurement behaves like temperature measurement
//ret = Dps310PressureSensor.measurePressureOnce(pressure);
ret = Dps310PressureSensor.measurePressureOnce(pressure, oversampling);
if (ret != 0)
{
//Something went wrong.
//Look at the library code for more information about return codes
Serial.print("FAIL! ret = ");
Serial.println(ret);
}
else
{
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" Pascal");
}

//Wait some time
delay(500);
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

You say that you are using a Nano and an ESP8266. How are they connected ?


this is how they are connected. But i haven't connected the battery yet

any particular reason to use a nano?
as the pressure sensor uses I2C connect it directly to the ESP-01

Just be aware that a classic Nano needs 7-12V on Vin; your 3.7V will not do the job.

Hi! Welcome to the Forum.

I think you should take a look in this topic to see a previous discussion and some suggestions about this project (although it seems that the other OP has another idea about how it works).

The circuit doesn´t show how the sensor is fed. Only GND is connected...

3.7V is not enough to feed a Nano through the Vin pin. You need at least 7V.

okay thankyou, i'll take a look at it. But why is my serial monitor not displaying anything, can u please help me with that.

Is your serial monitor set at 9600 bauds?
Does your code compile? Was it correctly uploaded to the Nano?
Did you test any other code that uses Serial Monitor with this Nano before?
Can you share pictures of your actual circuit?

Have you fixed the supply voltage to the Nano first?

Tom... :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.