Connecting Arduino and WRT54GL with max3232

Hi, I am trying to read from Arduino which is a TTL board into a router that works on LVTTL (3.3v) called WRT54GL, with max3232.

I've first done these tests: 1. Connected TX of serial port of the router to Arduino directly, and issued commands, and all work fine. 2. I shorted TX and RX of the router to test if the port is working properly. I issued "echo hello" from TX and I had it right from RX back to the router. So this also worked fine.

Next, I used a schema I found online to connect them via max3232. I repeated the above test #1, but with the max3232 added in the middle, and it failed to work. I checked things more than 15 times, but no result. I'll provide the schema I used here, please give some ideas to help!

Shouldn't the TX and RX from the arduino be swapped??

Arduino RX to pin 14 Arduino TX to pin 13

You don't need (or want) a max232; both the Arduino and the router are operating at digital signal levels. Now, the router has 3.3V signals and the Arduino has 5V signal levels, but a max232 is not the right chip to interface them (I guess you COULD use two - one to convert the arduino to rs232 levels, and one to convert the router to rs232 levels, but that seems excessive.)

You may be able to connect them directly. Sometimes 3.3V chips are "5V tolerant." Otherwise, the router output is compatible with the arduino input, and the arduino output could use a simple voltage divider to connect to the router input.

You could just use a couple of transistors to pull the 3.3v up to 5v and the other way round. Might be the simplest solution.

Thank you!

  1. You are right, I corrected the RX, TX locations on the photo, but still I receive no input in the router, or strange characters! If I send "hello world" from Arduino to the router, sometimes I get some wild characters, sometimes nothing!

  2. The chip I am using is max3232, and it is NOT max232. Its family is recommended for this usage. For instance please look here:

  3. Sure I first tried with a voltage divider, as explained here: (I have ssc-32 too and I am repeating all test with it too).

  4. The router is healthy, i.e. when I short TX and RX of it together, I can successfully send commands.

  5. I also tried with transistors as explained here: but also no result.

  6. Any new idea that I've not tried? :(

I know it's a silly comment, but, I have done it in the past.... you have got the serial speed set right? :p

Thank you! Every comment is appreciated. I personally don't label anything "silly".

Yes, I have them set right, I rechecked this.

Some progress!

I wrote this sketch:

//test wrt54gl router serial communication
char val = 0;
int RedPin = 10;
int GreenPin = 8;
int BluePin = 9;
int HelloPin = 4;

void setup()
  pinMode(GreenPin, OUTPUT);
  pinMode(RedPin, OUTPUT);
  pinMode(BluePin, OUTPUT);  
  pinMode(HelloPin, INPUT);  
  digitalWrite(GreenPin, LOW);
  digitalWrite(RedPin, LOW);
  digitalWrite(BluePin, HIGH);

void loop()
  while (Serial.available()) 
    //digitalWrite(GreenPin, LOW);
      val =;
    if ((char)val == 'A')
      digitalWrite(RedPin, LOW);
      digitalWrite(GreenPin, HIGH);

and I’ve got some output that shows the serial connection indeed exists, but it is somehow “noisy” or has errors.

When I put HIGH on my 4th pin, I get a strange repeating character chain, in place of “hello\n\r”. Then, after I just remove the pin, I get lot of strange characters too, but repetition is stopped. The behavior is regular: when I connect HIGH to the 4th pin the repetition starts and by disconnecting, it stops. I provide a shot screen here. The upper side are what I receive in place of “hello”, which is regular repetition, and the second part is the strange unwanted characters.
Any ideas?!

hmm. very confusing, looked at the characters recived and I concluded this...

sending hello in binary 0110100001100101011011000110110001101111

recived /5''! in binary 0010111100110101001001110010011100100001

shift bits 1 bit to right (highlighted by *) you get the inverse of what it should be 0010111100110101001001110010011100100001 - you received *0010111100110101001001110010011100100001 - shifted 0110100001100101011011000110110001101111 - should be

