Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Need help with basic logging blinka data
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Need help with basic logging blinka data

by lamachine on Mon Apr 05, 2021 8:43 pm

This is based on Bluetooth LE sensor nodes tutorial by John Park.

I have a stack of nRF52840's. I am running a simple code in circuitpython below. I want to log this data to a text file on the Pi, but for some reason I cannot seem to do this effectively. the blinka program on the pi keeps crashing out for too many files open. This is typically after 30+ readings, but I have not counted them all each time.

Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "mod_ble_broadcastnet_blinka_bridge.py", line 53, in <module>
    adafruit_ble_broadcastnet.AdafruitSensorMeasurement, interval=0.5
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_ble/__init__.py", line 258, in start_scan
    active=active,
  File "/home/pi/.local/lib/python3.7/site-packages/_bleio/adapter_.py", line 248, in start_scan
    active=active,
  File "/home/pi/.local/lib/python3.7/site-packages/_bleio/adapter_.py", line 329, in _start_scan_hcitool
    stderr=subprocess.DEVNULL,
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1412, in _execute_child
    errpipe_read, errpipe_write = os.pipe()
OSError: [Errno 24] Too many open files





# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""This is a basic sensor node that uses the internal temperature sensor and reports it every 10
seconds."""

Code: Select all | TOGGLE FULL SIZE
import time
import microcontroller
import adafruit_ble_broadcastnet

print("This is BroadcastNet sensor:", adafruit_ble_broadcastnet.device_address)

while True:
    measurement = adafruit_ble_broadcastnet.AdafruitSensorMeasurement()
    measurement.temperature = (
        microcontroller.cpu.temperature  # pylint: disable=no-member
    )
    print(measurement)
    adafruit_ble_broadcastnet.broadcast(measurement)
    time.sleep(30)

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: Need help with basic logging blinka data

by lamachine on Tue Apr 06, 2021 1:51 pm

I read about the error in the bluetooth firmware, so upgraded to version 8. Now I cannot see ANY data and get the following error...

Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "mod_ble_broadcastnet_blinka_bridge.py", line 53, in <module>
    adafruit_ble_broadcastnet.AdafruitSensorMeasurement, interval=0.5
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_ble/__init__.py", line 268, in start_scan
    advertisement = adv_type(entry=entry)
TypeError: __init__() got an unexpected keyword argument 'entry'


Reboot does not seem to help

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: Need help with basic logging blinka data

by lamachine on Thu Apr 15, 2021 7:56 pm

Turned out to be a software bug,

I used
pip3 install adafruit-circuitpython-ble==7.3.4
to downgrade the package per danh over on discord. Everything running fine now.

Issue closed!

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Please be positive and constructive with your questions and comments.