Troubleshooting communication [solved]
-
Almost three years ago, I asked my friend Oskar ( @d00wirre ) how to get started with Arduino. His answer was to check out MySensors and buy stuff to build a gateway and a node to start with. I did, and as many of you already know, I found out that I liked MySensors
Back to present day; last week I visited Oskar. He had built a node on a breadboard and it worked great, but when he soldered everything on a protoboard it started acting up so we decided to troubleshoot together.
This is what the node looked like, neatly tucked into a box.
We checked the node's own logs. It was able to initialize the radio. The ID was incorrectly set to 0. This was probably because the Pro Mini had been used as a serial gateway before. We decided to clear the eeprom and set a static ID.
Now the node's own logs said it was repeatedly trying to find parent (FPAR), but got no reply. All outgoing messages were acked though (st=OK). We checked the gateway log. The gateway was receiving the FPAR, and dutifully answering them, but none of the answers were acked by the node (got ST=NACK). Strange.
We switched the nrf24 module on the node. Same result. We added another capacitor. Same result.
When I first saw the node, I had noticed that the space below the nrf antenna was a bit tight. Could this be causing the problem?
We decided to get some extra clearance by temporarily stacking an extra header:
The node performed flawlessly! Not a single NACK. And this node is designed to monitor moisture of 16 house plants, so it sends 16 messages in quick concession (no delay) every time it reports data.
BUT: With the extra height, the node would no longer fit into the nice little box. Since Oskar likes to keep things nice and tidy, we checked out @petewill's great video on soldering an external antenna to the nrf24.
But would this be sufficient? The antenna will still pass close to a lot of metal, including the battery.
We powered up the node and it turned out to work without any problems.
This is the final result (with one of 16 forks connected):
All in all, we had a great afternoon and learned some new things:
- Debug logs from both gateway and node are tremendously helpful when troubleshooting. Without them, troubleshooting would probably have taken at least 10x as much time.
- Clearance around the antenna is very important.
- The fact that a node can send messages and receive acks for them doesn't necessarily mean it can receive messages.
- Soldering an external antenna on your nrf24 can do wonders
-
In fact @sundberg84 usually advices to have the antenna sticking out of the pcb underneath as the ground planes tend to what they are made for: shielding EM. Also trace antenna orientation plays a role too