wrt54gl

This example show how to connect Pinguino with a linksys router.


the firmware of the router is OpenWrt 8.09.1. Pinguino is connected on the serial port 1 with a 5V to 3,3V converter.
This the schematic of the converter:


Voltage on the WRT54GL pins is limited to ~4V. Input/output of the WRT54GL are not 5V tolerant.
This is a picture of the WRT54GL serial connector:


Now we need to write a simple program in Pinguino to test serial link with the WRT54GL.
First connect a led to Pin 0 of the Pinguino.
Connect Pin 8 to TX pinguino of the schematic and Pin 9 to RX pinguino.


void setup()
{
    pinMode(O,OUTPUT);
    Serial.begin(9600);
    Serial.print("Hello, This is Pinguino !!\r\n");
}

void loop()
{
if Serial.available()
    { 
    caractere=Serial.read();
    Serial.print(caractere,BYTE);
    if (caractere=='A') digitalWrite(0,digitalRead(0)^1);
    }    

}

Download this program to the Pinguino.

Then we need to install something on the WRT54GL to test link.
We will use ser2net wich is a serial to tcp converter.

Ser2net is in the openwrt repository, so you can install this package with LUCI ( web interface ) or via SSH with opkg.
opkg install ser2net

then we need to configure ser2net. Configuration file is in the /etc folder.
cd /etc
vi ser2net.conf

default interface name in ser2net.conf is /dev/ttyS1. The WRT54GL serial interface is /dev/tts/1 so, change this line:

2001:raw:600:/dev/ttyS1:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS

to

2001:raw:600:/dev/tts/1:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS


Save this file, then start ser2net:

ser2net

Now we will test connection with putty on the computer:

start putty, select raw mode and hit ip address of your router ( mine is 192.168.1.1 ) and select port 2001.
A blank windows should open, reset the Pinguino the message "Hello, This is Pinguino !!" should appear after some time.
hit A then hit return, the led on pin 0 should light. Hit A again and CR the led should be off.


 
Comments