Help conecting LoRa R02 and TFT 1.8 SPI

Hello,

I have a project where I need readings from a LoRa ra-02 to another one, both connected to Arduino Nanos.

I successfully connected both LoRas but I am struggling to have readings in my TFT 1.8 display.from my BMP 180 which is reading altitude.

Here is my schematic:

Basically I have both SPI's sharing MISO, MOSI, etc only CS is different for both which I assigned 4.

TFT1.8

LED ->3.3
SCK ->13
SDA ->11
A0 -> 8
RESET ->9
CS -> 4
GND -> GND
VCC -> +5

LoRa2

GND ->GND
NSS ->10
MOSI ->11
MISO ->12
SCK -> 13
3.3 -> +3.3
RST ->9
DI00 -> 2

Provide a usual wring diagram. I don't read Your text and create it.
Power supply, its datasheet, is missing. Too often pwr supply makes trouble.....

Are you connecting the 3.3V RA-02 LoRa device to the 5V Nano with suitable logic level conversion ?

The 3V3 pin on Nano can supply only a small current. It comes from a regulator built in to the usb-serial adaptor chip, not a dedicated regulator like on some other Arduino. It can provide enough current for one or two low power sensors. It can’t provide enough current to power a LoRa module or the backlight of an LCD display, which need much larger currents, especially when the LoRa module is transmitting.

Your question is completely inadequate for us to help much further. No schematic, code or links to actual components used. Please read the forum guide in the sticky post, especially the later parts, for advice.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

Thank you all for your answers,

Railroader:
Provide a usual wring diagram. I don't read Your text and create it.
Power supply, its datasheet, is missing. Too often pwr supply makes trouble.....

I am attaching pictures of my wiring, let me know if you want a close up of something.
I am using a external power supply with a 9V battery.

srnet:
Are you connecting the 3.3V RA-02 LoRa device to the 5V Nano with suitable logic level conversion ?

I got them working withtout a level conversion ie, both nanos sending and receiving with the LoRa, my feel is that the problem is related in how I did the wiring between the LoRa and my TFT 1.8, since both transcivers are sending a receiving no problem in my serial terminal

PaulRB:
The 3V3 pin on Nano can supply only a small current. It comes from a regulator built in to the usb-serial adaptor chip, not a dedicated regulator like on some other Arduino. It can provide enough current for one or two low power sensors. It can't provide enough current to power a LoRa module or the backlight of an LCD display, which need much larger currents, especially when the LoRa module is transmitting.

Indeed, I am using am external power supply as you can see, I got my background led light to work and LoRa receiveing no prolblems but only in my serial terminal.

TomGeorge:
Hi,
Welcome to the forum.

Thanks Tom! sorry my sloppy post, I will get better eventually.

Thanks again all for your great help!

I also will post my code below

eduardo2020:
I have a project where I need readings from a LoRa ra-02 to another one, both connected to Arduino Nanos.

I successfully connected both LoRas but I am struggling to have readings in my TFT 1.8 display.

Did you explain what 'struggling to have readings' actually means ?

Did I miss a description of the actual problem ?

srnet:
Did you explain what ‘struggling to have readings’ actually means ?

Did I miss a description of the actual problem ?

Sorry for the confusion, I do have readings in my serial terminal. I do not have readings in my TFT 1.8 display which is the problem.

Below my code for further information:

Sender

#include <Wire.h>
#include <SFE_BMP180.h>
#include <SPI.h>
#include <LoRa.h>

SFE_BMP180 pressure;

double baseline; // baseline pressure

//--------------------------------------

String currentFloor;
float Elevation1;
const unsigned long period = 10000;

//---------------------------------------

int inputPin = 3;      // choose the input pin (for PIR sensor)
int pirState = LOW;    // we start, assuming no motion detected
int val      = 0;      // variable for reading the pin status
unsigned long periodlowPIR;
int periodPIR = 5000;

//---------------------------------------

void setup() {

  Serial.begin(9600);

  //-----------------------------

  Serial.begin(9600);
  while (!Serial);

  Serial.println("LoRa Sender");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  //-----------------------------


  Serial.println("REBOOT");

  // Initialize the sensor (it is important to get calibration values stored on the device).

  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail (disconnected?)\n\n");
    while(1); // Pause forever.
  }

  
  // Get the baseline pressure:
  
  baseline = getPressure();
  
  Serial.print("baseline pressure: ");
  Serial.print(baseline);
  Serial.println(" mb");  
}

void loop() {

  double a,P;
  
  // Get a new pressure reading:

  P = getPressure();

  // Show the relative altitude difference between
  // the new reading and the baseline reading:

  a = pressure.altitude(P,baseline);
  
  Serial.print("relative altitude: ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a,1);
  Serial.print(" meters, ");


  //-------------------------

  Elevation1 = a;
  Serial.println(Elevation1);



  if ((Elevation1 <= -16.5 ) )

  {
    currentFloor = "S2";
  }
  else if ((Elevation1 <= -14.5 ) && (Elevation1 > -16.5))

  {
    currentFloor = "S1";
  }
  else if ((Elevation1 <=-10  ) && (Elevation1 > -14.5))

  {
    currentFloor = "RC";
  }
  else if ((Elevation1 <= -6.5 ) && (Elevation1 > -10))

  {
    currentFloor = "02";
  }
  else if ((Elevation1 <=-4  ) && (Elevation1 > -6.5))

  {
    currentFloor = "03";
  }
  else if ((Elevation1 <= -2 ) && (Elevation1 > -4))

  {
    currentFloor = "04";
  }
  else if ((Elevation1 <=2) && (Elevation1 > -2))

  {
    currentFloor = "05";
  }

  else if ( (Elevation1 > 2))

  {
    currentFloor = "06";
  }
  
  Serial.print("Current floor is : ");
  Serial.println(currentFloor);

  //-------------------------------------------------

  String elevator_state;

  val = digitalRead(inputPin);  // read input value

  if (val == HIGH) {            // check if the input is HIGH

    if (pirState == LOW) {
      // we have just turned on
      Serial.println("BUSY!");
      elevator_state = "BUSY!";
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {

    if (pirState == HIGH) {
      // we have just turned off
      Serial.println("DETECTION END!");
      elevator_state = "WAIT!";
      // We only want to print on the output change, not state
      pirState = LOW;
      periodlowPIR = millis();
    }
  }

  if (!pirState && (millis() - periodlowPIR > period)) {

    Serial.println("EMPTY");
    elevator_state = "EMPTY";

  }

 //-----------------------------------
Serial.print("Current Floor from Lora: ");
  Serial.println(currentFloor);

  // send packet current Floor
  LoRa.beginPacket();
  LoRa.print(currentFloor);
  LoRa.endPacket();

/*
  Serial.print("Elevator state: ");
  Serial.println(elevator_state);

  LoRa.beginPacket();
  LoRa.print(elevator_state);
  LoRa.endPacket();
*/

  delay(3000);
  
//--------------------------------------
  
}

double getPressure()
{
  char status;
  double T,P,p0,a;

  // You must first get a temperature measurement to perform a pressure reading.
  
  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:

    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Use '&T' to provide the address of T to the function.
    // Function returns 1 if successful, 0 if failure.

    status = pressure.getTemperature(T);
    if (status != 0)
    {
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(2);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Use '&P' to provide the address of P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P,T);
        if (status != 0)
        {
          return(P);
        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");
}

Pictures are no good. They can never tell the same as a wiring diagram.

Receiver

#include <SPI.h>
#include <LoRa.h>


//--------------------------------------

#include "Ucglib.h"  // Include Ucglib library to drive the display


// Create display and define the pins:
Ucglib_ST7735_18x128x160_HWSPI ucg(8, 4, 9);  // (A0=8, CS=10, RESET=9)
// The rest of the pins are pre-selected as the default hardware SPI for Arduino Uno (SCK=13 and SDA=11)


//---------------------------------------

void setup() {

  Serial.begin(9600);

  //-----------------------------

  ucg.begin(UCG_FONT_MODE_SOLID);  // It writes a background for the text. This is the recommended option
  ucg.clearScreen();  // Clear the screen
  ucg.setRotate180();  // Put 90, 180 or 270, or comment to leave default
  ucg.setFont(ucg_font_inb21_mr);


  ucg.setColor(0, 255, 255, 255);  // Set color (0,R,G,B)
  ucg.setColor(1, 0, 0, 0);  // Set color of text background (1,R,G,B)
  ucg.setPrintPos(0, 24); // Set position (x,y)
  ucg.print("Floor :");  // Print text or value


  // Draw rounded rectangle:
  ucg.setColor(0, 255, 255);  // Set color (0,R,G,B)
  ucg.drawRFrame(0, 35, 65, 40, 8);  // Start from top-left pixel (x,y,wigth,height,radius)


  // Draw horizontal line:
  ucg.setColor(255, 255, 255);  // Set color (0,R,G,B)
  ucg.drawHLine(0, 80, 128);  // Start from left pixel (x,y,lenght)


  ucg.setColor(0, 255, 0, 0);  // Set color (0,R,G,B)
  ucg.setColor(1, 0, 0, 0);  // Set color of text background (1,R,G,B)
  ucg.setPrintPos(0, 105); // Set position (x,y)
  ucg.print("Status :");  // Print text or value

}

void loop() {


  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }

  
  //--------------------------------------


  ucg.setFont(ucg_font_inb24_mr);  // Set font
  ucg.setColor(0, 255, 255, 0);  // Set color (0,R,G,B)
  ucg.setColor(1, 0, 0, 0);  // Set color of text background (1,R,G,B)
  ucg.setPrintPos(9, 67); // Set position (x,y)
  ucg.print(LoRa.read());  // Print text or value




  ucg.setFont(ucg_font_inb24_mr);  // Set font
  ucg.setColor(0, 255, 255, 0);  // Set color (0,R,G,B)
  ucg.setColor(1, 0, 0, 0);  // Set color of text background (1,R,G,B)
  ucg.setPrintPos(9, 145); // Set position (x,y)
  //ucg.print(elevator_state);
  //ucg.print(a);

  //--------------------------------------


  

  delay(3000);
}

//--------------------------------------------

Please understand that whilst you might know what 'I do not have readings in my TFT 1.8 display which is the problem' actually means;

The forum does not have a clue what you are on about as most of us volunteers cannot afford crystal balls.

srnet:
The forum cannot afford crystal balls.

I'll tell You that money is not the only issue. It takes lots of practicing and skills to read a chrystal ball and get its message. I've been trying it but not for questions like this.

srnet:
Please understand that whilst you might know what 'I do not have readings in my TFT 1.8 display which is the problem' actually means;

The forum does not have a clue what you are on about as most of us volunteers cannot afford crystal balls.

I guess patience is not your virtue, if I did not formulate well the post, there is no reason for kindergarden lessons with ironic metaphors. I would be glad to clarify my post titled ''Help conecting LoRa R02 and TFT 1.8 SPI'' or provide as much information as I did above, also there is a limit of of characteres in each post, at least for me as a newbie, so I cannot post as much as I want.

So If you have no clue that does not mean that others might have ''some clue''

Railroader:
I'll tell You that money is not the only issue. It takes lots of practicing and skills to read a chrystal ball and get its message. I've been trying it but not for questions like this.

Thanks for trying and if you are exhausted to ask for information and or read questions like this, then you should probably take some vacation, once you are back you will see that for the next post titled I cannot power my arduino with my single 1.5V battery will take you more relaxed :slight_smile: .