SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By pots
#146854
Hi All,

I have been having this issue for the past few days. I talking my first dive in to electronic's since a few kits as a teenager. Hopefully I am missing some small here.

I have a TP-Link mr3040 (3.3v) with a serial connection to the arduino uno. Common ground, the 3.3v on the LV side RX to TX to the HV on the arduino side.

My problem is I can only recieve data (on pin's 1 & 2) , I simply can not send any data on the pin's no matter what baud rate I use! The sketch works 100% :shock: only if I attached the /dev/ttyUSBx device directly as aposed to using the 3.3v serial pins with the level converter.
Code: Select all
void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
  Serial.print(1);
  pinMode(ledPin, OUTPUT);

}

void loop()
{
  // if we get a valid byte, read analog ins:
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
    digitalWrite(ledPin, HIGH);
    delay(10);
    Serial.print("Got: ");
    Serial.println(inByte);
    digitalWrite(ledPin, LOW);
  }
}
What could I be missing here?
By Joeisi
#146862
Are you sure you cannot get anything on the TP-LINK rx end? Like physically. Probe it with an oscilloscope or drive the pin high and then read the output. Make sure you level converter has the correct connections to it. Could you post a schematic? Hand drawn works.
By coyote20000
#146954
Just put a voltage divider between the HV and LV sides.
Arduino TX to 10Kohm resistor to 10Kohm resistor to ground.

Then...

3.3v RX side to the middle of the two 10Kohm resistors.

(All common ground)
(Yeah yeah yeah, before everyone complains, I know it will be 2.5v on the LV side) It works fine for me..
I did a search for the level converter and all I get is a wireless router..
By Joeisi
#146963
Wait! Going from low voltage to high voltage doesn't work like that. All of the current will drain through the 10k to ground. No voltage will be seen on the top side.Instead use a transistor, like the Logic Level Converter.
By coyote20000
#146972
pots wrote: I have a TP-Link mr3040 (3.3v) with a serial connection to the arduino uno. Common ground, the 3.3v on the LV side RX to TX to the HV on the arduino side.
Look again... He's connecting 5vdc Arduino TX to a 3.3vdc RX. All you need is a voltage divider...
By Joeisi
#146976
...I'm sorry I cannot read. Long day... I thought you were trying to hook up the TP-LINK RX to the middle of the two 10k's with the arduino rx on one end and ground on the other. Wow now I feel stupid.
By coyote20000
#146982
It's alright,
I just figured he might have the level shifter hooked up wrong or it's just not working..
By pots
#146985
Hi All,

I am using one of these Sparkfun logic level converters: http://www.sparkfun.com/products/8745 between the TP-Link and the Arduino, as I said a common ground and RX to TX on both sides. I will put a diagram together this evening.

Are you saying on the TX all I need is a voltage divider?
By coyote20000
#147012
Yes that looks correct.
The level converter has (2x) voltage dividers on it so if you ever need a converter to go from HV to LV that's all there is to it.

I still don't really know what a TP-Link is, except that it's a router. I'm not sure how you are tapping into a 3.3v serial line with that..

Supposedly the voltage divider on the level shifter uses two equal values (I'm not sure SF fixed this in current releases of the board). So if you put in 5vdc you will get 2.5vdc out of the shifter. For some circuits this is not enough to get up passed the logic '1' threshold. (some will work, some won't) Take a look at the first comment under the level converter page...
By pots
#147034
I ran the LV side through my multimeter and can confirm that the LV is 2.5v. I guess this explains why the exact same converter works on my Linksys WRT54GL and not on the less tolerant TP-LINK.

As I said I am fairly novice, what would be recommended to bump these voltages up closer to the 3.3v the router expects?
By coyote20000
#147074
HV to R1 (10K) to R2 (20K) to GND

Tap the point between R1 and R2 for 2/3 the HV. Approx 3.3v
LV = HV * (R2 / (R1+ R2))
LV = 5 * (20) / (30)
LV = 5 * (2/3)
LV = 3.333333333
By Joeisi
#147098
Why should we use more parts if we can get the regulated exact voltage off of the board? For sanitys sake.