Arduino Wireless Serial Communication
Intro: Arduino Wireless Serial Communication
There are many ways to communicate with remote Arduinos. I have found that many of them hit a slightly higher price point than what I would like. Also, ethernet shields (and wifi dito?) consume many valuable hardware pins. I will describe how to communicate host to Arduino using commercially available wireless serial ports. They are cheap(ish) and only use the rx/tx pins. The drawback is that the air-protocol isn't encrypted so I wouldn't use it for sensitive applications. I use it to control lighting. I would be more impressed than offended if a neighbour hacked my indoor lighting. Serial ports (even wireless) are designed for point to point communication. It is possible to use in one-to many or other constellations but certaing design consideration have to be taken. My Arduino library referenced in step 5 supports one-to many.
The described project is for one-way or two-way communication using (i. e. transciever). If you know you will only send commands "blindly" you can attach a transmitter to the PC end and a receiver to the Arduino. Those modules are really cheap.
The described project is for one-way or two-way communication using (i. e. transciever). If you know you will only send commands "blindly" you can attach a transmitter to the PC end and a receiver to the Arduino. Those modules are really cheap.
STEP 1: What You Need
- USB serial adapter
- Two or more Wireless RS232 modules (e. g. EWRF 3022)
- Arduino. It's a Nano in the picture but any model should due.
- A gadget box
- Soldering equipment
- Basic Arduino skills
STEP 2: Attach the USB Module to the Transciever
The VBUS connector on the USB module provides +5v for the transciever. Cross rx/tx lines. See pictures.
STEP 3: Fit the Modules in the Box
For the PC-end I added a small enclosure. Drill a hole for the antenna and dremel an opening for the USB socket.
STEP 4: Attach the Second Transciever to the Arduino
Attach vcc, gnd and rx/tx (crossed) of the transciever module to the Arduino
STEP 5: Load the Software
Flash the Arduino sketch of choice, which uses serial communication with a PC.
If you want to write your own interaction you may want to check my CmdCallBack library out. The library makes it easy to link commands with parameter with callback functions in the sketch. I might make a separate Instructable about that.
If you want to write your own interaction you may want to check my CmdCallBack library out. The library makes it easy to link commands with parameter with callback functions in the sketch. I might make a separate Instructable about that.
62 Comments
KushagraK7 5 years ago
MariaM330 6 years ago
Hi, I might be few years late but its worth asking...will the XBee modules do the same Serial communication to and from computer and Arduino?
ehsmaes 6 years ago
Hi, I don't know much about the xbee module but I would assume there would be modifications needed. A lot of things have happened after this article was published. I currently don't use this anymore myself. I mainly use different versions of esp8266 instead of arduion. The esp8266 microcontrollers have integrated wifi.
ponynicker53 8 years ago
Using 2 pairs of Tx/Rx's, can you do two way communication?
Say I want to:
"as for data from a pin"
then have the arduino serial print the result back to the computer
Thanks
ehsmaes 8 years ago
If I interpret you question correctly - you want to use the command interpreter without the wireless stuff? Yes, that works. See point-to point mode here: https://bitbucket.org/ehsmaes/cmdcallback/wiki/Home
ponynicker53 8 years ago
I may have asked my question in a confusing way.
Basically I want to be able to run simple 2 way serial communication wirelessly.
(Example: http://arduinobasics.blogspot.com/2012/07/arduino-...)
That would require 1 Tx and 1 Rx on the arduino, and 1Tx and 1Rx on the USB/Computer.
How would I wire them up to have one pair of transmitters send instructions to the arduino, and the other pair send serial data from the arduino to the computer.
ponynicker53 8 years ago
To give some background, I want to make an RC vehicle with lots of sensors. Rather than using a traditional R/C Tx & Rx (like these http://ep.yimg.com/ay/yhst-17210252890263/exceed-r...) which are limited by the number of channels (Move forward/back, Turn left/right, etc), I was wondering if I could communicate with the arduino-bot via data, so I am not limited by number of channels. So I could send commands to it to turn left/right as well as receive data from the sensors in real time.
Maybe there is a better way of going about this.
ponynicker53 8 years ago
Nevermind, I think I figured it out.
ShoaibS7 8 years ago
How did you do it ?
I want to apply for similar application where I can control my home appliances and monitor their state as well.
ponynicker53 8 years ago
Bought TWO of these: http://www.aliexpress.com/item/Lowest-Price-433Mhz...
and one of these: http://www.aliexpress.com/item/5PCS-Free-Shipping-..
Hooking one pair:
USB TTL Tx pin --> 1st transmitter --> ***air*** --> 1st reciever --> arduino reciever pin
Other pair:
arduino transmitter pin -->2nd transmitter --> ***air*** --> 2nd reciever -->Rx pin on USB TTL
Basically in the image, one Rx/Tx pair is replacing the yellow wire, the other is replacing the blue wire. Then each side will need it's own power and gnd.
SuryaG5 6 years ago
SiddhiN 7 years ago
after uploading my sketch if i disconnect mt arduino from PC and give an external power source to it, will it work? And how can i use received data in an application?
ehsmaes 7 years ago
Your arduino doesn't have to be attached to a PC but for most applications you need to have one arduino+rf connected to a computer in order to control and/or read data from the other arduino+rf units. But I suppose there could be rare situations where it would make sense to have an autonomous system where arduinos only communicate with eachother. If you have such a use case - yes, it is possible. As for how to use received data in an application - that is really hard to answer. It is up to you. It is just data. Use it like you would any other data.
yesnoj 7 years ago
Hi, i've an arduino nano like yours and the transreceiver module wifi esp8266.What i want to do is to use an Amazon Dash Button to turn on/off a light using a relay attached to the arduino.Is possible?Can you give me some suggestions?!
Thanks
AndrewH395 7 years ago
you could use a relay or a NPN transitor (should work) to turn of lights but with a dash button seems a little iffy. You could probably make something a little larger with a smaller antena than this but arduino to arduino communication.
SiddhiN 7 years ago
My one arduino with receiver is going to be attached to PC.
Thanks a lot!
AndrewH395 7 years ago
I plan on using this trick of reasonably long distance serial communication (arduino to arduino) [drone project if you guessed it], so I need to look into if these are very good over distance but overall a big thanks. I can just wire the two arduinos the same as the one arduino in the guide correct?
MikeM189 7 years ago
Another option is to grab an Arduino clone with built-in RF, like this one: https://wisen.com.au/store/products/whisper-node-a...
No wire connections and you can even run on a single AA batteries.
VongS 7 years ago
can it work in multiple transmitter to one receiver friend?
ehsmaes 7 years ago