PDA

View Full Version : 5V to 3.3V communication



MOUNTAIN747
- 22nd January 2016, 16:37
I’m trying to use SHIFTIN between a 16f1936 at 5V and a 3.3V MAX31855 T-type TC to digital converter.

Question: What is the most common method for communication interface of a 5V device with a 3.3V device? There are three lines between the PIC and the converter. I didn't think about the problem until I could not communicate with two MAX31655 which means I may have smoked 'em.

Select 5V from PIC needs to be 3.3V I think
CLK 5V from PIC needs to be 3.3V I think
Data 3.3V from MAX should be OK

The PIC drives the Select line from high to low enabling the converter serial output. The PIC supplies the clock and the converter drives the data line as communication is only one way from the converter to the PIC. Will a 1k ohm resistor in the CLK line create any problems? Will a 1k ohm resistor in the Select line cause any problems? The Data line is being driven by the 3.3V converter and should not have any problems, PIC should be able to read 3.3V and lose no data.
Comments please!

Wayne

tumbleweed
- 22nd January 2016, 17:20
Select 5V from PIC needs to be 3.3V I think
CLK 5V from PIC needs to be 3.3V I think
Yup. You should use more than just a series 1K resistor, though.
You could use a voltage divider on the 5V PIC outputs...say 2K series/3K shunt to gnd. That should work ok at slow speeds.
You could also use a pullup resistor to 3.3V and drive the outputs as open-drain, but that's not compatible with SHIFTIN.


Data 3.3V from MAX should be OK
For the input pin be sure to pick a pin that has TTL level inputs (PORTA and PORTB) and not ST levels, otherwise the 3.3V output from the MAX won't meet the input Vih spec.

HenrikOlsson
- 22nd January 2016, 17:37
Hi,
There are bidirectional level shifter ICs available and you can do it with small MOSFETs and such but for a one-off I'd just use a voltage divider on the 5V to 3.3V signal and nothing on the 3.3V to 5V signal. (Doing that right now in my desk (PIC is 3.3V, device is 5V).

The MAX31855 logic high is min Vcc-0.4 so if you run it at 3.3V it'll put out 2.9V which is well above the 2.0V threshold of the PIC if you run that at 5V and using a non Schmitt trigger input...

/Henrik.

MOUNTAIN747
- 22nd January 2016, 18:13
Thanks guys,
I will take that and run with it. I think I'll bread board with the 2k/3k then look at a level shifter IC's' on the finial board work.
Thanks again!
Wayne

MichelJasmin
- 22nd January 2016, 18:26
Check out at Adafruit's breakout board. They have a nice solution: https://github.com/adafruit/Adafruit-MAX31855-breakout-board

Why not powering your PIC with 3.3V? That saves a lot of trouble.

8155

Dave
- 22nd January 2016, 21:01
Rather than buying expensive chips why not make your own with this app note:

MichelJasmin
- 23rd January 2016, 03:37
Rather than buying expensive chips why not make your own with this app note:

The Adafruit board is quite pricey but look how they did the level shifting. I did use this trick with an ESP8266, worked fine.

Dave
- 23rd January 2016, 19:27
I also used it for interfacing to some LINX RFM-433 receivers and LINX TFM-433 transmitters in my Hopps moisture monitoring system.

andywpg
- 24th January 2016, 01:42
I've used THIS (https://www.sparkfun.com/products/12009) on a couple of projects and love 'em.

MichelJasmin
- 24th January 2016, 02:58
I've used THIS (https://www.sparkfun.com/products/12009) on a couple of projects and love 'em.

Yes, works fine for me too. Do you want a second source (http://www.banggood.com/5Pcs-IIC-4-Way-Bi-Directional-Logic-Level-Converter-Module-p-951145.html)?

MOUNTAIN747
- 24th January 2016, 17:48
Thanks guys for all the tips. Yesterday I ordered an Adafruit breakout board with the MAX31855 on board with level shifting. I will see how well this works and follow their techniques. Looks like I could have saved a few bucks if I had checked this thread yesterday. Michel, if I power the f1936 at 3.3 I will have to buy a 3.3 LCD. Andy, the Sparkfun looks like the good solution to have in your toolbox for quick setups and they supply the schematic with part numbers, I’ll pick up a couple at that price!
Thanks,
Wayne

andywpg
- 24th January 2016, 19:31
Yes, works fine for me too. Do you want a second source (http://www.banggood.com/5Pcs-IIC-4-Way-Bi-Directional-Logic-Level-Converter-Module-p-951145.html)?

Thanks - good price.

Charlie
- 24th January 2016, 22:39
Any reason to not just run the PIC at 3.3V?

andywpg
- 26th January 2016, 00:16
Any reason to not just run the PIC at 3.3V?

In my case, some of the ic's I was using can ONLY run at 5V. The only thing that could only run at 3.3V was the XBee radio. So it was simpler to run everything at 5V and convert to talk to the XBee.