Darranking
Posts: 46
Joined: Thu May 31, 2012 9:14 pm
Location: UK

I2c to arduino

Mon Sep 17, 2012 7:47 pm

Hi

I am going to connect my pi to my arduino using i2c. I know that the pins on the pi are 3.3v and the arduino 5v so some sort of level shifter will be required on the arduino pins to protect the pi.

Assuming that a resistor voltage divider is to a good idea then can anyone suggest what ic level shifter I need to do the job and do I need one for the sda and scl lines

User avatar
PeterO
Posts: 6039
Joined: Sun Jul 22, 2012 4:14 pm

Re: I2c to arduino

Mon Sep 17, 2012 8:00 pm

You would be better off using something like this:
http://www.skpang.co.uk/catalog/logic-l ... p-511.html
It's bidirectional so will work for the SDA signal on i2c. In fact you don't need the two resistive dividers at all , just the two mosfet channels.
I'm using one of these between RPI and some MCP23017s running on 5V.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Darranking
Posts: 46
Joined: Thu May 31, 2012 9:14 pm
Location: UK

Re: I2c to arduino

Tue Sep 18, 2012 11:26 am

PeterO wrote:You would be better off using something like this:
http://www.skpang.co.uk/catalog/logic-l ... p-511.html
It's bidirectional so will work for the SDA signal on i2c. In fact you don't need the two resistive dividers at all , just the two mosfet channels.
I'm using one of these between RPI and some MCP23017s running on 5V.
PeterO
Thanks Peter

I have had another idea, I was going to use the arduino to run some one wire sensors but I have some DS2482-800 one wire bus devices that I believe will run at 3.3v and are i2c so I guess I could dispense with the arduino and just use these with the pi without the level shifter

natm
Posts: 1
Joined: Wed Sep 26, 2012 11:20 pm

Re: I2c to arduino

Wed Sep 26, 2012 11:23 pm

I wrote a 2 articles connecting the RaspberryPi to an Arduino using I2C, these might be helpful:

http://www.natmorris.co.uk/2012/09/i2c- ... ino-part1/
http://www.natmorris.co.uk/2012/09/i2c- ... ino-part2/

The next part will cover sending data from an Arduino back to the Pi.

Nat

User avatar
PeterO
Posts: 6039
Joined: Sun Jul 22, 2012 4:14 pm

Re: I2c to arduino

Thu Sep 27, 2012 8:52 am

Useful stuff there Nat. I'll be giving this Pi <-> Arduino stuff a try myself soon.

I'm building a board for a project that has several 23017s on it to monitor ~ 50 push buttons.
Using i2c I'll be able to connect it to my RPi or my Arduino-Mega. Hopefully the code will be very similar on both platforms.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

raspberrypivictim
Posts: 30
Joined: Sun Jan 22, 2012 10:35 pm

Re: I2c to arduino

Tue Oct 23, 2012 7:02 am

The new Arduino Due runs at 3.3 V http://arduino.cc/en/Main/ArduinoBoardDue

I am not sure, but does this mean we could wire an Arduino Due to a RaspberryPi without mosfets, level converters or that kind of staff? just wires and pull up resistors.

Thank you very much in advance

User avatar
TonyD
Posts: 453
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: I2c to arduino

Tue Oct 23, 2012 12:30 pm

raspberrypivictim wrote:The new Arduino Due runs at 3.3 V http://arduino.cc/en/Main/ArduinoBoardDue

I am not sure, but does this mean we could wire an Arduino Due to a RaspberryPi without mosfets, level converters or that kind of staff? just wires and pull up resistors.
There's no need for level shifters if both systems are 3.3V, so you can connect the RPi I2C straight to Arduino Due. I'm sure the RPi can only be a I2C master so you'll need to set the Due to be a slave.
Tony

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2c to arduino

Tue Oct 23, 2012 10:01 pm

raspberrypivictim wrote:The new Arduino Due runs at 3.3 V http://arduino.cc/en/Main/ArduinoBoardDue

I am not sure, but does this mean we could wire an Arduino Due to a RaspberryPi without mosfets, level converters or that kind of staff? just wires and pull up resistors.

Thank you very much in advance
As both 3V3 just connect them together and ensure Arduino Due set as slave with NO pullup resistors.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Return to “Automation, sensing and robotics”