Cannot connect to many I2C devices

edited April 2019 in Hardware

Hello!

I'm trying to connect Metawear+LiPo to around 30 i2c sensors (all different addresses) the connections all worked when I used Adafruit feather or Arduino, but I always get an error using the Metawear like below. It worked with 6 of the sensors before. Any suggestion? Thank you!

In here, I only tried two addresses as trials
Connected to DD:61:E7:D3:C3:2F
Configuring streams
Setting up stream for 0x40
Setting up stream for 0x41

Streaming data for 0.3333333333333333 minutes

Traceback (most recent call last):
File "_ctypes/callbacks.c", line 232, in 'calling callback function'
File "C:\xxxxx\metawear\metawear.py", line 237, in _write_gatt_char
self._write_char_async(False)
File "C:xxxxx\metawear\metawear.py", line 229, in _write_char_async
next[0].write_without_resp_async(next[1], completed)
AttributeError: 'NoneType' object has no attribute 'write_without_resp_async'

Done streaming

Total Samples Received: 0

I tried running again here,
C:\xxxx>python data_stream_fin.py
The attribute handle given was not valid on this server.

The attribute handle given was not valid on this server.
(HRESULT = -2140864511)
Traceback (most recent call last):
File "data_stream_fin.py", line 236, in
d.connect()
File "C:\Uxxxxx\mbientlab\metawear\metawear.py", line 195, in connect
raise result[0]
RuntimeError: Error initializing the API (64)

and it keeps going like this,

Comments

    1. Post the code you are running
    2. Post device information
      • Grab from MetaBase app if unsure
      • hardware revision, firmware, model number
    3. What I2C devices are you using and how are they connected to the board?
  • Hi Eric,
    Hope you can help me! I also tried using different MetaWear and the result is the same, sometimes I got this too
    Traceback (most recent call last):
    File "data_stream_fin.py", line 238, in
    s = State(d)
    File "data_stream_fin.py", line 39, in init
    self.temp_timer = self._setup_temp_timer()
    File "data_stream_fin.py", line 146, in _setup_temp_timer
    libmetawear.mbl_mw_timer_create_indefinite(self.device.board, TEMP_PERIOD, 0, None, fn_wrapper)
    OSError: exception: access violation reading 0x0000000000000008

    1) The code is attached

    2) Model: MetaMotion R Model Number: 5
    Firmware: 1.4.4 Hardware: 0.3 Serial:03137A

    3) I have 30 MAX30205 temperature sensors (all different addresses) and 1 MPU6050 accelerometer all in parallel connected to the board through I2C pins>

  • Btw whats the value of i2c pull-up resistors on the MetaWear?

  • @Eric said:
    1. Post the code you are running
    2. Post device information
    * Grab from MetaBase app if unsure
    * hardware revision, firmware, model number
    3. What I2C devices are you using and how are they connected to the board?

  • edited April 2019

    @irmw
    i2c pull up value is 13k ohm (typical). You can add a lower value resistor if necessary.
    Please see datasheet: www.mbientlab.com/documentation for more info.
    Please make sure you can talk to each IC on the i2c line individually first before trying to "talk" to them all at the same time (process of elimination + proper dev steps)

  • Also can you send us a diagram of how you are hooking up the devices (include the i2c lines and power/ground). I want to better understand your architecture/circuit.

  • edited April 2019

    @Laura

    Yes I tried with 1,2,4, and 6 of the sensors and they all worked, it's just that it didn't even run the code. However, it worked with arduino. The connections are all already fixed so I can't redo them. I connected it like a typical master-slave just like below, but I have 30 slaves instead.

    I tried adding pull-up resistors but it didnt solve the problem.

  • What is the vcc?

  • @Laura it's the +3V pin on the Metawear

  • Yes, that's what I wanted to confirm because I am worried it is too many devices on that +3V line.

  • @Laura
    Should I power it with other means?

  • Well there's a few things you could do. Try to see if it works with fewer devices on the i2c and power/gnd lines to verify my theory first. Then if it is the power, you will need to beef things up with a bigger battery. Let's get to the root cause first.

  • edited April 2019

    @Laura
    It definitely worked with 6 of the sensors before, might bigger battery (more mAh) solve the problem? or I need separate regulator with higher V battery?
    It still didnt work with USB connected

  • edited April 2019

    @Laura
    Ok I tried powering it with power supply and higher V battery but it still gave me the same problem, It didn't read the i2c at all and the device went to MetaBoot mode right after. One thing on my mind is it possible that one of the i2c addresses clashes with the on board i2c sensors?
    Also may I know what's the voltage regulator you're using? I'm really stuck. At the moment I'm gonna do things with Arduino, but I really need it to work wirelessly for my final prototype.

Sign In or Register to comment.