I want to have a PC running Linux (going from its USB port) that can remotely program, get data from the serial port on an Arduino Uno.
My ultimate goal is to have the Linux box run ROS as the master and communicate wirelessly via ROS Serial or ROS Arduino to the Arduino slave which will then do the actual control, get odometry etc. The robot will only run inside so won't need more than 30' range probably. This way I can sit at my dining room table and change the program as well as control the bot while being able to view messages in ROS, see its simulations in Gazebo etc.
I went to Robotshop.com and went to their Communications and Control which came up with 452 products. I saw several options that I thought could work
but was curious what others have done, what they might do different and what was cost effective. I wasn't sure of this combination since ROS Serial uses the USB port to communicate so not sure if the shield will require other programming to communicate with it.
I use the nRF24L01 modules for low bandwith traffic between a host PC and a remote note such as a robot. It has been OK for upto about 10 meters indoors with no walls. The protocol supports retries but is not perfect. I am currently using the 1MHz baud rate. Others have had better distance results with the 250KHz mode. I have some newer “High” power versions that have not worked at all.
my current approach is
Slap a ESP8266, preferably a nodemcu board. They have wifi, are a programmable ARM that is compatible with arduino IDE and can support a text based web server, MQTT and the range is up to 40meters in AP mode.
Superceeded by later bversions
I note that the manufacturer suggests a later version (LE or LU):
Whether that helps or not, I do not know. Perhaps those are the higher power non working versions…
The op should note that bluetooth modules, while easy and ubiquitous are much lower bandwidth (and probably shorter range) than either this or the WiFi module. With that said bluetooth is easy and already supported on many devices.
The ESP8266 sounds interesting, I just bought one. I have a couple of the HCO5 and HC06 bluetooth modules
In a sea of many different options, some times you just have to spend a little chump change and time and see what works for yourself. I see that nRF24L01 (which I haven’t used) can be extraordinarily low power usage, which migh be just the ticket, sometimes.
It continues to amaze me how much technology you can buy for under $5 with free shipping.
Thanks for the suggestion.
Thanks for the suggestion.
I did look at it, read through the online documentation, but I wasn’t sure how my laptop through Linux would connect via the USB port. My understanding is that it would make the Arduino into a node on the Wifi network, but how would that pickup data being received and sent through a USB port on the Linux box? I am definitely still a neophyte on the Linux side so bear with me if this is a very obvious question.
The ESP8266 supports all
The ESP8266 supports all libraries of Arduino, and adds wifi.
You can use serial connection over usb just like normal arduinos, or connect to it via wifi if you prefer, even both at the same time.
The only unfavorable point is when you need fast RF communications, the ESP8266 takes 2seconds to connect to a network, and packet exchanged are guaranteed to be correct, but not real time.
The usb connection is faster than usual arduino(115kb/s is normal while atmega struggle at that speed).
If you need to control a robot where occasional delays are ok, it’s the way to go, since even without considering wifi it’s still a good price/performance.
To get and send data on linux you can use python, php, java(a bit hard),C…
Thanks for the info
I am still not at all sure how to connect this but good to know it works for you. That means I could replicate your success. My problem is that the libraries I plan to use on ROS are ROS Serial or ROS Arduino which will go through a USB port on my Linux box to the Arduino. The module would be connected to the Arduino, but my question is how to connect from Linux to the nRF24L01 unit.
I am sure it is very obvious since it seems assumed I know how to do it by people selling the hardware as well as you and Silux.
NRF24L01 & LINUX
I have a dedicated board which has a USB at on end and a nRF24L01 at the other. A microchip PIC in the middle buffers and forwards data between the host and the remote. Similar software exists on the robot. When the radio link is good, the data flow is transparent to the host Linux. It is just a serial port.
Errors in transmission are another story. The nRF24L01 has hardware support for CRC, transmission ACKs, and up to 15 retries with programable delay between messages on fault. The problem with the ACK scheme is you don’t know if the remote didn’t receive the message or if the host didn’t receive the reply. The protocol contains a message ID and if the remote receives the same ID in back to back messages it discards the later. I I have experimented with adding a second level if ID.
In general I have 2 needs for radio data. First is low bandwith control such as START, STOP, etc. The second is have the robot supply sensor data to the host such as IR Distance or Battery level. The nRF24L01 has been a good fit when used within 20 feet. For longer distance I put the USB module on a remote host or laptop and used the house wifi.
I have reciently decided to add wireless flash burn to the mix. In this mode I am willing to require that the remote be within 10 feet and the the entire image be downloaded and verified prior to burning. nschreiber0813 suggested using an external eprom. For my PIC based units the application is usually less than 8KB and there is plenty of spare flash to use as a temporary storage buffer. Need to work out the details.
I also have ESP8266, Hope RF69, CC3000, and some really dump TX/RX modules. Any of which may work better or easier than the NRF. There are a lot of claims regarding distance and error rate. The RF69 claims 1000 meter tx range.
If you decide to go the nRF24L01 route I can supply a host module and code. If you chose the ESP8266 (or other) path then I would be very interested in duplicating you efforts.
That clears things up
That clears things up considerably! It sounds like the error issues you are seeing makes the nRF24L01 not the way to go. Thanks for the offer of the code if I do go this way.
Thanks for taking time to answer my questions on this.
I didn’t mean to imply that the nRF24L01 was error prone. Only that you must understand its limitations and expect and compensate for errors in transmission. All low power wireless modules will exhibit these problems. Some may mask it by performing numerous retries before reporting a fault. Spec sheets do not like to call it an error when the remote goes out of range.
Remember this is a $3 module. It quite nicely fits the need for low cost short range wireless data transfer with CPUs such as Arduino or PIC. Change to a 2GHz quad core ARM with Linux and the game changes.
Keep us posted with your solution.
NodeMcu boards can
NodeMcu boards can communicate directly over usb, you can program them with arduino ide and there are some example sketch when you download the plugin to program them.