• 0 Votes
    13 Posts
    3k Views
    D
    Hi @jcaron, yesterday I posted some findings about this issue. Today I've discovered that if I comment the line: self.set_register(CTRL3_REG, 1, 5, 1) in LIS2HH12.py, then my multimeter shows the accelerometer works as its supposed in terms of current consumption: ~130 µA for 5 seconds (inactivity duration) and then ~60 µA. If I shake a little bit the board then the current rises up to ~130 µA (activity detection) and after 5 seconds lowers to ~60 µA again. Off course, the SiPy doesn't wake up because accelerometer's inactivity interrupt (INT1_INACT bit in CTRL3 register) is not enabled (the line I commented), but this reinforces my theory that there is a problem regarding to the way the PIC handles the interruption. I.e., an issue in Pysense/Pytrack firmware or in pycoproc.py library.
  • 0 Votes
    5 Posts
    1k Views
    L
    @mrainone said in function removed from LIS2HH12.py library module: can you recommend a low cost magnetometer to connect to the lopy I use simple GY-271 (HMC5883L) It working fine for me and is cheap
  • 0 Votes
    2 Posts
    1k Views
    A
    Any luck with new wipy users ?
  • Adding Modules

    Discussion library lopy
    3
    0 Votes
    3 Posts
    943 Views
    N
    @netskink the following command works for me though: import sys sys.path.append("/flash/test") import test_x @cpyree, the copy of the urequests forlder in /flash/lib is correct. May be, since the urequests forlder does not have _init_.py file, you need to import it as: import urequests.urequests as urequests urequests.get(...)
  • Uploading Library to device

    LoPy pytrack usb library
    2
    0 Votes
    2 Posts
    1k Views
    D
    It seems I have worked it out, incase anyone else has the same problem, I watched this video: https://www.youtube.com/watch?v=I5Qsuz6fEAA From about 20minutes. My problem here was that I wasn't removing the project .atom which was coming up automatically, I needed to remove that so it only synchronized with the new project folder.
  • Compression lib

    LoPy library compression
    5
    1 Votes
    5 Posts
    2k Views
    S
    I am facing a challenge when attempting to decompress data compressed using the miniz library on the ESP32 platform. My objective is to compress data using miniz library in flasher_stub compoment of esp-idf and then decompress the data on the cloud side using some python script that can be compatible with miniz decompression style like zlib. As per the documentation and information available, the miniz library is described as a "lossless, high-performance data compression library" that implements the zlib (RFC 1950) and Deflate (RFC 1951) compressed data format specification standards. However, I am encountering difficulties when attempting to decompress the compressed data using Python. Specifically, when using the Python zlib module, which should be compatible with the zlib and Deflate formats, I am receiving an "unknown compression method" error. I have verified that the file and data are correct, and they were compressed using the miniz library on the ESP32. Despite this, I am unable to successfully decompress the data. I would greatly appreciate any help or any insights that you can provide regarding how to properly decompress data that has been compressed with the miniz library using Python.
  • LoPy deepsleep general issues/questions

    LoPy deepsleep pysense library
    12
    0 Votes
    12 Posts
    4k Views
    J
    @johncaipa I have quite a lot of stuff going on in my code, but the main differences from yours are: I always to the initial join manually, so I don't try to detect whether that already happened or not. I use OTAA joins I keep the socket blocking I do wake on pin using the Pysense Here's a slimmed down version. Important! Don't use this code as is! This code requires a Pysense firmware which supports INT wake-up. from network import LoRa from network import WLAN from network import Server import socket import time import binascii from pysense import Pysense import pycom import machine app_version = '2017-10-31-01' SLEEP = 150 py = Pysense() def read_pin(): return 1 if py.peek_memory(0xE) & 0x02 else 0 pycom.heartbeat(0) app_eui = binascii.unhexlify('***') app_key = binascii.unhexlify('***') # Whatever happens, init the LoRa stack and (try to) restore its state lora = LoRa(mode=LoRa.LORAWAN, adr=True) lora.nvram_restore() # This part is not called from the code, only manually def doJoin(lora): print(time.localtime(),"LoRa join") lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0) while not lora.has_joined(): time.sleep(1) print('Not yet joined...') lora.nvram_save() print(time.localtime(),"done LoRa join") # This is the debug mode, entered when the button is pressed def debugMode(): # set led to orange pycom.rgbled(0x402000) wlan = WLAN() wlan.init(mode=WLAN.AP, ssid='LoPy-'+binascii.hexlify(lora.mac()).decode('ascii'), auth=(WLAN.WPA2,'***'), channel=7, antenna=WLAN.INT_ANT) server = Server() # set led to green once we're ready pycom.rgbled(0x00ff00) # This is a modified version of the Pysense go_to_sleep which keeps INT working def go_to_sleep2(): PORTC_ADDR = const(0x00E) ANSELA_ADDR = const(0x18C) ANSELB_ADDR = const(0x18D) ANSELC_ADDR = const(0x18E) ADCON0_ADDR = const(0x9D) CMD_GO_SLEEP = const(0x21) # disable back-up power to the pressure sensor py.mask_bits_in_memory(PORTC_ADDR, ~(1 << 7)) py.poke_memory(ADCON0_ADDR, 0) # disable the ADC py.poke_memory(ANSELA_ADDR, ~(1 << 3)) # Don't touch RA3 so that button wake up works py.poke_memory(ANSELB_ADDR, 0xFF) py.poke_memory(ANSELC_ADDR, ~((1 << 7)|(1 << 1))) py._write(bytes([CMD_GO_SLEEP]), wait=False) # kill the run pin Pin('P3', mode=Pin.OUT, value=0) def sendData(val): s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, 0) s.send(bytes([val])); # This is the main function def doTheWork(): if py.button_pressed(): debugMode() return p = read_pin() sendData(p) # send is blocking and should have waited long enough, but I'm a belt-and-suspenders kind of guy time.sleep(2) lora.nvram_save() py.setup_sleep(SLEEP) # Set edge py.poke_memory(0x95, py.peek_memory(0x95) & ~0x40 if p else py.peek_memory(0x95) | 0x40) # Enable INTE # If your Pysense is not running a version of the firmware that supports it, this will probably lock it up py.poke_memory(0x0b, py.peek_memory(0x0b) | 0x10) go_to_sleep2() doTheWork() Note: I haven't tried running this version of the code, so I may have cut a bit too much.
  • 4 Votes
    22 Posts
    12k Views
    K
    Hi, I have an extra I2C sensor on the Pysense. (water pressure) I would like to wake up my lopy4 if it's above a certain value. Can this be done? And which code should I change/update? Thanks
  • Deep Sleep Shield Update

    Announcements & News deep sleep library
    22
    3 Votes
    22 Posts
    12k Views
    ledbelly2142L
    @lambda280 I am using @Butch 's BME280 lib from HERE If I can get away with using P10 sequentially I will. Moving SCL to another pin is a great alternative. My BME280's are pretty close, about 5cm, but they are plugged into the LoPy expansion shield pin headders, which have some 'play' in them (not a solid connection). I would prefer to solder them somewhere for impact testing. What's hot glue for anyway :-) I'm using a fully made breakout BME280 board from HERE @jmarcelino thought moving the I2C pins is best, since you can't move the deep sleep shield pin 10. -Thank you! in the main.py I added the pin assignment: i2c = I2C(0, I2C.MASTER, baudrate=100000, pins=('P8','P9')) Works fine now.
  • Bluetooth libraries news?

    Discussion wipy 2.0 bluetooth library release
    5
    2 Votes
    5 Posts
    2k Views
    O
    @jmarcelino it sure would be very interesting but unfortunately i work almost alone and I have 3/4 months to get the things full working, and i was lucky enogh to start the project in summer season. I hope the gpy/fipy will be released before september so i can build the lte support for it or i'll have to deal with another problem lol
  • OSC Library for micropython/pycom

    MicroPython osc library micropython pycom
    1
    0 Votes
    1 Posts
    988 Views
    No one has replied
  • 1 Votes
    41 Posts
    21k Views
    IplookyI
    @daniel you where right, I had all the libraries outside the lib folder and that's why it did not work. still: import sys sys.path.append('/flash/my_folder') helped me a lot! Thank you!
  • Pytrack GPS library or how to start?

    Discussion pytrack gps gnss library
    9
    0 Votes
    9 Posts
    4k Views
    L
    @aldrinleal your parser is really minimalistic and do not check crc and fix the best i have found was https://github.com/inmcm/micropyGPS/blob/master/micropyGPS.py it need some modifications to be more usefull and you extend error handling. Also at the end you need to add GLONASS commands to the list - but work like a charm :)
  • 0 Votes
    6 Posts
    3k Views
    L
    @Arkaik classic way always work ;-)
  • SD Card Interface: SPI or SDIO?

    Expansion Board spi sdcard library
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • SDI-12 library for LoPy ?

    LoPy sdi-12 lopy library
    1
    1 Votes
    1 Posts
    1k Views
    No one has replied