2
\$\begingroup\$

I want to use the third solution from this answer to step up three of my GPIO pins from my Raspberry Pi. 3V3 5V step-up

Would I need to make one of these circuits for each of the pins or could I, for example, replicate the bottom row again and increase the value of the resistor?

\$\endgroup\$
7
  • \$\begingroup\$ why do you want to do this? ... that circuit does not do any "stepping up" ... it pulls the 5 V logic input to ground otherwise it allows the input to float ... the resistor pulls up the input .... why do you need to use three GPIO pins? \$\endgroup\$
    – jsotola
    Jan 18, 2021 at 22:30
  • \$\begingroup\$ Welcome Jacob. Let me suggest you explain what you are trying to accomplish, rather than start with someone else's diagram. \$\endgroup\$ Jan 18, 2021 at 22:31
  • \$\begingroup\$ So what is the 5V device, and do you want a 3.3V output to drive a 5V input, or want to read a 5V output with a 3.3V input? \$\endgroup\$
    – Justme
    Jan 18, 2021 at 22:43
  • \$\begingroup\$ @Burt_Harris I'm trying to use the MAX7219, but this runs on 5V, and the Pi's GPIOs run on 3V3. \$\endgroup\$
    – Jacob
    Jan 18, 2021 at 22:44
  • \$\begingroup\$ @Justme I want to use a 3V3 output to drive a 5V input. The IC is a MAX7219. \$\endgroup\$
    – Jacob
    Jan 18, 2021 at 22:45

4 Answers 4

4
\$\begingroup\$

Using diodes is a bit iffy because the MAX7219 requires max 0.8 V low and min 3.5 V high. Diodes will just manage this, but noise rejection will be compromised.

A simpler solution might be to use a 5 V logic gate IC with TTL input levels (0.8 V low, 2.4 V high) from eg. 74LS or 74HCT series.

If you only need to buffer 3 outputs then any IC with at least 3 non-inverting gates will be enough. Suitable candidates include (where 'x' = eg. LS or HCT):-

  • 74x04 or 74x14 (6 inverters, wire pairs in series to produce 3 non-inverting buffers)

  • 74x08 (4 AND gates, tie one input high to make non-inverting buffer)

  • 74x34 (6 non-inverting buffers)

  • 74x86 (4 XOR gates, tie one input low to make non-inverting buffer)

  • 74x125 (Quad bus buffer, tie Enable input low to active output).

\$\endgroup\$
2
  • \$\begingroup\$ Clearly, active devices like these are more of a sure thing. But its not clear to me that he's working at the a level where assembling this from ICs. I've proposed a different answer using a TXB0104 level translator, which is available on breakout boards for hobby use. \$\endgroup\$ Jan 19, 2021 at 0:38
  • \$\begingroup\$ @Burt_Harris I do plan to build this on a PCB so the solutions above are best for this project, but thanks for your suggestions, I think I’ll pick up one of the shifters you suggested as I can see them coming in handy. \$\endgroup\$
    – Jacob
    Jan 19, 2021 at 8:38
2
\$\begingroup\$

Assuming you have both 5V and 3.3V power available, you can get a logic level shifter / translator to do the job. You might consider buying one on a breakout board like this: https://www.sparkfun.com/products/11771. Sparkfun makes the schematic available, if you want to incorporate it into your own board: http://cdn.sparkfun.com/datasheets/BreakoutBoards/TXB0104_breakout.pdf.

Adafruit has a similar breakout board: https://www.adafruit.com/product/1875

Another example, even less expensive: https://www.bananarobotics.com/shop/Pololu-4-Channel-Bidirectional-Logic-Level-Shifter.

\$\endgroup\$
1
\$\begingroup\$

If you connect your secondary board in "shield" style with a female header directly to the male header of the GPIO rows on the rPi, this is less important; if you have intervening wire (particularly parallel, unshielded, non-twisted) it will be more so.

If you want some amount of noise immunity both horizontally in time as well as vertically in voltage, combined with your unidirectional level shifting, you can use a single-IC (probably four-channel) bank of comparators in Schmitt trigger configuration. The negative reference divider only needs to be implemented once and can be shared among all gates. The positive passives need to be repeated.

First choose transition voltages based on the output voltage specifications of the Pi. 0.5V and 2.5V should be safe but you can change these. Ignoring the capacitive filtration for now, design for these ratios:

$$ \frac {R_1} {R_2} = \frac 9 5 $$

$$ \frac {R_3} {R_4} = \frac 2 5 $$

schematic

This shows transitions at the correct voltages:

transition transients

Then do some frequency analysis. You state a 60Hz frame rate. The IC you use requires a four-bit address in one byte, followed by one data byte. This means a minimum bit rate of

$$ 60 \text{ Hz} \cdot 8 \frac {\text{digits}} {\text{frame}} \cdot 2 \frac {\text{bytes}} {\text{digit}} \cdot 8 \frac {\text{bits}} {\text{byte}} = 7.68 \text{ kHz} $$

Your maximum bit rate for the display is 10 MHz. A happy medium is the standard 115.2 kHz. You need to balance the combined impedance of R3 and R4: if \$ R_3 + R_4\$ is too low it will put too much current load on the Pi; if \$ R_3 || R_4 \$ is too high the input leakage of the comparator will start to produce error and your filtration capacitor will become so low that it will be difficult to distinguish from parasitic capacitance. The chosen resistors will present a worst-case rPi per-pin current load of

$$ \frac {3.3 \text{ V}} {3 \text{ k}\Omega + 7.5 \text{ k}\Omega} \approx 314 \mu\text{A} $$

Connecting the capacitor shown in the diagram above and switching from a triangular wave to a square wave input, we see:

RC transients

The cleaned-up signal will see some small amount of delay; with the current time constant it's about 600ns which is about 14% of the square wave high-time.

Missing from this circuit are protection diodes. You could put them at the non-inverting node of each comparator so that R3 absorbs any transient energy. Be sure to consider the reverse-bias equivalent capacitance of the diode when doing so, to adjust C1 accordingly.

\$\endgroup\$
0
\$\begingroup\$

Would I need to make one of these circuits for each of the pins or could I, for example, replicate the bottom row again and increase the value of the resistor?

If you want to level shift many signals, you may find an integrated circuit such as the SN74LV1T34 useful.

However, if you want to use diodes and resistors to translate signals from 3.3V to 5V, using circuits such as you provided, then unfortunately you need to replicate that circuit for each signal you wish to translate from 3.3V to 5V. However, it is possible to purchase items such as diode and resistor arrays which may make life easier. For example:

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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