BMP + GPS + EPAPER

ttnnttnn
Posts: 6
Joined: Thu Nov 23, 2023 12:00 pm

BMP + GPS + EPAPER

Postby ttnnttnn » Thu Nov 23, 2023 12:14 pm

Good morning everyone, I need to put together an espressif wroom 32 board with a BMP sensor and a Neo6 GPS and display the data on an e-paper screen. I have the problem that both the GPS and the display have a connection to the pins on RX2 and TX2. Taken individually, both work correctly, but I can't find a way to move one of the two to other pins. Can anyone help me please.

Ton


Code: Select all

/*

   PIN E-PAPER     
   BUSY		D4         
   RES		RX2
   D/C		TX2
   CS		D5
   SCL		22
   SDA		23
   VCC		+3.3
   GND		GND
   
   PIN GPS
   TX		RX2
   RX		TX2
   VCC		+3.3
   GND		GND

*/

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <TinyGPSPlus.h>

#define BMP_SDA 21
#define BMP_SCL 22

TinyGPSPlus gps;

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 296
#define ALTITUDE_SEA_LEVEL 1013.25 // Imposta il livello del mare in hPa

Adafruit_BMP280 bmp; // Oggetto BMP280
GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0290BS 128x296, SSD1680

void setup() {

  Serial.begin(115200);
  Serial2.begin(115200);
  delay(100);

  if (!bmp.begin()) {
    Serial.println("Impossibile trovare il sensore BMP280. Verifica le connessioni!");
    while (1);
  }

  display.init(115200);
  display.setRotation(1);
}

void loop() {
  
  float temperature = bmp.readTemperature();
  float pressure = bmp.readPressure() / 100.0F; // Converti la pressione in hPa
  float altitude = bmp.readAltitude(ALTITUDE_SEA_LEVEL);

  display.clearScreen();
  display.fillScreen(GxEPD_WHITE);
  display.setFont(&FreeMonoBold9pt7b);
  display.setTextColor(GxEPD_BLACK);
  display.setCursor(0, 30);
  display.print("Altitudine:");
  display.setCursor(0, 60);
  display.print(gps.altitude.meters(), 0);
  display.print(" m");

  display.display();

  delay(1000);


}

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

Re: BMP + GPS + EPAPER

Postby bidrohini » Thu Nov 23, 2023 2:12 pm

I think you can use USART1 and USART2 for your two different USART devices. There had been a previous discussion regrading this multiple USART issue. You can find that here: https://esp32.com/viewtopic.php?t=6715

By the way, if you are thinking of making a weather forecaster using ESP32 and BMP280, you can look at this design:

https://www.pcbway.com/project/sharepro ... 911bf.html

ttnnttnn
Posts: 6
Joined: Thu Nov 23, 2023 12:00 pm

Re: BMP + GPS + EPAPER

Postby ttnnttnn » Fri Nov 24, 2023 7:08 am

Tanks I try !!

Who is online

Users browsing this forum: No registered users and 279 guests