Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: transmitter
PostPosted: Mon Dec 04, 2017 5:53 pm 

Joined: Mon Dec 04, 2017 5:48 pm
Posts: 3
hai...i am do a project that use sx1278 LoRa module..i already connect both LoRa which is transmitter side and receiver side. Here i have a problem to transfer the data to the receiver. What the code that can transmit data. My code does not run well. Here is my code at transmitter :

int chk = DHT.read11(dht11pin);

dht11 = digitalRead(dht11pin);

Serial.println(" Humidity " );

Serial.println(DHT.humidity, 1);

Serial.println(" Temparature ");

Serial.println(DHT.temperature, 1);

delay(2000);

sx1278.sendPacketTimeout(0,dht11);

Any idea to make it well ?
Please..Thank You


Top
 Profile  
 
 Post subject: LoRa Sx1278 Transmit and Receive Data
PostPosted: Mon Dec 04, 2017 6:11 pm 

Joined: Mon Dec 04, 2017 5:48 pm
Posts: 3
Hai...i just do a project using sx1278. I want to transfer the humidity and temperature sensor(DHT11) data to receiver but the receiver cannot get the data. Please help me solved this problem. It is urgent for my project. Here the coding for transmitter and receiver.

Transmitter :
#include "SX1278.h"
#include <SPI.h>
#include<dht.h>
dht DHT;

#define LORA_MODE 4
#define LORA_CHANNEL CH_6_BW_125
#define LORA_ADDRESS 2

#define LORA_SEND_TO_ADDRESS 4

#define LORA_LED 9

int dht11pin = 3; //ldr connected to digital pin 3
int dht11=0;


void setup()
{
Serial.begin(9600);
Serial.println(F("sx1278 module and Arduino: LoRa"));
if (sx1278.ON() == 0) {
Serial.println(F("Setting power ON: SUCCESS "));
} else {
Serial.println(F("Setting power ON: ERROR "));
}
if (sx1278.setMode(LORA_MODE) == 0) {
Serial.println(F("Setting Mode: SUCCESS "));
} else {
Serial.println(F("Setting Mode: ERROR "));
}
if (sx1278.setHeaderON() == 0) {
Serial.println(F("Setting Header ON: SUCCESS "));
} else {
Serial.println(F("Setting Header ON: ERROR "));
}
if (sx1278.setChannel(LORA_CHANNEL) == 0) {
Serial.println(F("Setting Channel: SUCCESS "));
} else {
Serial.println(F("Setting Channel: ERROR "));
}
if (sx1278.setCRC_ON() == 0) {
Serial.println(F("Setting CRC ON: SUCCESS "));
} else {
Serial.println(F("Setting CRC ON: ERROR "));
}
if (sx1278.setPower('I') == 0) {
Serial.println(F("Setting Power: SUCCESS "));
} else {
Serial.println(F("Setting Power: ERROR "));
}
if (sx1278.setNodeAddress(LORA_ADDRESS) == 0) {
Serial.println(F("Setting node address: SUCCESS "));
} else {
Serial.println(F("Setting node address: ERROR "));
}
Serial.println(F("sx1278 configured finished"));
}

void loop(void)
{


int chk = DHT.read11(dht11pin);

dht11 = digitalRead(dht11pin);

Serial.println(" Humidity " );

Serial.println(DHT.humidity, 1);

Serial.println(" Temparature ");

Serial.println(DHT.temperature, 1);

delay(2000);

sx1278.sendPacketTimeout(0,dht11);
}

Receiver :
#include "SX1278.h"
#include <SPI.h>

#define LORA_MODE 4
#define LORA_CHANNEL CH_6_BW_125
#define LORA_ADDRESS 2

#define LORA_SEND_TO_ADDRESS 4

char my_packet[100];
int a;

void setup()
{
Serial.begin(9600);
Serial.println(F("sx1278 module and Arduino: LoRa"));
if (sx1278.ON() == 0) {
Serial.println(F("Setting power ON: SUCCESS "));
} else {
Serial.println(F("Setting power ON: ERROR "));
}
if (sx1278.setMode(LORA_MODE) == 0) {
Serial.println(F("Setting Mode: SUCCESS "));
} else {
Serial.println(F("Setting Mode: ERROR "));
}
if (sx1278.setHeaderON() == 0) {
Serial.println(F("Setting Header ON: SUCCESS "));
} else {
Serial.println(F("Setting Header ON: ERROR "));
}
if (sx1278.setChannel(LORA_CHANNEL) == 0) {
Serial.println(F("Setting Channel: SUCCESS "));
} else {
Serial.println(F("Setting Channel: ERROR "));
}
if (sx1278.setCRC_ON() == 0) {
Serial.println(F("Setting CRC ON: SUCCESS "));
} else {
Serial.println(F("Setting CRC ON: ERROR "));
}
if (sx1278.setPower('I') == 0) {
Serial.println(F("Setting Power: SUCCESS "));
} else {
Serial.println(F("Setting Power: ERROR "));
}
if (sx1278.setNodeAddress(LORA_ADDRESS) == 0) {
Serial.println(F("Setting node address: SUCCESS "));
} else {
Serial.println(F("Setting node address: ERROR "));
}
Serial.println(F("sx1278 configured finished"));
}

void loop(void)
{
a=sx1278.receiveAll();
for(unsigned int i = 0; i < sx1278.packet_received.length; i++)
{
my_packet[i]=(char)sx1278.packet_received.data[i];
}
Serial.print(F("Received Data:"));
Serial.println(my_packet);
Serial.println(a);
delay(1000);
}


Top
 Profile  
 
 Post subject: Re: LoRa Sx1278 Transmit and Receive Data
PostPosted: Tue Dec 05, 2017 8:19 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi hasraf,

Please, contact directly with the manufacturer of your module. Here we can give only support about our products.

Regards


Top
 Profile  
 
 Post subject: Re: LoRa Sx1278 Transmit and Receive Data
PostPosted: Wed Dec 06, 2017 2:58 pm 

Joined: Mon Dec 04, 2017 5:48 pm
Posts: 3
can you check my code ?it is have any problem ?


Top
 Profile  
 
 Post subject: Re: LoRa Sx1278 Transmit and Receive Data
PostPosted: Thu Dec 07, 2017 8:31 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi hasraf,

We can't check a code that it is not of our products. This is a forum for techncial service of our products.

Please, contact directly with the manufacturer of your module.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.