upload sketch through serial over tcp/ip (ser2net or socat)


My arduino is used to drive a sun tracker, 30m from my home where I can observe good alignments and so on. So I needed to communicate (upload & serial monitoring) from 30 meters.

As it's only for quite a short period so I don't needed a fancy installation.

I used a laptop running ubuntu linux, connected via usb to arduino, and connected to my home wifi network. (wifi network include a repeater to have a decent connection)

The second computer where arduino IDE is also running ubuntu linux.

Here is what I did to make that work.

I installed ser2net on the laptop. Here is ser2net.conf config :

3002:raw:600:/dev/ttyACM3:115200 8DATABITS NONE 1STOPBIT
3003:raw:600:/dev/ttyACM3:9600 8DATABITS NONE 1STOPBIT

Note that ttyACM0 1 & 2 are already in used because laptop include 3G modem, GPS etc... Normally arduino is on /dev/ttyACM0

On the other computer side, I do the compilation from arduino IDE (ctrl+R), and I look for .hex path in the compiler output (in arduino ide preferenced, enable display detailed output for compile)

Then I run from terminal

avrdude -p m328p -c arduino -P net: -Uflash:w:/tmp/build1891570887836564406.tmp/heliostat_v4.cpp.hex

Where you'll replace ip & port with the real one, and hex path.

It works really fine!

To communicate with arduino :

telnet 3003

I used a different port because basic communication was in 9600 bauds. I could harmonize everything to 115200 and use only one TCP port.

For information, from telnet for linux, to switch in character mode (so that each character is directly sent when typed without waiting for enter) type in telnet [ctrl]+[alt gr]+[)/°], and then 'mode character' [enter]

What I didn't manage to do : Use socat, create a virtual serial port, and use this port in arduino IDE. The virtual serial port created was working, but it's not visible in arduino IDE. I tried to look in source of arduino IDE, processing framework (processing.org), TXRX comm java library, how the the list of port was built, but I abandoned. For information, I use arduino ide 1.0.1, and I tried to name my virtual port /dev/ttyS5 as /dev/ttyS[0-9] seemed to be a pattern used to filter ports.

I don't need to solve this issue anymore, but if anyone have the information.. feel free to share.

Run the laptop remote: TeamViewer. http://www.teamviewer.com

Damn! How I couldn't think about a so simple solution...

Maybe because my first intention was to use a small headless linux box (NSLU2), but USB was only providing 4.5V, and arduino separately supplied in 12V had its 5V reg heating a lot. I kept the idea of serial over tcp, with a laptop...

Maybe because unconsciously I found the solution aesthetics and wanted to play with serial over TCP...

The single benefit was to work on 2*1920*1200 instead of 1300*768 display...

Anyway, if that would help somebody, that would be the second benefit.

I like the idea of using ser2net on the remote node the arduino is connected to, and socat or something else on another machine.,

If you are able to use teamviewer, that means you are being lazy and don't want to walk across the room, or down the hall where the arduino is.

The point this post was made to able simple,effective communications over a network using hardware that may not support something with a screen.

teamviewer is a great tool for remote fixing someone's computer, and maybe some other things, but decompresses the real use of arduino as a remote uController.

I have been using an HP thin client with 800MHz VIA Processor, 128MB RAM with maybe 128MB Flash, if not 64 to run tinycoreOS with ser2net. That methods works fantastic. This young man showed me something I should have done, and that was just make another network port with USB speeds faster for the IDE uses to program the arduino.

If I can get socat to work on my machines to avoid extra steps to program, then that would be great. If not, then I'll build alias cmd to do all that with on keyword. Then my arduino and network node will be dispatched in the coming days to start living the outdoor life. That will be one more project down.

excellent work my forward right thinking man! I am ecstatic about your work!