Below is a reference to a logical level bi-directional converter (aka level shifter) I purchased on Ebay. I've soldered the 12 pins (6 for each piece) to the level shifter so that it fits on my bread board.
http://www.ebay.com/itm/121868205078?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
This may sound trivial, but I'd like to troubleshoot the level shifter with communication both ways (Rx and Tx) to make sure it's working properly. I've got a constant 4.85v (5V) going to the HV pin, and a constant regulated 3.24V (3.3V) going to the LV pin, along with ground to both GND pins. Right now, I'm using pin0 (Rx) and pin1 (Tx) on the Arduino Mega 2560.
void setup() {
Serial.begin(9600);
}
void loop() {
delay(1000);
Serial.println("Test");
}
How can I test this level shifter without any fancy components? How could I write a program to toggle an LED both on LV1 and HV1 pins, by modifying the program above? Please note, that even though the Arduino runs on 5V, I am not using the Arduino as my HV power source.
EDIT (per comment 3 by @Paul):
Test:
- Burn blank sketch into Arduino
- Connect 5V (Arduino 5V) to HV pin
- Connect GND (Arduino GND) to GND pin on same side as HV pin
- Connect 3.3V to LV pin
- Connect GND (from 3.3V power source) to GND pin on same side as LV pin
- Connect Arduino Tx pin to channel 1 (HV1)
- Connect Arduino Rx pin to channel 2 (HV2)
- Short channel 1 to channel 2 with jumper wire
When all of this is connected, and I open the Serial Monitor on Arduino IDE, anything I type will echo back exactly what I typed. And when I disconnect one of these jumpers, it doesn't echo back. So it seems to work.
from output Tx -> HV1 (high) -> shifter LV1 (to low) -> wire -> shifter LV2 (to high) ->HV2 -> input Rx
if that succeeds, you can safely assume it's working for UART and that it's bi-directional.