Arduino Communications Using the netcat(nc) Utility
Welcome to Combustory
Any questions or comments:
- Send them to - firstname.lastname@example.org
Why reinvent the wheel. I have seen very complicated methods for communicating with the Arduino, Including some I have made on my own. What I have recently found out is that the easiest way to communicate to the Arduino is using the existing tool netcat. It is soooooo simple and super powerful. You can send the output to a Network port and access the communications from literally any place in the world.
- You have basic knowledge of command line usage
- You know how to load a program to the Arduino
Mini2440 or Embedded Systems
Embedded systems like the Mini2440, use Busy Box as a small utility package that includes a version of nc that makes communications to Arduino a breeze. All you have to do is go to a terminal and use these two commands after you plug in the Arduino.
stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts nc -f /dev/ttyUSB0
You should now have a terminal session that is communicating with the Arduino. Of course you should have a program that responds to serial communication on the Arduino, or nothing will be happening. How this works is the nc command has redirected the input and output streams of the /dev/ttyUSB0, which is the Arduino terminal and the stty command sets the serial communication parameters.