Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Activity Board WX I2C Far infrared sensor array — Parallax Forums

Propeller Activity Board WX I2C Far infrared sensor array

caldwellrcaldwellr Posts: 6
edited 2017-10-19 04:37 in Propeller 1
I can't figure out this I2c stuff. The dyi I2c does not help. The device asks for commands etc. In desperate need of help.

device: Far infrared sensor array at high speed with low noise (16x4 RES) - MLX90621
https://www.melexis.com/en/product/MLX90621/Far-Infrared-Sensor-Array-High-Speed-Low-Noise

For example, how do I setup communication?

For example the datasheet staes

Figure 4 Whole EEPROM dump (SA = 0x50, command = 0x00)


My modified code:

#include "simpletools.h" // Include simpletools header

i2c *eeBus;
// I2C bus ID

int main() // Main function
{

eeBus = i2c_newbus(9, 8, 0); // Set up I2C bus, get bus ID

// Use eeBus to write to device
i2c_out(eeBus, 0x50, // with I2C address 0b1010000,
0x00, 1, 0x04, 1); // send address 32768 (2 bytes)
// and "abc..." data (8 bytes)

while(i2c_busy(eeBus, 0b1010000)); // Wait for EEPROM to finish

char testStr[] = {0, 0, 0, 0, 1, 0, 0, 0}; // Set up test string

// Use eeBus to read from device
i2c_in(eeBus, 0x50, // with I2C address 0b1010000,
0x00, 1, testStr, 8); // send address 32768 (2 bytes)
// data in to testStr (8 bytes)

print("testStr = %s \n", testStr); // Display result
}


Comments

  • microcontrollerusermicrocontrolleruser Posts: 1,194
    edited 2017-10-19 18:41
    caldwell

    'The dyi I2c does not help'

    Are you saying you found sample code and it does not just paste right in with a little rewriting?

    EDIT

    Here's google search

    https://www.google.com/search?q=propeller+C+i2c+example&ie=utf-8&oe=utf-8

  • Caldwell

    http://learn.parallax.com/search?search_api_views_fulltext=propeller+i2c

    Call support. You bought an activity board. It has I2C. Where's the code for it?

    Andy Lindsay wrote the articles,

    Call Parallax and see if they can rustle him up for you or get his email.

    That is if you are really stuck.

    With Parallax you are paying for support.

    I can steer you to microcontrollers where you submit a help ticket and it gets ugly from there.
  • Parallax can't support an item that they do not sell. Maybe a forum member has done some interfacing with that series.

  • Well.

    Then he needs to contact sensor outfit.

    Electronics forum would probably help.
  • You might what to have a peek at an Arduino (or other implementation) example to get an idea of how to set up the device.

    This seems to be pretty detailed:
    https://github.com/Leenix/MLX90621-Lite/blob/master/MLX90621.cpp

  • Thanks

  • #include "simpletools.h" // Include simpletools header

    i2c *eeBus; // I2C bus ID

    int main() // Main function
    {
    eeBus = i2c_newbus(28, 29, 0); // Set up I2C bus, get bus ID

    // Use eeBus to write to device
    i2c_out(eeBus, 0b1010000, // with I2C address 0b1010000,
    32768, 2, 6, 2); // send 2 byte address of 32768
    // and 8 byte data string.

    while(i2c_busy(eeBus, 0b1010000)); // Wait for EEPROM to finish

    //int testStr[] = {0, 0, 0, 0, 0, 0, 0, 0}; // Set up test string
    int data = 4;
    // Use eeBus to read from device
    i2c_in(eeBus, 0b1010000, // with I2C address 0b1010000,
    32768, 2, data, 2); // send 2 byte address of 32768
    // & store data in 8 byte array.

    print("testStr = %d \n", data); // Display result
    }

    Why dont this code write 6 to the eeprom address and return it to data.?
  • Why don't this code write 6 to the EEPROM address 32768 and return it in the variable data?


    #include "simpletools.h" // Include simpletools header

    i2c *eeBus; // I2C bus ID

    int main() // Main function
    {
    eeBus = i2c_newbus(28, 29, 0); // Set up I2C bus, get bus ID

    // Use eeBus to write to device
    i2c_out(eeBus, 0b1010000, // with I2C address 0b1010000,
    32768, 2, 6, 2); // send 2 byte address of 32768
    // and 8 byte data string.

    while(i2c_busy(eeBus, 0b1010000)); // Wait for EEPROM to finish

    //int testStr[] = {0, 0, 0, 0, 0, 0, 0, 0}; // Set up test string
    int data = 4;
    // Use eeBus to read from device
    i2c_in(eeBus, 0b1010000, // with I2C address 0b1010000,
    32768, 2, data, 2); // send 2 byte address of 32768
    // & store data in 8 byte array.

    print("testStr = %d \n", data); // Display result
    }

  • Take a look at this.

    http://forums.parallax.com/discussion/97595/eeprom-memory-mapping

    The third or fourth post down.

    Hope that helps!
  • Nothing is there.
Sign In or Register to comment.