Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   3V3 digital signal to the cRIO (http://www.chiefdelphi.com/forums/showthread.php?t=123755)

Mike Ounsworth 27-12-2013 09:14

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.)

McGurky 27-12-2013 11:13

Re: 3V3 digital signal to the cRIO
 
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/sh...d.php?t=101407

Joe Ross 27-12-2013 12:21

Re: 3V3 digital signal to the cRIO
 
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...s/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).

Quote:

Originally Posted by McGurky (Post 1317406)
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)

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

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.

yash101 27-12-2013 13:40

Re: 3V3 digital signal to the cRIO
 
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.

magnets 27-12-2013 16:13

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by yash101 (Post 1317435)
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.

Joe Ross 27-12-2013 16:17

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by magnets (Post 1317476)
Not quite. You only need 2 volts for TTL to read high,

correct

Quote:

Originally Posted by magnets (Post 1317476)
which is a zero, not a one on the cRIO.

Where did you get that information?

magnets 27-12-2013 16:22

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by Joe Ross (Post 1317477)
correct



Where did you get that information?

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

Tem1514 Mentor 27-12-2013 17:00

Re: 3V3 digital signal to the cRIO
 
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.

Thad House 27-12-2013 17:23

Re: 3V3 digital signal to the 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.

yash101 27-12-2013 20:01

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by sst.thad (Post 1317507)
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 :)

Thad House 27-12-2013 20:06

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by yash101 (Post 1317539)
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 :)

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

Here's the schematic.
http://www.usfirst.org/uploadedFiles...matic%20v7.pdf

Tem1514 Mentor 27-12-2013 20:24

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by sst.thad (Post 1317543)
Yeah they include a 10k Pullup to 5V inside the sidecar.

Here's the schematic.
http://www.usfirst.org/uploadedFiles...matic%20v7.pdf

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.

yash101 27-12-2013 20:38

Re: 3V3 digital signal to the cRIO
 
1 Attachment(s)
Are you talking about this excerpt (attached below)? It shows a set of pull-up resistors connected to the I/O.

Tem1514 Mentor 27-12-2013 20:55

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by yash101 (Post 1317557)
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.

Tem1514 Mentor 27-12-2013 21:27

Re: 3V3 digital signal to the cRIO
 
2 Attachment(s)
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.

nuttle 27-12-2013 23:55

Re: 3V3 digital signal to the cRIO
 
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)

efoote868 28-12-2013 00:05

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by nuttle (Post 1317592)
-- 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.

yash101 28-12-2013 02:10

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by nuttle (Post 1317592)
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)

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!

magnets 28-12-2013 08:34

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by yash101 (Post 1317605)
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.

yash101 28-12-2013 12:23

Re: 3V3 digital signal to the cRIO
 
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?

magnets 28-12-2013 12:55

Re: 3V3 digital signal to the cRIO
 
Quote:

Originally Posted by yash101 (Post 1317653)
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?

The code? Easy- Replace the 2 with any voltage you need.
Code:

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.AnalogChannel;

public class AnalogAsDigital {
    AnalogChannel analogInput;
   
    public AnalogAsDigital(int channel){
        analogInput = new AnalogChannel(channel);
    }
   
    public double getAnalog(){
        return analogInput.getVoltage();
    }
   
    public boolean getDigital(){
        return analogInput.getVoltage() < 2;
    }
}

As for the analog on the jaguar, you can use a gyro/other analog sensor if the output is 0 to 3 V, or any type of potentiometer or variable resistor.

From the datasheet
Quote:

Analog Input
The analog input accepts a 0-3 V sensor signal for implementing position control mode. Position control can
also be implemented with a single- or multi-turn potentiometer. Potentiometers with continuous rotation are not
supported. The Jaguar contains a built-in bias pin for use with 10kΩ potentiometers. If another potentiometer
value or analog source is used, it must have a 0-3 V range.
If the P, I, and D parameters are positive (or zero), the Jaguar expects that a forward condition (+ voltage on
White terminal, - voltage on Green) will generate an increasing voltage on the analog input.
If the P, I, and D parameters are positive (or zero), the Jaguar expects that a forward condition (+ voltage on
White terminal, - voltage on Green) will generate a decreasing voltage on the analog input.
The analog input is not electrically isolated.
Table 5 on page 6 lists the electrical requirements of an external control signal.

steinra 29-12-2013 18:01

Re: 3V3 digital signal to the cRIO
 
I guess I want to take a step back and ask the intent.

Are you simulating digital input to test programing on the cRio, or are you using it to pass information the Pi has already determined to the cRio to take action?

I ask because if you are looking to pass information it may be much easier to use i2c if you don't want to use hub points on the radio, or just pass the data between the two on an ethernet connection (UDP or TCP).

But if you are looking to simulate other sensor data then the other discussions here definitely apply. I would look at the logic level shifters from spark fun. That would be the safe way to do it.

yash101 30-12-2013 14:34

Re: 3V3 digital signal to the cRIO
 
Network isn't the best approach when you want to get the newest data with the least delay. Also, if you are processing a sensor a thousand times a second, offboard, you want a very fast and reliable connection. While ethernet can get close, it isn't exactly the "best" way to go!

It is also relatively easy to code i2C on the Pi compared to another technology because of the libraries out there and the documentation that they have!


All times are GMT -5. The time now is 12:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi