Go Down

Topic: Level shifting 3.3v to 5v only RX and TX pins (Read 183 times) previous topic - next topic

Hbadotti

Today at 02:22 am Last Edit: Today at 02:43 am by Hbadotti
Good night, I'm trying to solve a voltage problem in my project ...

Currently I changed my Arduino MEGA (5v) for an Arduino DUE (3.3v), I made all the adjustment of the sensors and etc (none needed a level shifter), however my display a Nextion 3.5 "works in 5v and I am trying to make the pins RX and TX work in 3.3v.



Here is the connection scheme I made:



But the Display does not respond to my commands, I tried to use this line:


Code: [Select]

void setup()
{
Serial2.begin(9600);
}

void loop()
{
Serial2.print("page carregamento");
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);
delay(2000);
}



This code worked when I used it in 5v, so the problem is not the code but the connection ...

So I thought of the hypothesis that the logical converter had to be energized, so I tried to call it this way:



But it also did not work ...


The display is on normally, but communication between the display and the arduino is zero ...


What am I doing wrong? Thank you.

DrAzzy

Where is your Serial2.begin(<baud rate>) statement in setup?

Without calling begin, passing the baud rate as it's argument, serial communications will never work.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Hbadotti

Where is your Serial2.begin(<baud rate>) statement in setup?

Without calling begin, passing the baud rate as it's argument, serial communications will never work.
That's true!! I forgot to wrote this part of code... Thanks a lot.

WattsThat

#3
Today at 03:13 am Last Edit: Today at 03:32 am by WattsThat
The wiring of the level shifting board is incorrect. Here are the correct connections:

Vacuum tube guy in a solid state world

Hbadotti

The wiring of the level shifting board is incorrect. Here are the correct connections:


It worked!!! Thanks a lot...

And a another question, why I've to supply to HV and LV and not only one of them?

WattsThat

Without the 3v3 supply, the RX line into the Due will not function.
Vacuum tube guy in a solid state world

DrAzzy

Level shifter needs both of the voltages it is shifting between (in a very broad sense, how else would the level shifter "know" what voltage to shift to/from otherwise?)
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up