🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    OSError: [Errno 116] ETIMEDOUT

    Modules
    2
    5
    502
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      laursena
      last edited by

      Hey guys,

      I am using a Core2 connected to a M5Stack 4-channel relay. A PAHub is connected to each channel and six I2C Weight Units are connected to each PAHub. So I have a total of 24 I2C Weight Units in use. Unfortunately, I always get an error that I can't solve. This error occurs even when I connect the Core2 directly to a PAHub and six I2C Weight Units. Can someone help me out?

      Traceback (most recent call last):
      File "<stdin>", line 166, in <module>
      File "<stdin>", line 126, in setup
      File "unit/weight_i2c.py", line 36, in init
      File "unit/weight_i2c.py", line 40, in _available
      File "unit/pahub.py", line 52, in scan
      File "unit/pahub.py", line 43, in release_channel
      OSError: [Errno 116] ETIMEDOUT

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @laursena
        last edited by

        @laursena You are connecting the hubs to the output of the relays?
        If so it's because the hubs cant communicate. hubs must be connected before the relay

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        L 1 Reply Last reply Reply Quote 0
        • L
          laursena @ajb2k3
          last edited by laursena

          @ajb2k3 thank you for your answer. I am connecting the hubs to the output of the relay and I see that the relay doesn't have an I2C output. But I also get the error without using the relay which is odd to me. Do you know why this could be?

          ajb2k3A 1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @laursena
            last edited by

            @laursena if you only have the relay connected but don’t change the code then you will continue to get the error becuase the code is still trying to look for them

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            L 1 Reply Last reply Reply Quote 0
            • L
              laursena @ajb2k3
              last edited by laursena

              @ajb2k3 The relay was not connected. I connected the Core2 directly to a Hub and used the following code. Do you see something that could be the reason for the error?

              import os, sys, io
              import M5
              from M5 import *
              from unit import WeightI2CUnit
              from hardware import *
              import time
              from unit import PAHUBUnit

              weight = None
              airScale = None
              notMedical = None
              tareButton = None
              measureButton = None
              kg = None
              i2c0 = None
              pahub_0 = None
              weight_i2c_0 = None
              weight_i2c_1 = None
              weight_i2c_2 = None
              weight_i2c_3 = None
              weight_i2c_4 = None
              weight_i2c_5 = None

              tare_weight = None
              total_weight = None
              adc0 = None
              adc1 = None

              Calibration

              def calibration():
              global tare_weight, total_weight, adc0, adc1, weight, airScale, notMedical, tareButton, measureButton, kg, i2c0, pahub_0, weight_i2c_0, weight_i2c_1, weight_i2c_2, weight_i2c_3, weight_i2c_4, weight_i2c_5
              kg.setVisible(False)
              weight.setText(str('START'))
              time.sleep(5)
              weight_i2c_0.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_0.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_0.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_0.set_calibration(0, adc0, 20000, adc1)
              time.sleep(5)
              weight_i2c_1.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_1.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_1.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_1.set_calibration(0, adc0, 20000, adc1)
              time.sleep(5)
              weight_i2c_2.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_2.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_2.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_2.set_calibration(0, adc0, 20000, adc1)
              time.sleep(5)
              weight_i2c_3.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_3.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_3.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_3.set_calibration(0, adc0, 20000, adc1)
              time.sleep(5)
              weight_i2c_4.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_4.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_4.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_4.set_calibration(0, adc0, 20000, adc1)
              time.sleep(5)
              weight_i2c_5.set_reset_offset()
              weight.setText(str('CAL'))
              time.sleep(2)
              adc0 = weight_i2c_5.get_adc_raw
              weight.setText(str('WEIGHT'))
              time.sleep(10)
              adc1 = weight_i2c_5.get_adc_raw
              weight.setText(str('DONE'))
              time.sleep(2)
              weight_i2c_5.set_calibration(0, adc0, 20000, adc1)
              weight.setText(str('END'))

              Tare

              def tare():
              global tare_weight, total_weight, adc0, adc1, weight, airScale, notMedical, tareButton, measureButton, kg, i2c0, pahub_0, weight_i2c_0, weight_i2c_1, weight_i2c_2, weight_i2c_3, weight_i2c_4, weight_i2c_5
              weight_i2c_0.set_reset_offset()
              weight_i2c_1.set_reset_offset()
              weight_i2c_2.set_reset_offset()
              weight_i2c_3.set_reset_offset()
              weight_i2c_4.set_reset_offset()
              weight_i2c_5.set_reset_offset()
              tare_weight = sum([weight_i2c_0.get_weight_float, weight_i2c_1.get_weight_float, weight_i2c_2.get_weight_float, weight_i2c_3.get_weight_float, weight_i2c_4.get_weight_float, weight_i2c_5.get_weight_float])
              return tare_weight

              Measure

              def measure():
              global tare_weight, total_weight, adc0, adc1, weight, airScale, notMedical, tareButton, measureButton, kg, i2c0, pahub_0, weight_i2c_0, weight_i2c_1, weight_i2c_2, weight_i2c_3, weight_i2c_4, weight_i2c_5
              total_weight = sum([weight_i2c_0.get_weight_float, weight_i2c_1.get_weight_float, weight_i2c_2.get_weight_float, weight_i2c_3.get_weight_float, weight_i2c_4.get_weight_float, weight_i2c_5.get_weight_float])
              return total_weight

              def setup():
              global weight, airScale, notMedical, tareButton, measureButton, kg, i2c0, pahub_0, weight_i2c_0, weight_i2c_1, weight_i2c_2, weight_i2c_3, weight_i2c_4, weight_i2c_5, tare_weight, total_weight, adc0, adc1

              M5.begin()
              Widgets.fillScreen(0x222222)
              weight = Widgets.Label("250.0", 8, 90, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu72)
              airScale = Widgets.Label("airScale", 5, 7, 1.0, 0x89c6ff, 0x222222, Widgets.FONTS.DejaVu12)
              notMedical = Widgets.Label("Not for Medical Use!", 115, 5, 1.0, 0xff0000, 0x222222, Widgets.FONTS.DejaVu18)
              tareButton = Widgets.Label("Tare", 23, 210, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu24)
              measureButton = Widgets.Label("Measure", 210, 210, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu24)
              kg = Widgets.Label("kg", 230, 90, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu72)

              i2c0 = I2C(0, scl=Pin(33), sda=Pin(32), freq=100000)
              pahub_0 = PAHUBUnit(i2c=i2c0, channel=0)
              weight_i2c_0 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=0), 0x26)
              weight_i2c_1 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=1), 0x26)
              weight_i2c_2 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=2), 0x26)
              weight_i2c_3 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=3), 0x26)
              weight_i2c_4 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=4), 0x26)
              weight_i2c_5 = WeightI2CUnit(PAHUBUnit(i2c=i2c0, channel=5), 0x26)
              weight.setVisible(False)
              weight_i2c_0.set_lowpass_filter(True)
              weight_i2c_1.set_lowpass_filter(True)
              weight_i2c_2.set_lowpass_filter(True)
              weight_i2c_3.set_lowpass_filter(True)
              weight_i2c_4.set_lowpass_filter(True)
              weight_i2c_5.set_lowpass_filter(True)
              weight_i2c_0.set_average_filter_level(50)
              weight_i2c_1.set_average_filter_level(50)
              weight_i2c_2.set_average_filter_level(50)
              weight_i2c_3.set_average_filter_level(50)
              weight_i2c_4.set_average_filter_level(50)
              weight_i2c_5.set_average_filter_level(50)
              weight.setText(str("%.1f"%((tare() / 1000))))

              def loop():
              global weight, airScale, notMedical, tareButton, measureButton, kg, i2c0, pahub_0, weight_i2c_0, weight_i2c_1, weight_i2c_2, weight_i2c_3, weight_i2c_4, weight_i2c_5, tare_weight, total_weight, adc0, adc1
              M5.update()
              if BtnA.wasClicked():
              kg.setVisible(False)
              weight.setText(str('Tare...'))
              time.sleep(3)
              weight.setText(str("%.1f"%((tare() / 1000))))
              kg.setVisible(True)
              if BtnB.wasHold():
              calibration()
              time.sleep(5)
              weight.setText(str("%.1f"%((tare() / 1000))))
              kg.setVisible(True)
              if BtnC.wasClicked():
              weight.setText(str('Warten..'))
              time.sleep(10)
              weight.setText(str("%.1f"%((measure() / 1000))))
              kg.setVisible(True)

              if name == 'main':
              try:
              setup()
              while True:
              loop()
              except (Exception, KeyboardInterrupt) as e:
              try:
              from utility import print_error_msg
              print_error_msg(e)
              except ImportError:
              print("please update to latest firmware")

              1 Reply Last reply Reply Quote 0
              • First post
                Last post