Problema functionare LoRa cu Arduino Nano si Wemos d1 mini
Last Updated: Jul 25 2022 14:16, Started by
vladuzz7
, Jul 23 2022 21:11
·
0
#19
Posted 24 July 2022 - 14:48
Tocanita-i cu de toate... Ai vrea sa aiba 1wire cu i2c si spi si sa-ntrebe de unde ia temperatura, din umiditate sau din presiune?
|
#20
Posted 24 July 2022 - 15:00
Peerless, on 24 iulie 2022 - 06:59, said: In al doilea rand tu ai definitia pinilor si la tx si la rx pentru WICED nu pentru nano si wemos. radu103, on 24 iulie 2022 - 14:42, said:
Senzor I2C ii mai trebuia acum ca sa fie tocanitza completa momentan ma interesa sa vad macar un hello world intre cele 2 module, restul oi vedea eu cum le adaptez pana la urma |
#21
Posted 24 July 2022 - 15:06
Da. Pinii aia cs, irq si rst ii poti asigna la aproape orice dio. Restul interfetei spi pune-o asa cum e pe pinout-ul fiecarei placi de dezvoltare. Intr-un fel e la nano, altfel e la d1.
Edited by Peerless, 24 July 2022 - 15:12. |
#22
Posted 24 July 2022 - 15:16
Peerless, on 24 iulie 2022 - 15:06, said:
Da. Pinii aia cs, irq si rst ii poti asigna la aproape orice dio. Restul interfetei spi pune-o asa cum e pe pinout-ul fiecarei placi de dezvoltare. Intr-un fel e la nano, altfel e la d1. |
#23
Posted 24 July 2022 - 15:41
Modulule astea pe care le folosesti tu n-au vointa proprie. Nu modulul a reusit, iar daca nu merge tu n-ai reusit. Ia-ti nrf24, e de 10 ori mai ieftin si n-o sa mai faci confuzie cu lora. Iti trimit maine un exemplu de comunicatie intre doua nrf-uri, cu senzori.
|
#24
Posted 24 July 2022 - 15:59
radu103, on 24 iulie 2022 - 02:44, said:
PS: la licenta am prezentat cu breadboard un tracker GPS integrat cu Google Earth acum 15 ani, forma nu conteaza/impresioneaza prea mult. Rezultatul e important, munca si unicitatea implementarii, problemele intampinate, lucrurile invatate din experienta "facerii"..acolo se duc intrebarile comisiei |
#25
Posted 24 July 2022 - 16:15
Peerless, on 24 iulie 2022 - 15:41, said:
Modulule astea pe care le folosesti tu n-au vointa proprie. Nu modulul a reusit, iar daca nu merge tu n-ai reusit. Ia-ti nrf24, e de 10 ori mai ieftin si n-o sa mai faci confuzie cu lora. Iti trimit maine un exemplu de comunicatie intre doua nrf-uri, cu senzori. Na..am pus define la pinii aia, acum e diferit, imi da mesajul din poza. Am conectat modulul si la sursa de tensiune externa Totusi , " extra" as vrea sa le fac sa mearga Attached FilesEdited by vladuzz7, 24 July 2022 - 16:29. |
#26
Posted 24 July 2022 - 17:00
ps: am reusit sa il fac sa initializee..dar tot nu comunica intre ele
|
#27
Posted 24 July 2022 - 17:28
da reset la watchdog timer
Attached FilesEdited by vladuzz7, 24 July 2022 - 17:28. |
#28
Posted 24 July 2022 - 17:45
// rf69 demo tx rx.pde // -*- mode: C++ -*- // Example sketch showing how to create a simple messageing client // with the RH_RF69 class. RH_RF69 class does not provide for addressing or // reliability, so you should only use RH_RF69 if you do not need the higher // level messaging abilities. // It is designed to work with the other example rf69_server. // Demonstrates the use of AES encryption, setting the frequency and modem // configuration #include <SPI.h> #include <RH_RF69.h> /************ Radio Setup ***************/ // Change to 434.0 or other frequency, must match RX's freq! #define RF69_FREQ 433.0 #define RFM69_RST D8 // "A" #define RFM69_CS D2 // "B" #define RFM69_IRQ D3 // "C" #define RFM69_IRQN RFM69_IRQ #define LED D0 // Singleton instance of the radio driver RH_RF69 rf69(RFM69_CS, RFM69_IRQ); int16_t packetnum = 0; // packet counter, we increment per xmission void setup() { Serial.begin(9600); //while (!Serial) { delay(1); } // wait until serial console is open, remove if not tethered to computer pinMode(LED, OUTPUT); pinMode(RFM69_RST, OUTPUT); digitalWrite(RFM69_RST, LOW); Serial.println("Feather RFM69 RX Test!"); Serial.println(); // manual reset digitalWrite(RFM69_RST, HIGH); delay(10); digitalWrite(RFM69_RST, LOW); delay(10); if (!rf69.init()) { Serial.println("RFM69 radio init failed"); while (1); } Serial.println("RFM69 radio init OK!"); // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module) // No encryption if (!rf69.setFrequency(RF69_FREQ)) { Serial.println("setFrequency failed"); } // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the // ishighpowermodule flag set like this: rf69.setTxPower(20, true); // range from 14-20 for power, 2nd arg must be true for 69HCW // The encryption key has to be the same as the one in the server uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; rf69.setEncryptionKey(key); pinMode(LED, OUTPUT); Serial.print("RFM69 radio @"); Serial.print((int)RF69_FREQ); Serial.println(" MHz"); } void loop() { if (rf69.available()) { // Should be a message for us now uint8_t buf[RH_RF69_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf); if (rf69.recv(buf, &len)) { if (!len) return; buf[len] = 0; Serial.print("Received ["); Serial.print(len); Serial.print("]: "); Serial.println((char*)buf); Serial.print("RSSI: "); Serial.println(rf69.lastRssi(), DEC); if (strstr((char *)buf, "Hello World")) { // Send a reply! uint8_t data[] = "And hello back to you"; rf69.send(data, sizeof(data)); rf69.waitPacketSent(); Serial.println("Sent a reply"); } } else { Serial.println("Receive failed"); } } } void Blink(byte PIN, byte DELAY_MS, byte loops) { for (byte i=0; i<loops; i++) { digitalWrite(PIN,HIGH); delay(DELAY_MS); digitalWrite(PIN,LOW); delay(DELAY_MS); } } |
|
#29
Posted 24 July 2022 - 18:52
Cum sunt legati restul pinilor?
Iti da reset continuu ca pare ok initializarea? Care-i codul pt tx? |
#30
Posted 24 July 2022 - 19:43
Peerless, on 24 iulie 2022 - 18:52, said:
Cum sunt legati restul pinilor? Iti da reset continuu ca pare ok initializarea? Care-i codul pt tx? // rf69 demo tx rx.pde // -*- mode: C++ -*- // Example sketch showing how to create a simple messageing client // with the RH_RF69 class. RH_RF69 class does not provide for addressing or // reliability, so you should only use RH_RF69 if you do not need the higher // level messaging abilities. // It is designed to work with the other example rf69_server. // Demonstrates the use of AES encryption, setting the frequency and modem // configuration #include <SPI.h> #include <RH_RF69.h> /************ Radio Setup ***************/ // Change to 434.0 or other frequency, must match RX's freq! #define RF69_FREQ 433.0 #define RFM69_INT 3 // #define RFM69_CS 4 // #define RFM69_RST 2 // "A" #define LED 13 /* Teensy 3.x w/wing #define RFM69_RST 9 // "A" #define RFM69_CS 10 // "B" #define RFM69_IRQ 4 // "C" #define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ ) */ /* WICED Feather w/wing #define RFM69_RST PA4 // "A" #define RFM69_CS PB4 // "B" #define RFM69_IRQ PA15 // "C" #define RFM69_IRQN RFM69_IRQ */ // Singleton instance of the radio driver RH_RF69 rf69(RFM69_CS, RFM69_INT); int16_t packetnum = 0; // packet counter, we increment per xmission void setup() { Serial.begin(9600); //while (!Serial) { delay(1); } // wait until serial console is open, remove if not tethered to computer pinMode(LED, OUTPUT); pinMode(RFM69_RST, OUTPUT); digitalWrite(RFM69_RST, LOW); Serial.println("Feather RFM69 TX Test!"); Serial.println(); // manual reset digitalWrite(RFM69_RST, HIGH); delay(10); digitalWrite(RFM69_RST, LOW); delay(10); if (!rf69.init()) { Serial.println("RFM69 radio init failed"); while (1); } Serial.println("RFM69 radio init OK!"); // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module) // No encryption if (!rf69.setFrequency(RF69_FREQ)) { Serial.println("setFrequency failed"); } // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the // ishighpowermodule flag set like this: rf69.setTxPower(20, true); // range from 14-20 for power, 2nd arg must be true for 69HCW // The encryption key has to be the same as the one in the server uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; rf69.setEncryptionKey(key); pinMode(LED, OUTPUT); Serial.print("RFM69 radio @"); Serial.print((int)RF69_FREQ); Serial.println(" MHz"); } void loop() { delay(1000); // Wait 1 second between transmits, could also 'sleep' here! char radiopacket[20] = "Hello World #"; itoa(packetnum++, radiopacket+13, 10); Serial.print("Sending "); Serial.println(radiopacket); // Send a message! rf69.send((uint8_t *)radiopacket, strlen(radiopacket)); rf69.waitPacketSent(); // Now wait for a reply uint8_t buf[RH_RF69_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf); if (rf69.waitAvailableTimeout(500)) { // Should be a reply message for us now if (rf69.recv(buf, &len)) { Serial.print("Got a reply: "); Serial.println((char*)buf); Blink(LED, 50, 3); //blink LED 3 times, 50ms between blinks } else { Serial.println("Receive failed"); } } else { Serial.println("No reply, is another RFM69 listening?"); } } void Blink(byte PIN, byte DELAY_MS, byte loops) { for (byte i=0; i<loops; i++) { digitalWrite(PIN,HIGH); delay(DELAY_MS); digitalWrite(PIN,LOW); delay(DELAY_MS); } } la Wemos sunt asa, pe langa cei din cod: clock-ul la D5, MISO la D6, MOSI la D7. O tot tine in mesajul ala cu watchdog timer, dupa care zice ca e ok si tot asa, dar ar trebui sa zica, ca trimite mesaj si ca primeste sau nu de la TX Edited by vladuzz7, 24 July 2022 - 19:44. |
#31
Posted 24 July 2022 - 22:12
wdt reset is normally caused by some process in the loop taking too much time like something waiting for the nRF24l01 before proceeding.
On the esp8266 it is important that the wifi underlying processes get a chance to execute. This happens naturally once per loop or you can explicitly put small delay or yield functions in the loop. Am incercat sa fac asta, dar tot nu merge. de fapt nu stiu exact unde sa o pun, ca nu am decat loop-ul cel mare si atat |
#32
Posted 25 July 2022 - 12:33
Uite o varianta de transmitator cu NRF24L, Arduino nano si sht30 ca senzor de umiditate si temperatura:
// Include RadioHead ReliableDatagram & NRF24 Libraries #include <RHReliableDatagram.h> #include <RH_NRF24.h> #include <WEMOS_SHT3X.h> //Create an instance of SHT30 sensor //Vcc->3.3V //Gnd->Gnd //SCL->A5 //SDA->A4 SHT3X sht30(0x45); // Define addresses for radio channels #define CLIENT_ADDRESS 1 #define SERVER_ADDRESS 2 // Create an instance of the radio driver //Vcc-> 3.3V //Gnd->Gnd //SCK->13, MISO->12, MOSI->11 //CE->9, CSN->10 RH_NRF24 RadioDriver(D2, D8); RH_NRF24 RadioDriver(9, 10); // Sets the radio driver to NRF24 and the server address to 2 RHReliableDatagram RadioManager(RadioDriver, SERVER_ADDRESS); uint8_t Message[14] = "+00.00/000.00 "; uint8_t Tmp[7] = "+00.00"; uint8_t Hmd[7] = "000.00"; // Define the Message Buffer uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN]; void setup() { // Setup Serial Monitor Serial.begin(9600); // Initialize RadioManager with defaults - 2.402 GHz (channel 2), 2Mbps, 0dBm if (!RadioManager.init()) Serial.println("init failed"); } void loop() { if(sht30.get()==0){ dtostrf(sht30.cTemp, 6, 2, Tmp); dtostrf(sht30.humidity, 6, 2, Hmd); sprintf(Message, "%s/%s", Tmp, Hmd); } else { Serial.println("Error SHT30 reading!"); } // Print to Serial Monitor Serial.println((char*)Message); if (RadioManager.sendtoWait(Message, sizeof(Message), CLIENT_ADDRESS)) { // Now wait for a reply from the client uint8_t len = sizeof(buf); uint8_t from; if (RadioManager.recvfromAckTimeout(buf, &len, 2000, &from)) { Serial.print("got reply from : 0x"); Serial.print(from, HEX); Serial.print(": "); Serial.println((char*)buf); } else { Serial.println("No reply, is nrf24_reliable_datagram_server running?"); } } else Serial.println("sendtoWait failed"); delay(100); // Wait a bit before next transmission } Si receptorul cu NRF24L01 si Wemos D1 mini: // Include RadioHead ReliableDatagram & NRF24 Libraries #include <RHReliableDatagram.h> #include <RH_NRF24.h> // Define addresses for radio channels #define CLIENT_ADDRESS 1 #define SERVER_ADDRESS 2 //Create an instance of the radio driver //Vcc-> 3.3V //Gnd->Gnd //SCK->D5, MISO->D6, MOSI->D7 //CE->D2, CSN->D8 RH_NRF24 RadioDriver(D2, D8); // Sets the radio driver to NRF24 and the client address to 1 RHReliableDatagram RadioManager(RadioDriver, CLIENT_ADDRESS); // Define the Message Buffer uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN]; void setup() { // Setup Serial Monitor Serial.begin(9600); // Initialize RadioManager with defaults - 2.402 GHz (channel 2), 2Mbps, 0dBm if (!RadioManager.init()) Serial.println("init failed"); } void loop() { if (RadioManager.available()) { // Wait for a message addressed to us from the client uint8_t len = sizeof(buf); uint8_t from; if (RadioManager.recvfromAck(buf, &len, &from)) { //Serial Print the received values Serial.println((char*)buf); if (!RadioManager.sendtoWait(buf, sizeof(buf), from)) Serial.println("send to tx failed"); } } } Sunt probate, functioneaza... Pe serial monitorul transmitatorului apare: got reply from : 0x1: 26.69/ 34.74 26.69/ 34.71 got reply from : 0x1: 26.69/ 34.71 26.70/ 34.76 got reply from : 0x1: 26.70/ 34.76 26.69/ 34.74 |
#33
Posted 25 July 2022 - 14:02
Peerless, on 25 iulie 2022 - 12:33, said:
Uite o varianta de transmitator cu NRF24L, Arduino nano si sht30 ca senzor de umiditate si temperatura: // Include RadioHead ReliableDatagram & NRF24 Libraries #include <RHReliableDatagram.h> #include <RH_NRF24.h> #include <WEMOS_SHT3X.h> //Create an instance of SHT30 sensor //Vcc->3.3V //Gnd->Gnd //SCL->A5 //SDA->A4 SHT3X sht30(0x45); // Define addresses for radio channels #define CLIENT_ADDRESS 1 #define SERVER_ADDRESS 2 // Create an instance of the radio driver //Vcc-> 3.3V //Gnd->Gnd //SCK->13, MISO->12, MOSI->11 //CE->9, CSN->10 RH_NRF24 RadioDriver(D2, D8); RH_NRF24 RadioDriver(9, 10); // Sets the radio driver to NRF24 and the server address to 2 RHReliableDatagram RadioManager(RadioDriver, SERVER_ADDRESS); uint8_t Message[14] = "+00.00/000.00 "; uint8_t Tmp[7] = "+00.00"; uint8_t Hmd[7] = "000.00"; // Define the Message Buffer uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN]; void setup() { // Setup Serial Monitor Serial.begin(9600); // Initialize RadioManager with defaults - 2.402 GHz (channel 2), 2Mbps, 0dBm if (!RadioManager.init()) Serial.println("init failed"); } void loop() { if(sht30.get()==0){ dtostrf(sht30.cTemp, 6, 2, Tmp); dtostrf(sht30.humidity, 6, 2, Hmd); sprintf(Message, "%s/%s", Tmp, Hmd); } else { Serial.println("Error SHT30 reading!"); } // Print to Serial Monitor Serial.println((char*)Message); if (RadioManager.sendtoWait(Message, sizeof(Message), CLIENT_ADDRESS)) { // Now wait for a reply from the client uint8_t len = sizeof(buf); uint8_t from; if (RadioManager.recvfromAckTimeout(buf, &len, 2000, &from)) { Serial.print("got reply from : 0x"); Serial.print(from, HEX); Serial.print(": "); Serial.println((char*)buf); } else { Serial.println("No reply, is nrf24_reliable_datagram_server running?"); } } else Serial.println("sendtoWait failed"); delay(100); // Wait a bit before next transmission } Si receptorul cu NRF24L01 si Wemos D1 mini: // Include RadioHead ReliableDatagram & NRF24 Libraries #include <RHReliableDatagram.h> #include <RH_NRF24.h> // Define addresses for radio channels #define CLIENT_ADDRESS 1 #define SERVER_ADDRESS 2 //Create an instance of the radio driver //Vcc-> 3.3V //Gnd->Gnd //SCK->D5, MISO->D6, MOSI->D7 //CE->D2, CSN->D8 RH_NRF24 RadioDriver(D2, D8); // Sets the radio driver to NRF24 and the client address to 1 RHReliableDatagram RadioManager(RadioDriver, CLIENT_ADDRESS); // Define the Message Buffer uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN]; void setup() { // Setup Serial Monitor Serial.begin(9600); // Initialize RadioManager with defaults - 2.402 GHz (channel 2), 2Mbps, 0dBm if (!RadioManager.init()) Serial.println("init failed"); } void loop() { if (RadioManager.available()) { // Wait for a message addressed to us from the client uint8_t len = sizeof(buf); uint8_t from; if (RadioManager.recvfromAck(buf, &len, &from)) { //Serial Print the received values Serial.println((char*)buf); if (!RadioManager.sendtoWait(buf, sizeof(buf), from)) Serial.println("send to tx failed"); } } } Sunt probate, functioneaza... Pe serial monitorul transmitatorului apare: got reply from : 0x1: 26.69/ 34.74 26.69/ 34.71 got reply from : 0x1: 26.69/ 34.71 26.70/ 34.76 got reply from : 0x1: 26.70/ 34.76 26.69/ 34.74 E si mai ieftin modulul ) Vad ca asta de long range cu antena e 20 lei |
|
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users