Home › Forums › The libraries hosted on the site › EByte LoRa e220 UART devices LLCC68 › E220-900T22D Send and Receive not working
Tagged: Arduino, EByte E220, Raspberry Pi pico
- This topic has 3 replies, 2 voices, and was last updated 1 year, 3 months ago by
Renzo Mischianti.
-
AuthorPosts
-
-
12 January 2024 at 15:33 #29209
Hello,
I have a transmitter (ADDL = 2) with AVR ATTiny16 (like Arduino) and a receiver (ADDL = 1) with Raspberry Pi Pico.The transmitter sends a string every 6 seconds. Unfortunately, the Rasperry Pi Pico (receiver) does not receive the string.
Yesterday it still worked, now it doesn’t and I don’t know what the reason could be.
I suspect that the Pico has a problem. The transmitter and receiver are next to each other.I have connected an OLED to display the configuration.
Here is the code for the transmitter:
#define FREQUENCY_868 #define ENABLE_RSSI true #define ACTIVATE_SOFTWARE_SERIAL // With FIXED SENDER configuration #define DESTINATION_ADDL 0x01 #define OWN_ADDH 0x00 #define OWN_ADDL 0x02 #include #include #define txE220pin 4 //7 //Pull-Up Output #define rxE220pin 6 //Pull-Up Input #define auxPin 16 // Pull-Up Output #define m0Pin 3 #define m1Pin 2 // Start LoraWan-Config LoRa_E220 e220ttl(txE220pin, rxE220pin, auxPin, m0Pin, m1Pin); // e22 TX e22 RX //void printParameters(struct Configuration configuration); //void printModuleInformation(struct ModuleInformation moduleInformation); int i = 0; void setup() { oled.begin(128, 64, sizeof(tiny4koled_init_128x64), tiny4koled_init_128x64); oled.setRotation(1); // Two fonts are supplied with this library, FONT8X16 and FONT6X8 // Other fonts are available from the TinyOLED-Fonts library oled.setFont(FONT6X8); // Clear the memory before turning on the display oled.clear(); // Turn on the display oled.on(); e220ttl.begin(); delay(50); ResponseStructContainer c; c = e220ttl.getConfiguration(); Configuration configuration = *(Configuration*) c.data; configuration.ADDL = OWN_ADDL; configuration.ADDH = OWN_ADDH; configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED; configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION; configuration.CRYPT.CRYPT_H = 0x01; configuration.CRYPT.CRYPT_L = 0x01; configuration.CHAN = 18; configuration.OPTION.transmissionPower = POWER_22; // Device power configuration.SPED.uartBaudRate = UART_BPS_9600; //UART_BPS_57600; // Serial baud rate e220ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE); ResponseStructContainer c1; c1 = e220ttl.getConfiguration(); Configuration configuration1 = *(Configuration*) c1.data; oled.println(String (c1.status.getResponseDescription())); oled.println(String (configuration1.SPED.getUARTBaudRateDescription())); oled.println(String (configuration1.OPTION.getTransmissionPowerDescription())); oled.println(String (configuration1.getChannelDescription())); oled.println(String (configuration1.TRANSMISSION_MODE.getRSSIEnableByteDescription())); c.close(); c1.close(); // Send message ResponseStatus rs = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 18, String (OWN_ADDH) + String (OWN_ADDL) + ",Hello, world?"); // Check If there is some problem of succesfully send oled.println("SendData: " + String (rs.getResponseDescription())); } void loop() { // put your main code here, to run repeatedly: ++i; // If something available if (e220ttl.available()>1) { // read the String message #ifdef ENABLE_RSSI ResponseContainer rc = e220ttl.receiveMessageRSSI(); #else ResponseContainer rc = e220ttl.receiveMessage(); #endif // Is something goes wrong print error if (rc.status.code!=1){ oled.println(String (rc.status.getResponseDescription())); }else{ // Print the data received oled.println(String (rc.status.getResponseDescription())); oled.println(String (rc.data)); #ifdef ENABLE_RSSI oled.println("RSSI: " + String (rc.rssi)); #endif } } delay(6000); ResponseStatus rs = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 18, String (OWN_ADDH) + String (OWN_ADDL) + ",Hello, world?" + String (i)); oled.clear(); oled.println("DESTINATION_ADDL: " + String (DESTINATION_ADDL)); oled.println("SendData " + String (i) + " : " + String (rs.getResponseDescription())); }
And here is the code for the receiver:
# Author: Renzo Mischianti # Website: www.mischianti.org # # Description: # This script demonstrates how to use the E220 LoRa module with MicroPython. # It includes examples of sending and receiving string using both transparent and fixed transmission modes. # The code also configures the module's address and channel for fixed transmission mode. # Address and channel of this receiver: # ADDH = 0x00 # ADDL = 0x01 # CHAN = 23 # # Can be used with the send_fixed_string and send_transparent_string scripts # # Note: This code was written and tested using MicroPython on an ESP32 board. # It works with other boards, but you may need to change the UART pins. import machine from time import sleep from umqtt.robust import MQTTClient from machine import UART, Pin import utime import network import time from LoraWanE220.lora_e220 import LoRaE220, Configuration, print_configuration from LoraWanE220.lora_e220_operation_constant import ResponseStatusCode from LoraWanE220.lora_e220_constants import FixedTransmission, RssiEnableByte # LORA-Konfiguration OWN_ADDH = 0x00 OWN_ADDL = 0x01 # Adresse 1 CHANNEL = 18 # 868Mhz # Initialize the LoRaE220 module uart1 = UART(1, rx=Pin(5), tx=Pin(4)) lora = LoRaE220('900T22D', uart1, aux_pin=2, m0_pin=10, m1_pin=11) code = lora.begin() print("Initialization: {}", ResponseStatusCode.get_description(code)) # Set the configuration to default values and print the updated configuration to the console # Not needed if already configured configuration_to_set = Configuration('900T22D') configuration_to_set.ADDH = OWN_ADDH # Address of this receive no sender configuration_to_set.ADDL = OWN_ADDL # Address of this receive no sender configuration_to_set.CHAN = CHANNEL # Address of this receive no sender configuration_to_set.TRANSMISSION_MODE.fixedTransmission = FixedTransmission.FIXED_TRANSMISSION # To enable RSSI, you must also enable RSSI on sender configuration_to_set.TRANSMISSION_MODE.enableRSSI = RssiEnableByte.RSSI_ENABLED # Enable Encryption configuration_to_set.CRYPT.CRYPT_H = 0x01; configuration_to_set.CRYPT.CRYPT_L = 0x01; code, confSetted = lora.set_configuration(configuration_to_set) print("Set configuration: {}", ResponseStatusCode.get_description(code)) print_configuration(confSetted) print("Waiting for messages...") while True: if lora.available() > 0: # If the sender not set RSSI # code, value = lora.receive_message() # If the sender set RSSI code, value, rssi = lora.receive_message(rssi=True) #print('RSSI: ', rssi) #print(ResponseStatusCode.get_description(code)) print(value) client.publish(topic, value) utime.sleep_ms(2000) client.disconnect()
Maybe someone can find the error.
-
12 January 2024 at 15:44 #29210
The last codeline of the receiver has to be deleted:
client.disconnect()
My fault.
But the receiver did not receive anything.
-
13 January 2024 at 11:39 #29214
Hello together,
I think, I have found the mistake.
The E220 module only works with 5 V (according to the data sheet) and my circuit only had 3.3 V. After I supplied the module with 5 V, it works without any problems.Best regards
Woto -
14 January 2024 at 12:03 #29228
Haa!! perfect.
But also the other module works better at 5V power supply; if you use 3.3V, the distance is reduced drastically.
Bye Renzo
-
-
AuthorPosts
- You must be logged in to reply to this topic.