Connecting two arduinos over radio (Bluetooth, WiFi, nRF24, Laipac?)

I've been struggling for a few weeks now, trying to get two Arduinos remotely talking to one another.I have tried HC-08, hc-05, hc-06, nRF24, and even some old Laipac 415 and 900 MHz radios. Best luck I've had so far is with a WeMos Arduino board.

I keep running into guides and tutorials that either don't do quite what I want, or use steps that I can't complete for various reasons (wrong board type, libraries I can't find, etc.). I am no stranger to programming, but these modules baffle the heck out of me.

My project is simple. I need to send a 3 or 4 byte message to the remote end and receive acknowledgement that it got there. At the remote end, I will, depending on the message, drive one of two pins low for a short time.

I am hoping to be able to use WiFi, Bluetooth, or the nRF24 radio. The range required is short, perhaps 20-25 feet. If I am using WiFi, I would prefer to use an IP address range outside any WiFi routers in the immediate area, as this will be a single purpose application, not requiring any other computers or the internet.

My first question is "What configuration would be best for this?" I am currently working on a WeMOS solution because I have managed to implement an Access point, and have had another Arduino programmed as a Client connect to it. Unfortunately, the communication does not fully work.

I get an IP address on the Arduino serial port: 192.168.4.1
On my client, I get:

.....................................
WiFi connected
IP address:
192.168.4.2
connecting to 192.168.4.1:80
sending data to server

Client Timeout !

So before I get too far into getting this working, can anyone tell me if I am on the right track?
I keep wondering if I should use a web server, http server, or whatever. I have a lot of examples in the ESP8266 library, but have no idea how best to do what I want.

If so, I will post code in the "Programming Questions" forum, as I did not really know if I should post it here.

Hi lar3ry,
I am no expert, but to share my thoughts:
This sounds like a Bluetooth Low Energy setup would be a good solution. It follows a master - slave like architecture using Peripheral (Advertiser) and Central (Scanner) nodes. If you need the acknowledgement, both devices might need to play both roles.

This Simple nRF24L01+ Tutorial may be of interest.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

If you are using ESP8266 devices then you may also want to consider ESP-NOW

...R

Robin2:
This Simple nRF24L01+ Tutorial may be of interest.
There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

When I was trying to get nRF24 working, your tutorial was the best I had found, and I did get finally get it working intermittently. I started off with some wiring problems. My 75 year old eyes are not what they used to be. Add to that, I was using an adapter to adapt the narrow-spaced two-row pins to something that would suit the breadbard. Unfortunately, I think it was for a different module, and I had to map and document it in a text file. Very error-prone.

I was using solderless breadboards and an UNO on a ProtoShield (Great product!). The test program was very helpful, and I could get it going, but it would soon stop working. It seemed to degrade over a period of time. I was using a 5V 2A wall wart feeding a USB to 3.3V regulated buck converter to power the nRF24.

I also tried shielding the module with tinfoil, and set it up with and without wires to extend it away from the rest of the circuit.

If you are using ESP8266 devices then you may also want to consider ESP-NOW

Thanks for that. I'll have a look at it. It sounds promising in the first minute or so of the video.

Meanwhile, I found something more in my WeMos attempt. It seems that the data sent to the Access point from the client triggers a response when the transfer is successful.

This shows up in the client serial monitor

Connecting to ESPap
.................
WiFi connected
IP address:
192.168.4.2
connecting to 192.168.4.1:80
sending data to server
receiving from remote server
HTTP/1.0 200 OK
Content-Type: text/plain
Content-Length: 0
Connection: close

A few things about this baffle me.

  1. The code looks like it should echo what it received, but it clearly doesn't.

  2. Everything following "receiving from..." is actually from the web server on the access point, and nowhere in the AP code do those messages appear. I have to assume they are from the AP's ESP8266.

  3. I can't understand why the connection would close. It looks to me like the connection is being closed by the access point, because I recieve the close message from it.

Oh well, I'll take a run at ESPNow and see what happens.

Thanks for the pointers.

Robin2:
If you are using ESP8266 devices then you may also want to consider ESP-NOW

You have made me a happy man. Thank you for the link to ESP-Now, but more importantly, thank you for your own examples in the thread "ESP8266 with ESP-NOW as an alternative to nRF24L01+".

I watched the video By Andreas Spiess, found the sketches for master and slave, but never did get anything working right. There was much modification needed to get it going at all, and I could not seem to change what was sent. Additionally, the whole thing shut down after one message.

On the gripping hand, your code, EspNowSlave.ino and EspNowController.ino loaded, compiled, and ran, first time, exceeding my expectations, having struggled with this stuff for so long. I wish I had found it a couple of weeks ago.

Cheers,
Larry

Glad to hear it was useful.

Just out of curiosity, what ESP8266 boards are you using?

...R

Robin2:
Just out of curiosity, what ESP8266 boards are you using?

They are WeMos D1 clones.
Got them from AliExpress for $3.89 Canadian + 1.40 shipping. Bought 4 for $19.08 CAD. With them being this easy to get going, I think I'll be ordering some more for little jobs around the houe.

BTW, in case you are wondering, my current project is a SIP and PUFF remote controller for a quadriplegic. He already has one on his bed, and he uses it to run his computer, TV, and phone through a Relax controller. He does not have any way to control it from his wheelchair, but thanks to you, he will have one shortly, I hope by year end. I'll be hooking the slave up in parallel with his current SIP and PUFF switch.

I already have the SIP/PUFF part working on an UNO, using an analogue input pin, using 3V fullscale, so that will be trivial to put in.

Happy camper here!

I'll also be 3D printing cases for them.

Until the wireless is worked out, you probably develop the code for both boards just using some wire connected to the boards tx/rx/gnd, and monitor what is going on using the serial monitor on each.

lar3ry:
They are WeMos D1 clones.

Many thanks.

...R