[PD] Sensors GPIO Raspberry Pi Pd

Martin Peach martin.peach at sympatico.ca
Mon Apr 8 00:14:35 CEST 2013


On 2013-04-07 17:42, Julian Brooks wrote:
> Thanks Martin, really useful stuff.
>
> I've got i2cdetect on the RPi which is how I knew that [gpio] was
> setting hi & lo.  And good to hear you'll be wrestling with this on the
> Pi as well.
>
> In some ways this is good news as we've setup everything from the
> 'instructables' page already and now just need to get the bloody thing
> going (have to to sort the housings out).
>
> Another possible issue is that from my reading it seems that the RPi
> doesn't do 'clock-stretching', though I have found a link where they
> slow the i2c bus down.
> http://www.hobbytronics.co.uk/raspberry-pi-i2c-clock-stretching
>
> Another one here too:
> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=34734&p=294297&hilit=i2c+gpio+direction#p294297
>
> That's interesting as they talk about setting up more GPIO pins for i2c
> to run 2 sensors.
>
> Not being able to change the sensors address is a real pain though, as
> one of the things that I keep reading about i2c is it's ability to run
> up to 128 sensors on the same line - kinda defeats the object!  Must be
> a way round it.
>

Maybe there's a way to program the address but so far its a secret known 
only to Omron.

> "You can use the 5V from the GPIO header on the pi. From the schematic
> pin 2 is 5V. Ground is on pin 6. Pin 3 is the i2c data and pin 5 is the
> clock. Pullup resistors are already installed on those lines."
>
> Yes, found a good diagram for the GPIO schematic.
> http://elinux.org/RPi_Low-level_peripherals#GPIO_hardware_hacking
>
> My understanding was that what we can't do is send data from the sensor
> at 5v back into the RPi at 3.5v and it's there that we need to drop the
> voltage back to 3.5.  Noticeably though the 'instructables' link says
> they just did it anyway and was fine (with a disclaimer attached on to it).
>

The schematic for the RPi shows the resistors already installed, you 
don't need to add any. The resistors pull the bus voltage up to 3.3V 
when nothing is driving it to ground. Nobody is sending 5V signals, the 
i2c bus is either driven (clamped to 0V) or not driven, in which case 
the resistors bring the voltage to 3.3V, which is high enough for the 5V 
sensor inputs to read as 1.


> We got some 4.7k resistors as you recommended - do we only need these
> before the sensors?  The pdf from digikey has a diagram with a voltage
> transformer that we've been presuming is what we need to do?? Presumably
> if we put more resistors next to the Pi then we wont have enough voltage
> to lift the pin high (many ???).  There's also lots of code (C?) on that
> pdf, anything you've made use of?
>

Yes that's what I got the crc calculation from, but as I said it doesn't 
give me the right result :(

> This is the little add-on board
> http://adafruit.com/products/757
> I did read it's doable with mos-fet but seemed like another layer where
> we can screw-up so have taken the simple option.

Yes you don't need any level shifter, the pullup resistors are enough, 
both 3.3V and 5V systems use the same voltage for 0.


Martin




More information about the Pd-list mailing list