Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. robot_alf
    R
    • Continue chat with robot_alf
    • Start new chat with robot_alf
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    robot_alf

    @robot_alf

    0
    Reputation
    14
    Posts
    138
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    robot_alf Follow

    Posts made by robot_alf

    • PbHub + Ultrasonic.IO

      Hello M5 engineers!

      Could you please add a simple function to the PbHub for ultrasonic sensors? Something like this - https://github.com/ErickSimoes/Ultrasonic/blob/master/src/Ultrasonic.cpp
      Because I can't to it through blocks or python, it's microseconds between send a receive an impulse.

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      @gavin67890 Yes, you need to change two jumpers (0Ohm) in the IO position and also remove one resistor on the top of the board, which is labeled "IIC".
      It was easier for me to short-circuit the contacts than to solder small transistors. So, you just need to unsolder three resistors and then make two short circuits.

      I think that need just to add a simple function to the PbBoard for ultrasonic sensors like this - https://github.com/ErickSimoes/Ultrasonic/blob/master/src/Ultrasonic.cpp
      Because I can't to it through blocks or python, it's microseconds between send a receive an impulse.

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      @gavin67890 yes it works perfect for Core2. I have the problem only on StickC Plus.
      Okay, I tried to switch my project from PaHub to PbHub. I have such a hub too. I compared the photo of Ultrasonic I2C and IO versions (thanks a lot to M5 for this) and saw that it can be easily re-soldered I2C to IO. I made an IO out of one I2C sensor and it works fine, but not through PbHub. Actually now I'm at a dead end now ) It looks that I can't make a small mobile machine with two servos360 and three ultrasonic sensors on the StickC Plus (

      M5 engineers could you please add a function "get distance from ultrasonic" for PbHub?

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      Hmmm... I did the same several times and always not worked. Which PaHub are you used? I2C Hub 1 to 6 Expansion Unit (PCA9548APW) https://shop.m5stack.com/products/i2c-hub-1-to-6-expansion-unit-pca9548apw or [EOL] I2C Hub 1 to 6 Expansion Unit (TCA9548A) https://shop.m5stack.com/products/pahub-unit?variant=16804803412058 ?

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      This code also working but need to connect sensors to 1,2,3 ports of pahub, not to 0,1,2

      #include <M5StickCPlus.h>
      #include <Unit_Sonic.h>
      #include "ClosedCube_TCA9548A.h"
      
      #define PaHub_I2C_ADDRESS 0x70
      ClosedCube::Wired::TCA9548A tca9548a;
      
      SONIC_I2C sensor;
      
      void setup() {
          M5.begin();
          tca9548a.address(PaHub_I2C_ADDRESS);
          sensor.begin();
          M5.Lcd.setTextFont(2);
      }
      
      void loop() {
        static float newvalue = 0;
        for (uint8_t channel = 0; channel < 3; channel++) {
          tca9548a.selectChannel(channel);
          M5.Lcd.printf("%i = ", channel);
          newvalue = sensor.getDistance();
          if ((newvalue < 4000) && (newvalue > 20)) {
            M5.Lcd.printf("%.2fmm   ", newvalue);
          } else {
            M5.Lcd.print("ERR        ");
          }
          M5.Lcd.print("\n");
        }
        delay(20);
        M5.Lcd.setCursor(0,0);
      }
      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      0_1693946459135_4a3ee96e-095d-4cd6-b8ab-4c08594362e2-image.png
      This is crazy but this code working with 3 sensors )
      The pahub and ultrasonic was selected to PortA. And sometimes I see distance from incorrect sensor. I think again that hardware part is working, but code for StickC Plus controllers have some bugs.
      M5Stack engineers, could you please send me python libraries for pahub and ultrasonic? Maybe I can help to investigate the problem. I don't want to spend time for reverse engineering them from bin-file of UIFlow firmware )

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      @gavin67890 Download not working. I think it is the same like run app just the controller switched to the "app" mode instead of "internet" mode.

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      I have made a simple test for Arduino and it works. It show that hardware part is working correct need just fix the problem in the code for UIFlow.

      #include <M5StickCPlus.h>
      #include <Unit_Sonic.h>
      #include "ClosedCube_TCA9548A.h"
      
      #define PaHub_I2C_ADDRESS 0x70
      ClosedCube::Wired::TCA9548A tca9548a;
      
      SONIC_I2C sensor;
      
      void setup() {
          M5.begin();
          tca9548a.address(PaHub_I2C_ADDRESS);
          sensor.begin();
          M5.Lcd.setTextFont(2);
          M5.Lcd.setTextColor(YELLOW, TFT_BLACK);
          M5.Lcd.println(("PaHUB Example"));
          M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK);
      }
      
      void loop() {
        static float newvalue = 0;
        for (uint8_t channel = 0; channel < 6; channel++) {
          tca9548a.selectChannel(channel);
          M5.Lcd.print(channel);
          M5.Lcd.print(" = ");
          newvalue = sensor.getDistance();
          if ((newvalue < 4000) && (newvalue > 20)) {
            M5.Lcd.printf("%.2fmm", newvalue);
          } else {
            M5.Lcd.print("ERR");
          }
          M5.Lcd.print("\n");
        }
        delay(20);
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(0,0);
      }
      
      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      @felmue looks like the same code that return "ultrasonic not found" at start, but I will check it.

      posted in Units
      R
      robot_alf
    • RE: StickC Plus + PaHUB + 3 Ultrasonic I2C units

      I checked everything several times. Everything works fine for me with Core2, but it doesn’t work with StickC Plus. Moreover, I see the ultrasonic sensor connected through the PaHub if I select PortA for the sensor. And the same time the sensor not found when PAHUB0 port is selected.
      The problem is that we wanted to make a little size machine with 3 ultrasonic sensors and two servo360 for wheels. Core2 requires external power for the servo. StickC Plus has a servo module with a built-in battery that suitable for mobility devices with small dimensions but we can't use ultrasonic devices.
      Ok, I still trying to find a solution how to connect 3 ultrasonic sensors for the StickC Plus.
      To check my case and got the same error is very easy. Just connect ultrasonic sensor through pahub, add the hub and the sensor in UIFlow to the StickC Plus controller and run the project with empty code.

      posted in Units
      R
      robot_alf