Notifications
Clear all

[Solved] Display 1088AS and Arduino Nano 33 IoT with LoRa

7 Posts
2 Users
2 Likes
280 Views
Farah Haddad
(@fhaddad)
Member
Joined: 4 years ago
Posts: 32
Topic starter  

Hello Forum, 

I successfully built a LoRa project based on Bill’s tutorial, with a transmitter on my balcony and a receiver displaying the temperature readings in the Serial Monitor. However, I'm facing a challenge in connecting a dot matrix LED display to show the readings with time and date. The original project used pins 3, 11, and 13, but these are occupied by my LoRa project. I tried redefining the pins, but it didn't work. Before troubleshooting further, I want to clarify if it’s possible to use different pins for the LED display, or if I need to use the original pins specified in the tutorial. Any insight on this would be appreciated!

#define CLK_PIN   9
#define DATA_PIN  8
#define CS_PIN    10

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

@fhaddad You didn't say what board. Generally speaking there is a lot of flexibility on pin choice unless the board has only one of a certain kind of pin.

What pins are used for the LORA part, and what logical pins does the display need (by logical I mean are they SPI, I2C and so on)

EDIT: Sorry, didn't notice that the topic specified the board. From what I can see, those pins are just digital pins, so you are free to change them to any other digital pin. Stay away from 1 and 2 though.

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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Farah Haddad
(@fhaddad)
Member
Joined: 4 years ago
Posts: 32
Topic starter  

@zander Ron can you please spot any mistake in my code below? 

 

// Include required libraries
#include <SPI.h>
#include <LoRa.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>

#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
#define MAX_DEVICES 4
#define CLK_PIN   9
#define DATA_PIN  8
#define CS_PIN    10
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Define the pins used by the LoRa module
const int csPin = 4;     // LoRa radio chip select
const int resetPin = 2;  // LoRa radio reset
const int irqPin = 3;    // Must be a hardware interrupt pin

void setup() {
  Serial.begin(9600);
  while (!Serial);
  LoRa.setPins(csPin, resetPin, irqPin); // Setup LoRa module
  Serial.println("LoRa Receiver Test");

  // The display code starts here
  myDisplay.begin();
  myDisplay.setIntensity(5);
  myDisplay.displayClear();
  myDisplay.displayScroll("Farah Haddad", PA_CENTER, PA_SCROLL_LEFT, 200);

  // Start LoRa module at local frequency
  // 433E6 for Asia
  // 866E6 for Europe
  // 915E6 for North America
  if (!LoRa.begin(866E6)) {
    Serial.println("Starting LoRa failed!");
    while (1)
      ;
  }
}

void loop() {

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

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

    // Print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
 
  if (myDisplay.displayAnimate()) {
    myDisplay.displayReset();
  }
 
}

   
ReplyQuote
Farah Haddad
(@fhaddad)
Member
Joined: 4 years ago
Posts: 32
Topic starter  

I figured it out; thanks a lot, guys. 


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

@fhaddad OK, but there are two points. First, use the help menu on the right above recent posts to learn how to post code, and please use the Tools/Auto Format before posting.

The second point is this forum is for learning, so just letting us know you fixed it does not help. Post the fix, then mark the topic as solved.

 

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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Farah Haddad
(@fhaddad)
Member
Joined: 4 years ago
Posts: 32
Topic starter  
Hello, Ron. I apologize for any confusion I may have caused. I often feel behind in the forum, so I try to keep my responses concise.
I'm sorry for forgetting to format/post the code in my previous post properly. I will make sure to do so in the future to maintain a clean and organized site.
Regarding the solution, you were correct about defining the new pins for CLK_PIN and DATA_PIN. However, I overlooked adding them to the Parola line, which ultimately resolved the issue. I appreciate your help and support. Thank you!
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

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

@fhaddad OK, no problem, we all need time to learn. If I may add a new lesson for today, use the Reply link so that the person you are talking to is notified. It is at the bottom right of the post you are reading. If it's a short post, feel free to use the Quote link that is right beside the Reply link.

As far as your mistake, that is probably what I would have done, too. At least fixing a booboo and resubmitting the compile is a few seconds or minutes; when I was a newbie, it was from a few hours to overnight, and that is after writing the code on a specially formatted pad and then submitting it to the keypunch pool. It's a miracle we could ever complete those big systems back then (early 70's)

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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote