HB (Customer) asked a question.

Connecting I2C between P1AM-100 CPU to Zaber X-AS01 Arduino shield

I am trying to make I2C connection between Zaber X-AS01 shield and P1AM-100. The Zaber shield normally goes on top of Arduino Uno and operates on 5V logic level.

 

https://www.zaber.com/products/accessories/X-AS01

https://www.zaber.com/products/accessories/X-AS01/overview

 

I just need to connect I2C from the Zaber shield to SCL and SDA pins on the P1AM-100.

 

Question:

  1. Do I need to use P1AM-GPIO, or can I simply connect the SCL/SDA pins from Zaber to pins 11 and 12 on the left side of P1AM-100?
  2. Because the Zaber shield is designed for Arduino Uno, do I need to use 3.3/5V logic level shifter between the Zaber shield and P1AM-100 on the I2C pins 11/12? I understand P1AM-100 is based on MKR Zero and operates on 3.3V logic level.

 

Thank you


  • FACTS_AdamC (AutomationDirect)

    Looking at the schematic for that shield it looks like it will work with 3.3V without a shifter.

     

    You do not need a P1AM-GPIO, you can just plug directly into the headers if that is secure enough for your application.

    Selected as Best
  • FACTS_AdamC (AutomationDirect)

    Looking at the schematic for that shield it looks like it will work with 3.3V without a shifter.

     

    You do not need a P1AM-GPIO, you can just plug directly into the headers if that is secure enough for your application.

    Selected as Best
  • HB (Customer)

    So I connected the Zaber shield to P1AM as follow:

     

    Shield GND to P1AM GND

    Shield 5V to P1AM 5V

    Shield 3V3 to P1AM VCC

    Shield SCL to P1AM pin 12

    Shield SDA to P1AM pin 11

     

    Verified the following:

    5V and 3.3V using multimeter at shield

    Shield power LED is on

    i2c Address jumper at shield is correct (AA)

    Shield and sketch below (without the P1AM part) works with Arduino Uno board

     

    Tried to send simple homing command to Zaber stage, but it seems that the i2c communication is not working (stage does not home). The connections seems simple, I am not sure what I am missing here. Any help with troubleshooting is appreciated. Thank you!

     

    My sketch is below:

     

     

    #include <P1AM.h>

    #include <ZaberAscii.h>

     

    ZaberShield shield(ZABERSHIELD_ADDRESS_AA);

    ZaberAscii za(shield);

     

    void setup() {

     

     shield.begin(9600);

     

      Serial.begin(115200);

       while (!P1.init()){

      ; //Wait for Modules to Sign on 

     }

      

      P1.writeDiscrete(HIGH,1,5);

      delay(1000);

     

      za.send(1, "home");

      za.receive();

       za.pollUntilIdle(1);

    }

    void loop() {

    }

     

     

    IMG_20230412_073405642_HDRIMG_20230412_073345905IMG_20230412_073337320_HDR

    Expand Post
    • FACTS_AdamC (AutomationDirect)

      I'm wondering if you're getting noise on your I2C lines from the supply next to the header pins. Do you have an oscope to get a look at the signals?

       

      I see the library mentions that errors can be read from the receive command, I would be interested to see what the results of your commands are

  • HB (Customer)

    Data signal (above) and clock signal (below) looks good to me. This is probed at the Zaber SCL/SDA pins.

    I will try using logic shifter and see what happens.

     

    ACT03ACT01 

    Added the following lines to the sketch for debugging and received the response below, which looks like nothing was happening at all.

    Serial.print("Full Response: ");

    Serial.println(reply.fullResponse);

    Serial.print("Device Number: ");

    Serial.println(reply.deviceNumber);

    Serial.print("Axis Number: ");

    Serial.println(reply.axisNumber);

    Serial.print("Is Reply: ");

    Serial.println(reply.isReply);

    Serial.print("Is Busy: ");

    Serial.println(reply.isBusy);

    Serial.print("Has Warning: ");

    Serial.println(reply.hasWarning);

    //Serial.print("Warning Flags: ");

    //Serial.println(reply.warningFlags);

    Serial.print("Is Reply: ");

     Serial.println(reply.isReply);

     Serial.print("Is Rejected: ");

     Serial.println(reply.isRejected);

     Serial.print("Response Data String: ");

     Serial.println(reply.responseDataString);

     Serial.println("debug");

     

    Output from above:

    Full Response:

    Device Number: 0

    Axis Number: 0

    Is Reply: 0

    Is Busy: 0

    Has Warning: 1

    Is Reply: 0

    Is Rejected: 0

    Response Data String:

    debug

     

    Expand Post
    • FACTS_AdamC (AutomationDirect)

      Thanks for the thorough response!

       

      If level shifters do not correct the issue, are you able to test if the uno also returns a warning on that message?

  • HB (Customer)

    I finally got it working!

     

    Thanks to your suggestions of checking the message using Uno board, I discovered that this baud setting does not work:

    shield.begin(9600);

    Serial.begin(115200);

     

    But this one works without needing to use logic shifter:

    shield.begin(115200);

    Serial.begin(9600);

     

    When it works, here's the reply I get:

    Full Response: @01 0 OK BUSY WR 0

    Device Number: 1

    Axis Number: 0

    Is Reply: 1

    Is Busy: 1

    Has Warning: 1

    Is Reply: 1

    Is Rejected: 0

    Response Data String: 0

    debug

     

     

    It turns out the Zaber stage controller has to be configured to match the baud rate as called in the Arduino sketch on shield.begin().

     

    Thank you for your support!

    Expand Post