-
Notifications
You must be signed in to change notification settings - Fork 49
Receiving garbage data #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
try sending shorter chunks until you can figure out where the issue is |
My Arduino can able to receive the data perfectly, but Raspberry pi receiving data in garbage format |
@sasi143 -- What library are you using on the Arduino? can you post the code you are running on both ends? What pins are you using on the Raspberry Pi? |
Here is my client code (Arduino uno) #define RFM95_CS 10 #define RF95_FREQ 868.0 const unsigned int TRIG_PIN = 8; char TankName[] = "TAOF0201"; const unsigned int MaxTankHeight = 110; unsigned int Samples = 10; unsigned long duration = 0; // Singleton instance of the radio driver void setup() while (!Serial); Serial.println(F("Arduino LoRa TX Node!")); pinMode(TRIG_PIN, OUTPUT); while (!rf95.init()) { // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM // you can set transmitter powers from 5 to 23 dBm: } void loop() int freeRam () void mainFunction() { if ((currentMillis - previousMillis) >= interval) {
} } void loraSubFunction() {
} My Raspberry pi code : Define radio parameters.RADIO_FREQ_MHZ = 868.0 # Frequency of the radio in Mhz. Must match your Define pins connected to the chip, use these if wiring up the breakout according to the guide:CS = digitalio.DigitalInOut(board.D5) Initialize SPI bus.spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) Initialze RFM radiorfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ,baudrate=1000000) rfm9x.tx_power = 23 while True: connected pins from rfm9x to raspberry pi3: cs - 29 |
A few suggestions:
It is not clear why you are lowering the baud rate to 1Mhz from the default 5Mhz If that does not help then as @ladyada suggested, try sending shorter packets just to see if they work reliably and if they do increase the size to see if there is a threshold where it fails. also - how often are you sending these packets. ti looks like the interval s 1 second. - If so, that may be an issue with the receive timeout of 2 seconds. Try slowing down the transit rate to see if that helps. |
@jerryneedell , @ladyada I did below the things that you suggested.
Now I am getting data like this: bytearray(b'| \xea\x81q\x9e\x86\x02\xffZ\xe0uQ\xd0\xf6\nV3\x1c>\xb7\x9b\x90\x86\xed\x05*\xe5\xe1\xee\xf4$\xf1\xb0\x1f\xb1\x86\xc3\xf5\t?\x80syr\xac\xa7\x0b\x1f\xb01(5\xf0\x0e4\x8eB\xbb\x1a~\x1c\x9c\x0b\x9a\x11`\xd2\xd2-\x16\xe0Le\x9b@t\xc4\xd3~\x18Eol\xfdM#k\xf2\xde\x9e\xca\xa5\xa2\xa7#5l\x98\x0c&M\xd2\x8a\xa6\x0f\x0e\xba\x95\xb0b;"\xe8\x94A\xa5Q\xbf\xc7Q\xa5\x04\xf2H"\xf1\xe3m\\x1d6C\x80\x19=\xfa\xbf\x12\xd0\xa0\x95\xed\xc2K\xfae') Actuall data is : bytearray(b'121,0,0,0,0,0,43,0') Sometimes I can able to receive the data correct and sometimes it behaves strangely. Please suggest on the same |
can someone please respond? |
I have no idea what is going on. When you say it works sometimes, does to run for awhile then start giving the bad data? Are you sure you don't have something else transmitting? I know I often see bursts of data that I don't recognize if I just listen. When you say the Arduino receives data OK, what data is that? Is it being sent from the Raspberry Pi? For your tests, are the radios near each other and are you just using simple wire antennas? |
@jerryneedell Thanks for responding quickly. I am sure it was not sending any bad data because at the same time I can able to receive the data perfectly in Arduino uno. The basic functionality is failing some times. I am sending plain string data from Arduino uno(client) to raspberry pi(gateway) I am using this type of Antena : https://www.adafruit.com/product/3340 If possible can you please help me to run this code : https://github.com/hallard/RadioHead/blob/master/examples/raspi/rf95/rf95_server.cpp when I run the code it saying : RF95 module init failed, Please verify wiring/module I didn't find IRQ and LED pin on LoRA module. can you please help me on this. |
@sasi143 I have not used the RadioHead library on my RaspBerry Pi at all. I have only used the CircuitPython RFM9X library for LoRa. The LED pin is , Think just for an external LED if you want to use one -- you don't need it. On the Arduino are you using the adafruit fork of the Radiohead library? https://github.com/adafruit/RadioHead When you say the Arduino is receiving data, where is the data coming from? Have you ever been able to communicate with the Raspberry Pi system? |
I am using the same product and the same library that you asked. one arduino uno-1 (client) sending the data. I am running receiving the code in both Raspberry pi(Python) and arduino uno -2. I can able to communicate raspberry pi with the only python, but still failing to run Radio head c++ files in the raspberry pi |
OK -- so when you use the adafruit-circuitpython-rfm9x library on the Raspberry PI, you can receive data reliably? It is just the c++ library that is not working? Is that correct? |
No, I can able to receive the data in Raspberry pi but it was not consistent manner. sometimes I am receiving data good and some times it was behaving strangely. Good data : bytearray(b'121,56,0,1,1,57,43,0') so, python library was not consistently printing the right data. so, I am thinking to move to c++ program on raspberry pi which was build in RadioHead library But, when I try to run "RasPiRH.cpp" file in Raspberry pi it saying "RF95 module init failed, Please verify wiring/module" |
ah -- how often do you get the bad packets? -- as I mentioned I do see something similar -- very infrequently -- many minutes apart -- I will get a packet like this
I get these if I just listen without anything transmitting. Is this what you are seeing or do the bad packets correspond to the times of your actual transmissions? I think that is what you stated in your first message, so I was not thinking it was comparable, but it may be. If I have time, I can take a look at the c++ library this weekend, |
once again thanks for the quick response, sometimes my transmitting data can be manipulated like below bytearray(b'121,56,0,1,1,5>,4\xa3\xb59') some values are correct in that data and some index values are filled up garbage values I am really appreciate your kind response |
The disturbance of data is not frequent, but I can able to see after every 3 to 4 correct messages in raspberry pi. whereas Arduino can able to receive the data perfectly. |
That is good information - I wish I had better suggestions - Other than the infrequent noise packets, I have not had problems with receiving data on the Raspberry Pi. I usually am sending them from a board running CircuitPython, though, not Arduino. I'll try to run some tests this weekend to see if I can replicate your problems. |
Thanks alot @jerryneedell , will wait for your response. Thanks for your work. |
@sasi143 I cannot reproduce your setup exactly, but I have been running tests sending data from Arduino library code to Python code on a Raspberry Pi I have not had any issues other than some missed packets if I left the default .5 second timeout. I have not seen any corrupted packets. Can you try these examples? You will have to adjust the Pin assignments. Note, only the first 2 digits of the packet counter are shown in the last two bytes. This was just a quick example... Arduino sketch -- feather M0 with rfm9x featherwing
Python script on Raspberry Pi
received by Raspberry Pi
|
@jerryneedell Can I please let us know the Raspberry pi pin configuration with RFM 95? |
For the RFM95 breakout board on a Raspberry Pi 3B+ I use:
|
When using the C++ version of the RadioHead library, you have to edit the code to specify which LoRa hardware is being used. Directions are posted in the comments. example with Dragino LoRa hat hardware on /RadioHead/examples/raspi/rf95/rf95_server.cpp : Comment out #define BOARD_LORASPI or specify the wiring configurations... /* Raspberry Pi wiring configurations for Dragino LoRa Hat */ |
started looking at this a bit more -- I am running a simple listening program on both an RPi 4 and on a feather_m0_adalogger with rfm9x both see the occasional "garbage" packets but interestingly, they don't see them at the same time! For this test, I have both systems listening for packets with a third system sending a packet every 10 seconds. Bot see the transmitted packets and each has seen one "garbage" packet in the past 15 minutes, but they did not see the same "garbage" packet. They were minutes abaort and had very different content. I will try to get some additional captures. |
@sasi143 @jerryneedell Are you still experiencing this issue? |
I am having this very same issue, I am getting a |
@sasi143 @kevin192291 See my recent issue: #51. Depending on your LoRa configuration, implementing the improvements and errata described in my first post may remedy your problems. |
There were some changes made to address this in #57 -- I still see occasional noise packets, butI'm not sure there is anything we can do about them. If there are no objections I will close this for now and we can re-open it or start a new issue if necessary. |
Actual data:
bytearray(b'{waterLevel:71,name:TAOF0201,solenoidState:0,valid:1,ultrasonicState:1,waterLevelDistance:43,freeMemory:38,compareStatus:0}')
"Received data:"
Received (raw bytes): bytearray(b"+w4\xb4irL\xa9v\xa5l:7\x11.Lame:TAOF5b51,solenoidState:0,valid:1Lulr\xfa\xf9wonicState:1,waterLevelDistance:43,freeMemory:38,coe\xf8a'`\x06tatus:0}")
I am receiving the above data instead of actual data, some times data was printing correct and some times it behaving strangely. please help me with this.
I am using Arduino uno for client and Raspberry pi for the server with RFM9x
Thankyou
The text was updated successfully, but these errors were encountered: