0
\$\begingroup\$

I'm a programmer, not a wizard. I've read up as much as I can, including the similar questions list from this question, but, they blew by me pretty quick. So here we go:

A project I'm doing some code for started on Arduino, at 5V. It has a flow meter (Hall effect sensor) at 5V, a pressure transducer sensor at 5V, and a I2C LCD display at 5V.

Now the board is being changed from Arduino, to a 32bit board that will run at 3V3, and has zero 5V tolerant pins.

Here are my questions:

  1. The LCD at 5V is only getting input over I2C, but I worry that the 1s may be weak, so I'm going to add a bi-directional level-shift between the board and the display. Good idea? Unnecessary? Alternative ideas?

  2. The flow meter (Hall effect sensor), powered by 5V, sending input back to the controller... will it exceed the max threshold for 3.3V? I would think so, as I would think the pulse back is 5V HIGH. Can I use the same bi-directional level-shift as #1, as it has 4 channels? I would think so, as it is just coming back HIGH, in pulses.

  3. The pressure transducer sensor is analog, so obviously it is coming back at 5V. Can I use, yet again, the same bi-directional level-shift between the input and the board, or is there a better way?

I figure if I have to add a component(s), I might as well add the fewest possible, to limit the number of components that can fail. So if I can get away with a single 4 or 8 channel level shift... I'm happy.

Thanks!

I'd add in spec sheets for all the items, but they were just stuff bought randomly off Amazon, I'll do the best I can to give as much as I can find on them, since I don't know their internal components.

The flow meter is a -201 variant, YF-S201 is about the closest I've seen to having data on it.

The pressure transducer is linear, so, from description: 0-500 psi (Gauge Pressure) Output: 0.5-4.5V linear voltage output. 0 psi outputs 0.5V, 250 psi outputs 2.5V, and 500 psi outputs 4.5V

The LCD is a 204A variant. 20 characters, 4 rows

\$\endgroup\$
3
  • \$\begingroup\$ Does LCD have a tiny board attached to it? I suppose the I2C interface is provided by a PCF8574 chip which is widely used for this purpose. \$\endgroup\$ Jul 14, 2020 at 17:23
  • \$\begingroup\$ Yes @TirdadSadriNejad it has board and a PCF8574. \$\endgroup\$
    – dkkelso
    Jul 14, 2020 at 19:40
  • \$\begingroup\$ You cannot just throw a regular level shifter, even a bidirectional one, onto an I2C bus since it is a 2 way bus that depends on both sides being able to override the line to drive it low. Note the pull-up resistors on an I2C bus. They are what pull the line HI and anything connected to the bus (both slave and master) may override it by pulling it LO. \$\endgroup\$
    – DKNguyen
    Jul 14, 2020 at 23:15

3 Answers 3

0
\$\begingroup\$
  1. despite PCF8574 can work with 3.3v, the LCD itself can not. LCD needs 5V to show characters and the VCC of LCD and PCF8574 are tied together. so you may need a level shifter for it.
  2. YF-S201 working voltage is from 5~18v according to this. you need a level shifter for it too. (a simple resistor voltage divider would work). it's not open-drain according to the example arduino sketch provided by the link above.
  3. again a voltage divider would work as suggested by others. you may lose a little precision and may need to calibrate it.
\$\endgroup\$
1
\$\begingroup\$

As far as the LCD display with I2C interface, you need to figure out the Vih minimum to see if that's necessary. And to figure out if the particular MCU you have will tolerate I2C outputs pulled up to 5V. If it's the PCF8574 as Tirdad suggested in a comment you may need a voltage translator since it requires 0.7 * Vcc for a '1'. If it is required you can use the typical MOSFET + resistor level shifter. I would suggest avoiding the automatic bidirectional chips unless you're willing to do enough analysis on drive capability to assure they will actually work reliably.

If the flow meter is open collector you can just pull it up to 3.3V, and if the inputs are 5V tolerant you can use it whether it's 3.3V or 5V.

For the analog input, a voltage divider will work (see your MCU datasheet for guidance on the maximum resistances allowable). However note that if it's ratiometric to the 5V supply you will suffer some accuracy and stability loss if your reference on the MCU is the 3.3V supply.

Note: I didn't touch on protecting inputs that go off the board into the field, but that's an important part of a reliable design.

\$\endgroup\$
0
\$\begingroup\$
  1. not needed "1"=2.5 to 6V
  2. R divider 10k series to 15k load = 3V is ok.
  3. Need analog divider again in 10k~50k range to scale 5 to 3 to 4.5 to ?
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.