[SOLVED] broken Pysense board?
-
I just got a Pysense board. I get a strange error. I can read the sensors (light, pressure, ...) but not the board.
I get these errors:>>> from pysense import Pysense >>> p = Pysense() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/flash/lib/pysense.py", line 101, in __init__ Exception: Pysense board not detected
Is the board really broken, or am I missing something?
André
-
@jorismathijssen Hi Joris. Did you tried tot upload thé firmware again? Be sure to powercycle your device. Did you run dfu utils with elevated rights? (Admin on Windows of sudoku on Linux?)
Good luck
-
@andrethemac Do you have anymore tips. I was trying yesterday night and it still isnt working. Your example without pysense is working but when i turn it back on i also get the error when the Pysense object gets created.
I tried updating the sense framework and it looked like it was succesfull. Still no succes
Match vendor ID from file: 04d8
Match product ID from file: f011
Opening DFU capable USB device...
ID 04d8:f011
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0100
Device returned transfer size 64
Copying data from PC to DFU device
Download [=========================] 100% 16384 bytes
Download done.
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
-
@andrethemac Hooooray. It is fixed by upgrading the firmware to the latest version (0.0.7) of the pysense firmware. Maybe there was something wrong with the firmware on the board.
BTW I had to run the dfu-util with elevated rights (sudo) before it would upgrade. (I'm using Linux).
-
@jcaron I tried that, but you get the error when the Pysense object gets created.
I started out with the example from the Pysense library.
-
@andrethemac Try passing the
py
object to the constructors for the various sensors. This enables them to share the I2C object, which is probably the issue here.See the
main.py
example in the Pysense library:py = Pysense() mp = MPL3115A2(py,mode=ALTITUDE) si = SI7006A20(py) lt = LTR329ALS01(py) li = LIS2HH12(py)
-
@jcaron I can read the sensons directly (with their library) as the are al I2C components. You don't need the pysense as such, but It would be nice to now the version,... .
this is a test I did to read the sensors with the pysense lib commented out, .
from LIS2HH12 import LIS2HH12 from LTR329ALS01 import LTR329ALS01 from MPL3115A2 import MPL3115A2 from SI7006A20 import SI7006A20 # from pysense import Pysense import time # py = Pysense() acc = LIS2HH12() l = LTR329ALS01() pres = MPL3115A2() alt = MPL3115A2(mode=0) th = SI7006A20() while True: pitch = acc.pitch() roll = acc.roll() print('pitch: {}, roll: {}'.format(pitch,roll)) print(' light: {}'.format(l.light())) print(' pressure: {}'.format(pres.pressure())) print(' altitude: {}'.format(alt.altitude())) print('temp from pres: {}'.format(pres.temperature())) print('temperature: {}'.format(th.temperature())) print(' humidity: {}'.format(th.humidity())) print('-'*80) time.sleep_ms(100)
-
@andrethemac How do you read the sensors? You wouldn't be creating multiple instances of the
Pysense
object by any chance?