Hello,
I've made a few moteino clones, they work all well. I can run node and gateway sketches with no problems. But as soon as I connect it the rx-tx pin on Pi I start to loose packets. Here is a short video of what I'm trying to say https://www.youtube.com/watch?v=0Om9wtD6LiI I fumble a bit in the video but I hope you get what I'm trying to say.
I've also tried with higher TRASMITPERIOD on node upto 2seconds, but still I get this sort of error.
I'm later going to use Node red(http://nodered.org/) to push the data on to a server.
Any ideas of what is going on?
Also please provide any suggestion of things I should try?
Thanks for your help.
Good day.
Hemal,
How are you powering the Moteino?
I think the issue is that you're only connecting TX/RX and not GND. Add a GND connection but make sure the GNDs are at the same level to avoid any GND loops.
Perhaps it would be more ideal to completely poower the Moteino from the Pi. SO you would only have 4 wires from the Moteino to the Pi (GND, 5V, TX, RX).
Hi Felix
I'm powering the node from the USB to serial converter(cp2102) with 3v3 and same for the gateway I don't have Vregs on board. All are powered from USB ports on my PC. I tried connecting the ground, same result, and powered the moteino from Pi again same result.
Also I uploaded a simple sketch on the gateway which does a serial print a counter every 100ms and it worked perfectly on Pi.
Thank you.
Hard to guess what could be going on, since it's working as expected without serial connections.
I think it's some kind of leaking of current through the serial lines.
You are probably right, I updated the library and uploaded the examples as is, just uncommented the #define IS_RFM69HW on both node and gateway.
Then I just connected the tx line of gateway to rx of Pi and it worked fine, as soon as I connected the Rx line of gateway the problem starts again, also I noticed I'm getting an empty packet from gateway on node.
Below is the serial log of node.
Sending[11]: 123 ABCDEFG ok!
Sending[12]: 123 ABCDEFGH ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[13]: 123 ABCDEFGHI ok!
Sending[14]: 123 ABCDEFGHIJ ok!
Sending[15]: 123 ABCDEFGHIJK ok!
[1] ACK TEST [RX_RSSI:-13] - ACK sent
Sending[16]: 123 ABCDEFGHIJKL ok!
Sending[17]: 123 ABCDEFGHIJKLM ok!
Sending[18]: 123 ABCDEFGHIJKLMN ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[19]: 123 ABCDEFGHIJKLMNO ok!
Sending[20]: 123 ABCDEFGHIJKLMNOP ok!
Sending[21]: 123 ABCDEFGHIJKLMNOPQ ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
############################################# RX of gateway connected to TX of Pi
Sending[22]: 123 ABCDEFGHIJKLMNOPQR nothing...
[1] [RX_RSSI:-29] ##I get this empty packet
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS ok!
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST nothing...
[1] [RX_RSSI:-29]
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU ok!
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV nothing...
[1] [RX_RSSI:-29]
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW nothing...
[1] [RX_RSSI:-29]
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX nothing...
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY nothing...
[1] [RX_RSSI:-28]
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ nothing...
Sending[0]: ok!
Sending[1]: 1 nothing...
Sending[2]: 12 ok!
Sending[3]: 123 nothing...
[1] [RX_RSSI:-29]
Sending[4]: 123 ok!
Sending[5]: 123 A ok!
Sending[6]: 123 AB ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[7]: 123 ABC ok!
Sending[8]: 123 ABCD ok!
Sending[9]: 123 ABCDE ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[10]: 123 ABCDEF ok!
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[13]: 123 ABCDEFGHI ok!
Sending[14]: 123 ABCDEFGHIJ nothing...
[1] [RX_RSSI:-29]
############################################# RX of gateway disconnected from TX of Pi
Sending[15]: 123 ABCDEFGHIJK ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[16]: 123 ABCDEFGHIJKL ok!
Sending[17]: 123 ABCDEFGHIJKLM ok!
Sending[18]: 123 ABCDEFGHIJKLMN ok!
Sending[19]: 123 ABCDEFGHIJKLMNO ok!
Sending[20]: 123 ABCDEFGHIJKLMNOP ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[21]: 123 ABCDEFGHIJKLMNOPQ ok!
Sending[22]: 123 ABCDEFGHIJKLMNOPQR ok!
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST ok!
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU ok!
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW ok!
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX ok!
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY ok!
[1] ACK TEST [RX_RSSI:-29] - ACK sent
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ ok!
I believe the Raspberry PI GPIO is 3.3V level. What power level are you using on the gateway? These must match or you need to do level shifting between the two boards.
Things to try:
1. Install a series resistors on the TX and RX lines. If there is a mismatch, then series resistors help consume the voltage differences. A few hundred ohms should not interfere with communication.
2. Make sure the grounds are solid and there is no voltage differential between ground on the PI and ground on the gateway.
3. Connect an o-scope to the TX and RX lines and look for overshoots, undershoots and bad levels.
4. Create a "Y" connection on the PI TX line. Attach one part of the "Y" to the gateway. The other part of the "Y" connect to another computer to monitor what appears on the TX line. Perhaps something on the PI is outputting some serial trash or messages that you do not know about.
Moteino and RaspberryPi both run on 3.3V and all GPIO is 3.3V.
The Moteino can get its VIN from the Pi's 5V pin, the TX/RX can be connected directly.
Serial on the PI is used by linux console and can send some message (error, warning) that may be the cause of your problem (and sometime doing RF reconfiguration by sending command mis-understood by your module), you need to disable serial console to fully use RX/TX of the PI
see this post :
http://hallard.me/enable-serial-port-on-raspberry-pi/ (http://hallard.me/enable-serial-port-on-raspberry-pi/)