Using Vin as reference voltage for a Level Shifter

Status
Not open for further replies.

NicMagnier

New member
Hello,

I have a project with a Teensy 3.5 where I want to read the inputs on an old NES controller.

Because the controller sends 5V levels, I am using a TXB0104 level shifter (this one from adafruit) but I was not sure what would be the best way to feed 5V since the Teesny 3.5 is working with 3.3V

Looking at the Teesny schematic is realized that Vusb is actually 5V and because it is connect to Vin too I could simply connect Vin to the controller and the reference voltage for the TXB0104.
I was not able yet to read the NES controller input but so far I was able to have proper voltage on my outputs (as long as I reduce the CPU speed otherwise it seems it confuse the TXB0104 and the output has unstable readings)

My question is: is it really safe to use Vin to power 5V components in a project?

edit: the project is powered through the USB port.
 
If your T3.5 is connected to USB and you have not cut the VUSB/VIN connection, than VIN will have the voltage from USB which is typically pretty close to +5v which should be fine

A couple of notes/Questions:

a) Do you really need this level shifter? The T3.5 (like the T3.2) digital pins are 5v tolerant. They will output 3.3v but will not be hurt by 5v.

b) TXB0104 have a maximum speed they can run at.. I believe 100mbs, so you may need to put in delays to get the timings to work with the level shifter. Also not sure of how fast you can drive the shifter chip within the NES (https://www.allaboutcircuits.com/projects/nes-controller-interface-with-an-arduino-uno/)

c) If you use the chip you need to make sure that you wire it in the right direction: Port A can only go up to 3.6v where Port B can go up to 5.5v...

And as always it might help to see pictures showing wiring and/or code...
 
Thank for answering my main question.

I didn't go into the details of the project because I try to figure out as much as possible myself (I am very much a beginner in this field).

a. I am not sure 100% sure I need a level shifter but the shift register inside the NES controller is a CD4021B http://www.ti.com/lit/ds/symlink/cd4021b-q1.pdf
The datasheet seems to indicate it would need 5V to work so I just jump on the opportunity to play around level shifters. But I didn't properly test the volage tolerance of the chip. I just ran some basic example code (including the one you linked to) that would not work anyway because the T3.5 is so much faster than the Arduino Uno.

b. So the strange thing is that when testing the TXB0104 I simply use the following code
Code:
void setup() {
  pinMode(23, OUTPUT);
}

void loop() {
  digitalWrite(23, HIGH);
}

I assumed it would send a constant 3.3V voltage to the pin and that the CPU speed wouldn't matter but that's not the result I got. At 120MHz it was running too fast for the TXB0104 (I got a really fluctuating voltage in the 5V output) but it was running properly at 24MHz.

c. Thanks. Adafruit is kind enough to make it very clear on their board for people like me :)
 
Edit.... nevermind....I think I'm off track...

...The datasheet seems to indicate it would need 5V to work so I just jump on the opportunity to play around level shifters..
Topmost row of page 4 indicates minimum supply is 3 volts.

But the performance may be poor given the data provided about higher voltages.
 
Last edited:
I removed the level shifter, tweaked my timing when communication with the CD4021B and everything seems to run fine.

Using the 3.3V is a bit too weak and I get a lot of garbage but using the 5V on Vin is working pretty well.

Thanks everyone, that was easier than expected.
 
Status
Not open for further replies.
Back
Top