3V3 digital signal to the cRIO

I am using a Raspberry Pi to send a digital I/O to the cRIO. I know that the Pi uses 3.3V (3V3) for a True, while the cRIO expects a 5V signal.

I know that with some combinations of hardware this is fine, and others cause problems. Does anyone know about the Raspberry Pi / cRIO combination?

(Note and warning: I know that putting a 5V signal into the Pi will fry it, I’m asking about the Pi --> cRIO direction.)

Like you have said, and others have tried, running a 3V3 signal into the cRIO will not trigger a logic high for the cRIO. You must use some type of logic level converter(LLC) to perform the task you are desiring. (3V3–>5V)

Picking the proper LLC depends on the frequency of switching that your application requires as well as the type of signal you are running (i.e is it bidirectional or not). However, without knowing this, I can at least point you in the right direction to start looking…

Sparkfun Electronics sells a cheap LLC board that is run off of the BSS138 Transistor. It should work for you, and has worked for other teams

Link to Board
Link to Schematic
Link to Transistor Datasheet

Also, here is a relevant thread from last year: http://www.chiefdelphi.com/forums/showthread.php?t=101407

The 14 DIO on the digital sidecar are connected to the NI 9403 digital module, which specifies 5v TTL. a 5v TTL input is compatible with 3.3v CMOS output. Vih for 5v TTL is 2v, while Voh for 3.3v CMOS is 2.4v. There is reduced margin, but it was designed to work. I have not tried it, however. Sparkfun has a nice tutorial on logic levels: https://learn.sparkfun.com/tutorials/logic-levels/introduction. However, because the digital sidecar has a 5v pullup, you should not connect them to the Raspberry Pi, but could be used with 5v tolerant 3.3v logic.

I could not quickly find a spec on the DIO for the Raspberry Pi, so you would have to make sure it conforms to 3.3v CMOS logic levels.

Other signals on the digital sidecar do not go directly to the 9403 and would have to be evaluated independently (like I2C).

Do you have another example besides that thread? It sounds like the problem was not powering the IMU from the right power source, rather then a logic conversion problem.

I would say, if you have a two way connection with one direction per line, the RPi tx can be directly connected to the rx on the crio. However, you would need a resistor in the rx of the pi. Are you using i2C or SPI, etc? I use a 5v UART connection with my pi to access terminal via serial.

5v requires 2v5 to register a 1.

Not quite. You only need 2 volts for TTL to read high, which is a zero, not a one on the cRIO.


Where did you get that information?

I can’t find it in any documentation, but I just remembered this, and thinking it was counterintuitive.

If all else fails you could always make up a converter with any open collector transistor. Off the top of my head a MPSA14 or MPSA13 would work very nice to change the 3.3 to 5 volt. All you need is to drive the base with the 3.3 logic and then use a 4.7K pullup to cRIO 5 volts on the collector. Be sure to use a common ground between the PI and cRIO.

You actually DO NOT want to directly connect a pin on the Pi to a pin on the Sidecar. The sidecar has an internal pullup to 5V in it. Putting that 5V to the Pi could destroy the Pi. Either a Pull down, voltage divider, or logic converter would be needed in order to protect the Pi. The CRIO can take up to i think 24v on an input, so no need to worry about damaging the CRIO at the levels you are using.

That 5V comes from the Sidecar even if it is set as an input, so it needs to be worked out even if the CRIO is set as input.

That could be true. I am kind of comparing to the BASIC stamp which has 5v I/O. Just stay safe and buy a cheap level shifter. $5 could save you from buying more $35 RPis, so being safe-than-sorry would also be the cheaper way in this case.

Is that true that the pin is held up? That reduces some of the nightmares I have, about limit switches having the pins floating, so thanks :slight_smile:

Yeah they include a 10k Pullup to 5V inside the sidecar.

Here’s the schematic.

Thank you sst_thad I forgot about the 10K inside the sidecar. Using the MPSA transistor will work just fine in an open collector configuration to change the Pi 3.3 V to the cRIO 5 V level.

Just as a side note, I have a 5 volt micro computer stand alone system that is used to drive an ‘H’ bridge that runs at 24 volts with no problems handling the two voltages.

As long as you use the transistor between the Pi and Digital side car no problem as the transistor will act as the buffer between the two.

Are you talking about this excerpt (attached below)? It shows a set of pull-up resistors connected to the I/O.

That’s the one and you are interested in the GPIO [1-14] as they are the digital inputs on J26 for the Rev 7 digital sidecar. You made me pull out my book.

Here is section of my ‘H’ bridge that is driven by TTL 5 volt logic and then will either source B+ (24 volts) or sink the 24 volts.

The TTL control signals are on the right hand side and called;
COL3 when logic high will source B+ (24 volts) through Q11 (TIP127)
With the help of Q33 (MPSA14) that is used an a inverted in this case.

COL3’ when logic high will sink the B+ through Q22 (TIP122)

Just a side note here, NEVER put a logic high on both COL3 and COL3’ at the same time as it will create a short from B+ to ground and blow the fuse F11.

For your application all you need is COL3 (Output from PI) R22 (220ohm) R55 (1K) and Q33 (MPSA14). The point where Q33 connects to R33 is not needed but instead would go GPIO [1-14] on the digital side card.

So just three parts and your Pi can talk to your cRIO. I am sure there is a I/C chip that will also work but I don’t have my data books handy.

If you need more help just ask.

The other picture is the actual boards in the project.

A couple of other possibilities:

– Use an analog input, instead of a digital one (via the analog breakout board, I mention this mainly in case someone comes along, reads this, and wants something easy and quick)

– Use an opto-isolator (this not only level shifts, but avoids potential problems with ground loops – you probably don’t need to worry about this, but it is very good to be aware of and on the lookout for this type of problem)

Quoting this because I’d recommend it in most generic situations.

An opto-isolator is a splendid idea that will almost always work. Why did someone not already bring it up?!?! Kudos to you ;).

Using an analog signal would be getting a little off from what we want here. For something like the raspberry pi or propeller would be hard to interface with a DAC/ADC couple. On the RPi, I don’t know if you’d even have enough GPIO!

I think the idea behind the analog inputs is to use the analog module on the cRIO because it doesn’t have a pull up resistor like the digital ones do. You can make the analog input behave like a digital input and return true if the voltage is above 2v, and false if it is below, without having to worry about the pullup resistor to 5v.

Ah. I get it. However, that seems a little complicated because you will need to craft the code to emulate DI/O. I’m just wondering but has anyone succeeded in using the analog communications with the Jags?