Hope this helps in whats happened

Hi Ironbot

Over the chrismas holidays last year I was trying to do exactly what you want to do, namely hook up an arduino to the serial port and use firmata on the Arduino to allow me to put the WRT54GL to better use than its current job.

As westfw says don’t use a max 232 because you will blow the Arduino for sure. The arduino and any other microcontroller is ideal to interface with WRT54GL because they both have serial ports running at logic levels and there is no need to worry about drivers like the 232. What you will need is a level translator something simple like this is what I was going to use.

I never proceeded with the project because I was struggling with getting a working Openwrt toolchain so that I can compile my own programs. I suspect the problem was because I was running Linux under windows, but I was getting lots of little compile time errors which I was combating but it to much time. I didnt have the time to back up my hard drive and install a proper linux install so that I could do it natively under linux.

At present the WRT54GL is sitting gathering dust but I plan to go back to this project. But for me its useless unless I can compile my own code to run on the WRT54GL, but I might just go back to that project again now.

Many thanks for your calculations!
Now I am very tired, but after some rest I will try to write a program that does the conversion you suggest in Arduino, and then send serial to the router. I think it will be the solution! (hope) :slight_smile:

Many thanks for the suggestion!
Indeed as I explained in posts before this, I tried all the various implementations I could find over the internet, including transistor solution you mentioned. None of them gave ANY data I could work on! This max3232 is not exactly max232! It is different and exactly used for both 3.3v<->RS232, AND, 3.3v<5v logic conversion. So I will hold on it and try to interpret this output I have. Actually, my main purpose is to use a motor controller called ssc-32 with the router, which has the same problem now, and Arduino is a test-tool here.

Hey Ironbot Iam m doing the same kinda project but with a diff. micro-controller (atmega32).

Please can u tell me how did u test the serial port of the router in detail.

Your reply will be really appreciated .

Zeon, sure I'll help! I've written a lot on this subject and published my screen shots. Please read this thread I made and if anything, feel free to contact:

hey Ironbot thanx 4 ur reply

Well i got the serial port working finally!!!! \m/

Just 1 thing the commands in ssh 4 me dont wrk with '#' preceding !! will tht be a problem well m new 2 this programming stuff so still a noob

Tell me your configuration. Better: draw a block-diagram, or post a photo, and I'll try to help! Commands to ssc-32 must contain #, as this is telling the position of motors to the controller.


I am doing a similar project these days: A Wifi routerbot. I still have a lot of work to do but I’m slowly getting there I think.

For the Arduino (5V/Gnd ttl serial) <-> WRT54G (3.3V/Gnd ttl erial) connection I just used the logic level convertor from Sparkfun :

It’s a very simple connection to make between the two. I have already been able to send an ASCII table (one of the Example Sketches in Processing) from my Arduino to my router.

I have dd-wrt installed on it and listened to the serial input by typing:

cat < /dev/cua 1

and I saw the whole ASCII table streaming in, which was nice :slight_smile:

I can’t get the communication to work in the other direction though.
This is the sketch I uploaded into the Arduino:

void setup() {

void loop() {}

Then I typed the following in the ssh session on my router:

echo Hello > /dev/cua/1

I get no response in my serial port monitor on the arduino side… I think the problem may be in the arduino code, maybe I have to tell the arduino not to listen to the hardware serial port (USB) but to the Rx Tx pins (0 and 1)?

i have a much easier way do use the wrt54g with the arduino ;). i have mine setup as a wireless com port to control my wifi rc car. its pretty simple just follow this its real simple the only problem i had was getting it to run at startup but that was an easy fix just post if you need my startup script.

p.s. no level shifting is needed . i have had mine hooked directly to the router with a small 3 pin connector for over a month with no probs

My problem is not the hardware connection between Arduino and WRT router. I think I've got that part right (I can send serial data from the Arduino to the router).

I just don't know if I make the Arduino listen to the router serial output the right way.