<div dir="ltr"><div><div>Hi Martin,<br><br></div>Meant to add re setting baud rate:<br></div><div>I&#39;ve been making use of the gpio utility that comes with wiringPi<br><a href="https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/">https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/</a><br>
</div><div>Very handy for getting a quick visualisation of the current state of all the pins and also easy-access to setting the baud rate too (amongst other stuff).<br><br></div><div>Julian<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 19 April 2013 14:36, Martin Peach <span dir="ltr">&lt;<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Julian,<br>
Yes I&#39;ve been messing with coding it in c on the pi and sending the data to a [netreceive] in a Pd patch on another machine. I&#39;m attaching the source code for the pi part and the Pd patch.<br>
The code can be compiled on the pi with<br>
gcc -o hello hello.c<br>
You need to set the IP address of the receiving machine in the code (I have 192.168.2.15, it could be 127.0.0.1 for the same machine).<br>
I tried changing the baud rate with<br>
sudo modprobe -r i2c_bcm2708<br>
sudo modprobe i2c)bcn2708 baudrate=90000<br>
but it works fine at the default 100000.<br>
It seems that you only need to write the command once, after that simply reading gets you another packet. Using a combined write/read operation only works half the time, as I also found on the Arduino. All you need to do is write the 0x4C command once, wait a millisecond or so and then read it.<br>

Another issue is that I tried this with the 8X1 sensor, not the 4X4 one, so the code reads 19 bytes (need to change the expected read size in the code). The 4X4 sensor sends 35 bytes which is 3 more than the i2c driver maximum, so you may not get the last part of a packet.<br>

I&#39;ll try it later with a 4X4 sensor to see what happens.<span class="HOEnZb"><font color="#888888"><br>
<br>
Martin</font></span><div class="im"><br>
<br>
On 2013-04-19 07:01, Julian Brooks wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi Martin,<br>
<br>
Did you manage to make any progress with the sensor on the Pi?<br>
I also wanted to ask whether the output we&#39;re receiving from i2cdump<br>
makes any sense to you as it doesn&#39;t to us currently?  Tried searching<br>
around for possible info on the &#39;XX&#39; &amp; &#39;ff&#39; but drawing a blank here.<br>
<br>
Cheers,<br>
<br>
Julian<br>
<br>
<br>
On 13 April 2013 01:11, Julian Brooks &lt;<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br></div><div><div class="h5">
&lt;mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>&gt;&gt; wrote:<br>
<br>
    Hey all,<br>
<br>
    Some success finally:<br>
<br>
    Hurrah!!<br>
<br>
    The scl breakout pin on the pi proto plate wasn&#39;t working properly.<br>
<br>
    When unscrewed halfway it works, when fully screwed in it doesn&#39;t.<br>
<br>
    So - now got this:<br>
<br>
    i2cdetect -y 0<br>
<br>
    0 1 2 3 4 5 6 7 8 9 a b c d e f<br>
<br>
    00: -- -- -- -- -- -- -- 0a -- -- -- -- --<br>
<br>
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>
<br>
    70: -- -- -- -- -- -- -- --<br>
<br>
    and<br>
<br>
    i2cdump -y 0 0xa<br>
    No size specified (using byte-data access)<br>
<br>
    Gives a whole host of stuff I don&#39;t yet understand but I don&#39;t care<br>
    currently as something is actually happening.<br>
<br>
    Will figure out a way of saving the console info (any hints<br>
    anyone?)  as it gets badly mangled when cutting and pasting  but<br>
    basically something like this:<br>
<br>
    i2cdump -y 0 0xa<br>
    No size specified (using byte-data access)<br>
          0  1  2  3  4  5  6  7  8  9  a  b  c  d  e<br>
    f                      0123456789abcdef<br>
    00: ff XX XX XX XX XX XX ff XX XX XX XX ff ff ff XX    .XXXXXX.XXXX...X<br>
    10: XX ff XX XX XX XX XX ff XX ff XX ff XX XX ff XX    X.XXXXX.X.X.XX.X<br>
    20: ff XX XX ff XX XX ff XX XX XX XX ff XX XX XX ff    .XX.XX.XXXX.XXX.<br>
    30: XX ff XX ff XX XX XX XX ff ff ff XX XX XX XX XX    X.X.XXXX...XXXXX<br>
    40: XX XX XX ff XX ff XX XX XX 64 XX XX d5 XX XX ff    XXX.X.XXXdXX?XX.<br>
    50: XX ff XX XX XX XX XX XX XX ff XX XX ff XX XX XX    X.XXXXXXX.XX.XXX<br>
    60: ff XX XX XX ff XX XX XX XX XX XX XX XX ff XX XX    .XXX.XXXXXXXX.XX<br>
    70: XX XX XX XX XX XX XX ff XX XX XX XX XX XX XX XX    XXXXXXX.XXXXXXXX<br>
    80: XX ff XX XX ff ff XX XX XX ff XX XX XX XX XX XX    X.XX..XXX.XXXXXX<br>
    90: XX XX ff XX XX ff XX ff XX ff ff XX XX ff ff XX    XX.XX.X.X..XX..X<br>
    a0: XX ff XX XX ff XX XX XX XX XX XX XX XX XX ff XX    X.XX.XXXXXXXXX.X<br>
    b0: XX XX ff XX XX XX ff XX XX ff XX XX XX XX XX XX    XX.XXX.XX.XXXXXX<br>
    c0: XX XX XX XX ff XX XX ff ff XX XX ff ff XX XX XX    XXXX.XX..XX..XXX<br>
    d0: XX XX XX XX XX ff XX ff XX XX XX XX XX ff XX ff    XXXXX.X.XXXXX.X.<br>
    e0: XX XX XX ff XX ff XX XX XX XX XX XX XX XX ff XX    XXX.X.XXXXXXXX.X<br>
    f0: ff XX ff ff XX XX XX XX XX XX XX XX XX XX ff XX    .X..XXXXXXXXXX.X<br>
<br>
<br>
    Progress at least.<br>
<br>
    Cheers,<br>
<br>
    Julian<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
    On 12 April 2013 11:27, Julian Brooks &lt;<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br></div></div><div class="im">
    &lt;mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>&gt;&gt; wrote:<br>
<br>
        Message resent for thread archives with smaller picture size.<br>
<br>
        Julian<br>
<br>
        ---------- Forwarded message ----------<br></div><div class="im">
        From: *Julian Brooks* &lt;<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a> &lt;mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>&gt;&gt;<br>
        Date: 11 April 2013 19:24<br>
        Subject: Re: [PD] Sensors GPIO Raspberry Pi Pd<br>
        To: Martin Peach &lt;<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a><br></div><div><div class="h5">
        &lt;mailto:<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@<u></u>sympatico.ca</a>&gt;&gt;<br>
        Cc: PD List &lt;<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a> &lt;mailto:<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a>&gt;&gt;<br>
<br>
<br>
        Hey Martin / list,<br>
<br>
        Finally got all the stuff and ...<br>
<br>
        It’s not working!<br>
<br>
        We spent the day soldering cables and connecting stuff up as per<br>
        the Omron ‘App Note 01’ spec sheet.<br>
<br>
        Started off super-conservative using the  I2C level converter<br>
        (case 3 page 4) <a href="http://www.adafruit.com/products/757#Blog/Flickr" target="_blank">http://www.adafruit.com/<u></u>products/757#Blog/Flickr</a><br>
<br>
        We tried resistors on both sides (being super paranoid!) and<br>
        then we took  the low (Pi) side ones off.<br>
<br>
        We then moved on to case 2 page 3 of this same document…<br>
<br>
        At each stage we checked with “I2Cdetect –Y 1” and nothing was<br>
        visible.<br>
<br>
        The grid shows no attached devices every time we run it.<br>
<br>
        We re-booted at every stage following the various online<br>
        tutorials/methods of setting up I2C GPIO on the Pi (checked &amp;<br>
        double checked).<br>
<br>
<br>
        As you can see we’re using a pi protoplate:<br>
<br>
        <a href="https://www.adafruit.com/products/801" target="_blank">https://www.adafruit.com/<u></u>products/801</a><br>
<br>
        In the photo I’ve attached the cables are coded as follows:<br>
<br>
        Orange           GND<br>
<br>
        Yellow            5v<br>
<br>
        Blue                SCL<br>
<br>
        Green             SDA<br>
<br>
        The white is also 5v for the pull up resistors.<br>
<br>
        The resistor values are 4.7k btw.<br>
<br>
        We have tested the cable that terminates at the sensor and all<br>
        that is OK.<br>
<br>
        I put a multimeter on the GND and SDA solder points on the<br>
        sensor itself and got 3.7v…<br>
<br>
        I put a multimeter on the GND and SCL solder points on the<br>
        sensor itself and got 0.0v…<br>
<br>
        Don’t know if this means anything or could be useful to know!<br>
<br>
        Stuck and frustrated now but hey, 3 weeks ago I knew absolutely<br>
        bugger all about any of this and now I do (sort of).<br>
<br>
        I&#39;m thinking we could do with the most basic i2c sensor we can<br>
        find as we have nothing to compare.<br>
<br>
        Tonight I&#39;m going to d/l a fresh raspbian and start from scratch<br>
        to check that end.<br>
<br>
        Feel like if we can&#39;t get past the &#39;i2c-tools&#39; tests we&#39;re<br>
        screwed - never mind getting it in and out of Pd.<br>
<br>
        Any thoughts/pointers/options from anyone will be really<br>
        appreciated?<br>
<br>
<br>
        Cheers,<br>
<br>
<br>
        Julian<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br></div></div><div class="im">
______________________________<u></u>_________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a><br>
<br>
</div></blockquote>
<br>
</blockquote></div><br></div>