Hey Martin / all,

Oh there's much chin scratching and head shaking going on at our end atm...

Can we ask if we have the hardware configured correctly before moving onto software issues please:

Attached is the diagram of our 4051 mux'er.

This is what we have and aren't sure if it's correct
16 to 3.3v RPi
14 to SCL (sensor 1)
13 to SCL (sensor 2)
[Each SCL has 10k resistor and a feed of 3.3v from RPi]
11 to  P1-11 (GPIO 17) - RPi
10 to SDA (sensor 1)
9   to SDA (sensor 2)
7   to Ground
3   to SDA P1-03 (GPIO 0) - RPi

The power for the sensors is wired directly into 5v from the RPi.
The ground for the sensors is wired directly into the RPi.

I'm not sure if this has happened after running the code for the sensors but I'm now unable to access the i2c busses:

cat /dev/i2c*
cat: /dev/i2c-0: Input/output error
cat: /dev/i2c-1: Input/output error

I note from the code that we're now using gpio17 instead of the i2c busses which would account for that error I guess?

Few more coding issues but feel like we could do with some confirmation that the hardware's correct before moving on?

Cheers,

Julian


On 29 April 2013 16:38, Martin Peach <martin.peach@sympatico.ca> wrote:
Here's a patch to display data from two D6T sensors on the same I2C bus. The clock line is switched using a 4051 analog multiplexer. The control line is GPIO_17 of the Pi connected to A of the 4051 (B, C and Inhibit are at 0V). 10k resistors to 3.3V are on each sensor's clock line at X0 and X1 of the 4051 (I2C clock connects to X). Because the code accesses the GPIO file system it needs to be run as root. I have two different sensors so the code reads two different packet lengths. Just a proof of concept, there could be up to 8 identical sensors on the same bus with this setup.

Martin


On 2013-04-25 20:04, Julian Brooks wrote:
Just spotted this:
https://github.com/kadamski/i2c-gpio-param
Could be useful


On 25 April 2013 15:54, Martin Peach <martin.peach@sympatico.ca
<mailto:martin.peach@sympatico.ca>> wrote:

    On 2013-04-25 10:37, Julian Brooks wrote:

        'Nother 2 dumb questions:
        What's the difference between the ones that have
        spider/centipede type
        legs and the straight ones (which would be best to get).


    The PDIP package is what you want, not the SOIC. The only difference
    is size. DIP packages are human-friendly, surface mount is for robots.


        And also are you attaching the MC14051 to any type of
        board/adaptor or
        just soldering straight on to the pins?


    I have it in a breadboard right now, to make it more permanent I
    would solder a socket to a prototyping board then (after verifying
    the connections) plug the chip into the socket. Soldering to the
    pins makes it difficult to replace the IC, and risks damaging it
    with the heat if you're not good at soldering quickly and to the
    point. A CD4051 would also work, it's basically the same circuit.

    Martin