Wifi Robot – 2

Adding a Serial Port (Usb To Serial Converter) To TL-MR3020.

To connect a arduino, a serial port is necessary. I have used here a FT232RL usb to serial converter to acheive this.

The software installation/settings script is here. You must install drivers, and for communication,  socat is necessary.  The program ser2net hangs after few hundred bytes transmission.

You dont need to add a startup script (this socat tcp-l:1234,reuseaddr,fork file:/dev/ttyACM0,nonblock,raw,echo=0,waitlock=/var/run/tty,b9600) directly to /etc/rc.local or system>startup. I don’t know why but it hangs the function of indicator leds. Though the router works fine.

Instead you need to add this script (somewhat edited from here) to a file via winscp.

Say the file name is /etc/serial1234.sh

[code language=”powershell”]

#!/bin/ash

DEV=/dev/ttyUSB0
PORT=1234
BAUD=115200

while true; do
if [ -e $DEV ]
then
socat tcp-l:$PORT,reuseaddr,fork file:$DEV,nonblock,raw,echo=0,waitlock=/var/run/tty,b$BAUD
else
sleep 2
fi
done
[/code]

Save this script and make this executable. And then system>startup tab or, /etc/rc.local before exit 0 add a line. this file should look like this.

[code language=”powershell”]

# make sure it’s above ‘exit 0’!

/etc/serial1234.sh &

exit 0

[/code]

Then the program socat will run whenever you connect the FT232RL in the USB port.  And you can connect it by putty at your routerip:1234 and RAW connection.

After this i will make a vb program to connect without putty and control arduino by keyboard buttons. Of course I must program the arduino too.

More about this comes later.. till then…

Comments are closed.