Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Migrating projec from arduino mega-due to teensy 4.0 because of dual i2c channel need

  1. #1

    Migrating projec from arduino mega-due to teensy 4.0 because of dual i2c channel need

    Hi guys!
    I have been working on this project.

    It is an arduino based gaming locomotion system.

    Practically the project is about 2 accelerometers and 2 pressing sensors mounted at each shoe, and also 1 accelerometer at the chest, to control the movements-locomotion in games of the avatar/to control the movements of the joystick of game controllers.
    For now the arduino sensors are connected to an arduino uno digishield . The digishield is connected in parallel to the digipot of the controllers that I want to control via the use of this arduino system.


    This is the arduino uno digipot shield that I use

    https://iorodeo.com/products/digital...iometer-shield

    This is the original schematic I used for the mega-uno


    Click image for larger version. 

Name:	Screenshot_20200905-233726_QuickPic.jpg 
Views:	19 
Size:	135.7 KB 
ID:	21660


    This is how I think the schematic would look like when connecting my arduino sensors to the teensy 4.0


    Click image for larger version. 

Name:	schematic teensy.jpg 
Views:	9 
Size:	107.4 KB 
ID:	21661

    One of the reasons why I am moving from the arduino mega-uno system to the teensy 4.0 , is because on the arduino mega-uno system , the chest accelerometers would not work properly in combination with the feet sensors (2 acceleroemtrs and pressing sensors).

    I hope that the teenst 4.0 would allow me to use 3 bno055 accelerometers at the same time. The two accelerometrs at the feet would be connected on the 1st i2c channel, while the 3rd accelerometer (the chest accelerometer) would be connected to the a 2nd i2c channel.

    The arduino codes I am using can be found here:

    https://github.com/marcob2178/Shoes-controller

    https://github.com/marcob2178/Chest-Controller

    I am sure I will have more questions when starting migrating the code to the teensy 4.0 in the following days.

    For now I have these generic questions:

    1) any suggestion/advice is welcome.

    2) is there any adapter that would allow me to mount on the teensy 4.0, the dual digipot shield I mentioned above ?

    3) do you foresee any issue (heads up) in using the 3 BNO055 accelerometers on the two i2c channels of the teensy ?

    4) Do you have any suggestion on any portable small power bank for he teensy 4.0 ?

    Thanks!

    ps:

    This is how my original system worked.




    The code now has changed quiet a lot compared to what used for controlling the joystick/game controller in this video above.

    For example , analog speed movements of the joystick have been added and also the chest accelerometer has been added.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	schematic teensy.jpg 
Views:	9 
Size:	108.3 KB 
ID:	21659   Click image for larger version. 

Name:	Schematic_new_1.jpg 
Views:	8 
Size:	97.5 KB 
ID:	21658  

    Last edited by marcob; 09-08-2020 at 12:22 AM.

  2. #2
    ok. I need help please.
    Having issue with he teensy 4.0 detecting the bno055 on scl1 and sda1

    Scanning...

    I2C device found at address 0x28 !

    I2C device found at address 0x29 !

    done

    No I2C(SCL1) devices found

    I am not using resistors for the accellerometer on scl1 and sda1 since the BNO055 has the needed resistors in it.


    using this code for scanning:

    Code:
     
    #include <Wire.h>
     
     
    void setup()
    {
      Wire.begin();
      Wire1.begin();
     
      Serial.begin(9600);
      while (!Serial);             // Leonardo: wait for serial monitor
      Serial.println("\nI2C Scanner");
    }
     
     
    void loop()
    {
      byte error, address, error1;
      int nDevices, nDevices1;
     
      Serial.println("Scanning...");
     
      nDevices = 0;
      nDevices1 = 0;
      for(address = 1; address < 127; address++ )
      {
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
    
        Wire1.beginTransmission(address);
        error1 = Wire1.endTransmission();
     
     
        if (error == 0)
        {
          Serial.print("I2C device found at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.print(address,HEX);
          Serial.println("  !");
     
          nDevices++;
        }
        else if (error==4)
        {
          Serial.print("Unknown error at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.println(address,HEX);
        }    
      
      
      // Second i2c bus for due
      if (error1 == 0)
        {
          Serial.print("I2C(SCL1) device found at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.print(address,HEX);
          Serial.println("  !");
     
          nDevices1++;
        }
        else if (error1==4)
        {
          Serial.print("Unknown(SCL1) error at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.println(address,HEX);
        }
      }    
      
      if (nDevices == 0)
        Serial.println("No I2C devices found\n");
      else
        Serial.println("done\n");
    
      
      if (nDevices1 == 0)
        Serial.println("No I2C(SCL1) devices found\n");
      else
        Serial.println("done\n");
     
     
      delay(5000);           // wait 5 seconds for next scan
    }
    Last edited by marcob; 09-13-2020 at 03:48 PM.

  3. #3
    The latest code I use for this project can be downloaded from here

    http://www.mediafire.com/file/tw77jj....09.28.7z/file

    and the schematic has been revised to having all the sensors (2 bno050 at feet + peessing sensors, and 1 bno080 at chest) connected to is 1 arduino mega.
    Originally I was using 3 bno055 (2 at feet and 1 at chest). To avoid conflict address, i replaced the bno055 of the chest , with 1 bno080.
    So now I have 2 bno055vat feet and 1 bno080 at chest.

    Because of issues with the arduino mega and the bno080 used at the chest, i am now looking into testing the system and code on the teensy 4.0

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,664
    Again as per the BNO080 thread and here. There are not pictures of your actual hookups, to check. Sometimes we see simple things like maybe you are missing a ground wire or maybe the wires don't look like they are making good contact or maybe the combined wires are too long to run or...

    But for example I ran your scanner code on the test board I mentioned in other thread. Switched BNO055 to run on Wire object and BNO080 to run on Wire1 and

    Output:
    Code:
    Scanning...
    I2C device found at address 0x09  !
    I2C device found at address 0x29  !
    I2C device found at address 0x3C  !
    I2C(SCL1) device found at address 0x4B  !
    I2C device found at address 0x50  !
    I2C device found at address 0x62  !
    I2C device found at address 0x68  !
    I2C device found at address 0x7C  !
    done
    
    done
    I then took my other BNO080 out and used the QWIIC connector and plugged it into the Wire object chain and now have:
    Code:
    Scanning...
    I2C device found at address 0x09  !
    I2C device found at address 0x29  !
    I2C device found at address 0x3C  !
    I2C device found at address 0x4B  !
    I2C(SCL1) device found at address 0x4B  !
    I2C device found at address 0x50  !
    I2C device found at address 0x62  !
    I2C device found at address 0x68  !
    I2C device found at address 0x7C  !
    done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •