I am building little box with screw terminals for Arduino (3.3V).
Because of 3.3V arduino I have to include voltage level conversion for serial and other pins.
I/O pins are nto a problem.
For serial voltage level shift I wanna use schematic from Arduino tutorials ( two mosfets BSS138 )
It is nice and easy circuit, but I have two questions regarding that circuit and software voltage selection:
In original circuit is power supply for one side 3,3V and other 5V,so..
Q1: will this circuit work if power supply will be for both sides 3,3V
Second question si quite more complex software voltage level selection:
I would like to use MCP23017 ( I2C I/O expander ) as power supply for voltage level shifting circuit ( just external side which is originally 5V ) So MCP23017 will be also supplied by 5V, its output pins will be equal to its power supply so 5V.
So one output pin of MCP23017 would serve as power supply for voltage level conversion circuit ( in case of 5V level desired for serial line ) and second pin of MCP23017 with resistor voltage divider will serve as power supply for voltage level conversion circuit in case of 3,3V desired.
Q2: could it work?
Thank you in advance for any advice or a feedback.
Regards Miro
That voltage level shifter is for the I2C bus. The I2C bus is a open-collector bus.
I'm not sure, but I think it will work when both sides are 3.3V, as long as the 'high side' is not below the 'low side'.
An output pin of the MCP23017 can be 20mA. That is enough for the I2C bus, so it is okay to use that to power the voltage level shifter.
However, the maximum output will be Vdd - 0.7V. That might have influence on the I2C bus.
Even an output pin of the MCP23017 with a voltage divider for 3.3V might perhaps work. But please don't do that. There must be a better way to do this.
If you have one main I2C bus, define that bus as 5V or 3.3V I2C bus and adapt all devices for that.
If the Arduino runs at 3.3V, why would you use a voltage divider to make another 3.3V ?
yes my DUE is 3.3V
Serial voltage means voltage of UART bus, for example for GSM modul which is available only in 5V version. I use that voltage level converter ( designed for I2C ) and it works just fine.
But because of future project variability and flexibility I would like to find the way how to control voltage logic level of UARTs by software. Because PCB will be inside metal box, so would be quite difficult to place any hardware dip switch outside of the box ( on front planel ).
So this MCP23017 was just an idea how to control voltage logic level for those UARTs. True is that I did not realize voltage drop you have mentioned. MCP23017 voltage drop would be problem only in case of 5V, because for 3.3V would be used resistor divider, so I would be able to scale down to exact 3.3V.
However for 5V TTL logic should be 4,3V enough as logic 1 , what do you think?
Sorry for my english.
I will appreciate any idea and feedback. Thank you in advance.
It is only for a UART TX/RX signal, and not I2C ?
And you want your DUE to be flexible for 3.3V or 5V UART signals ?
And you do not need a real RS-232 level of +3...+15 and -3....-15V ?
There are better ways to do that.
Transistors are often used, but also the 74HCT125 can be used.
To make an input that accepts both 3.3V and 5V is easy. But to get a good 5V UART output signal from the 3.3V DUE can be harder.
I have no good idea for the software selection to switch between 3.3V and 5V at the moment. Sorry.
If no one else has a good idea, you might start a new topic with a slightly other subject, like : "software selectable 3.3V / 5V uart signal".
Or try this question at www.avrfreaks.net There is a lot of specific hardware knowledge on that forum. If you do, add a link to this thread.
and yes, this software selectable, means I want to make my DUE uart flexible for 3,3V/5V
I am not interested in real RS232 at this moment.
I am not electro engineer, but maybe there is any simple solution even without selection.
Just reasoning:
5V TTL input is problem for DUE because more than 3,3V would damage CPU
3.3V TTL output could be OK for 5V device, if 3,3V would be able to pull it up as logic zero
So if I am correct, operating voltage of this "converter" could be 3,3V and 5V tolerant??
Question is it 3,3V will be able to pull up uart line of 5V device?
I don't like the idea to use a I2C level shifter for UART communication. But with very short wires, it should work.
Sometimes a CD4050 is used, it has 5V tolerant inputs if the chip is used at 3.3V.
You need a power supply of 5V for the 'high' side of that level shifter, to output a good 5V.
If you would only use the 3.3V signal for a 5V device, it depends on the hardware if it will be detected.
Do you have 5V if a 5V device is used ?
It is possible to let the DUE make 5V with a two diodes and two capacitors. I think the official name is "Dickson charge pump voltage doubler" (5 words for a circuit of 4 components).
It has 8 channels, I wanted to use I2C level converter because each channel could work with different voltage.
But I am glad you told me it is not a good option, it would be pity to find out when I spent a lot of money for PCB production and assy.
Also idea to supply I2C level converter with MCP23017 seems to be wrong.
I was also thinking to use DAC 0-5V to supply one side of logic level converter.
As first I would try that I2C converter which I have at home, how it will works if both sides will be at 3,3V power supply. But problem is that I do not have any 3,3V uart device
I could try this only with I2C device ( for example EEPROM or RTC ).