• Measurement Power LoPy

    measurement
    5
    0 Votes
    5 Posts
    3k Views
    A
    @jmarcelino Great - thanks!
  • Frequent use of pycom.nvs_set.

    flash
    2
    0 Votes
    2 Posts
    993 Views
    J
    @wstallwood There is wear levelling mechanism on nvs_set, it uses the Non-volatile library from ESP-IDF: http://esp-idf.readthedocs.io/en/latest/api-reference/storage/nvs_flash.html
  • nvram_save() and nvram_restore() error codes?

    lopy nvram error
    1
    0 Votes
    1 Posts
    813 Views
    No one has replied
  • 0 Votes
    9 Posts
    2k Views
    C
    @dylan the memory problem is not useful for your issue. You get them somethimes with older firmwares. The GPS part uses a lot of strings. The garbage collector seems to handle them not always in a proper way. But I never ran into this issue when the LoPy got only power over USB. Maybe I was only lucky, or a watchdog solved it for me.
  • Uploading Library to device

    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.
  • Socket having to close and reopen

    socket rpi wifi connection lopy
    2
    0 Votes
    2 Posts
    1k Views
    L
    @soren said in Socket having to close and reopen: You close socket on server side then you must close it also on client side(it is closed already but..) Question is what problem do you have with the code? Is it working, if yes, do you ask if there is some better way?
  • How to disable WLAN debug messages

    3
    0 Votes
    3 Posts
    909 Views
    W
    Noticed that, could actually do with them right now though. Is there a way to re-enable them ?
  • BLE and LoRa in LoPy

    ble lora lopy
    4
    0 Votes
    4 Posts
    1k Views
    D
    @jmarcelino Thank you for the information. I do have one more query, is there any sample or any information which consist of these 2 working together or any sample code.
  • LoPy deepsleep general issues/questions

    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.
  • PING kills LoPy after a successful HTTP request to a server

    socket crash
    1
    0 Votes
    1 Posts
    793 Views
    No one has replied
  • "Not enough memory available on the board"

    memory lopy
    3
    0 Votes
    3 Posts
    2k Views
    robert-hhR
    @soren I do not know which program flags this error: "An error occurred: Not enough memory available on the board. Synchronizing failed. Please reboot your device manually". May atom+Pymakr plugin. But besides that: There is a difference between the free memory in the flash file system, which is reported by os.getfree("/flash"), and the RAM, which is reported by gc.free_mem(). gc.collect() only affects the RAM and performs a garbage collection there. The error message you flag sounds more like being caused by file system problems, and maybe it's not even the free area, which is the reason, but some other file related error, which is faulty reported as "out of free space", since that is the most common reason. You could try to use simple methods like ftp and terminal emulator to upload and run your files. The visibility of what's going on is much better in case of problems Errors allocating RAM are reported like: "MemoryError: memory allocation failed, allocating xxxx bytes".
  • 0 Votes
    2 Posts
    947 Views
    rcolisteteR
    I suggest to use this Pycom LoRa-Mac nano-gateway to start with : LoPy Nano-Gateway Extended (Timeout and Retry) It was a development from the earlier version : LoPy Nano-Gateway
  • SNI on TLS connections?

    tls sni
    2
    0 Votes
    2 Posts
    754 Views
    T
    Sorry, looks like this was my fault. Looks like it is working as intended but I messed something on the server. Got to do some more testing though... @jmarcelino (btw, congrats for you position at pycom), Still you might wanne document the parameter server_hostname on the ussl.wrap_socket function. A just noticed that cert mismatch does not rise ussl.SSLError but OSError which is therefore wrong in the docs too.
  • bytearray, type and format confusion

    bytearray format
    2
    0 Votes
    2 Posts
    723 Views
    J
    @soren Add ``` alone on the lines before and after your code, or prefix them all with 4 spaces to have them formatted as code. 40000 % 256 (or 40000 & 255, i.e. keeping the 8 least significant bits) = 64, which is the code point for @.
  • Controlling a servo with lopy (library or manually)

    servo lopy
    16
    0 Votes
    16 Posts
    4k Views
    robert-hhR
    @soren Good that it works. But omitting the sleep() commands are hardly the reason. I checked with an oscilloscope that PWM output stays when sleep() is performed. It's more something else you did. I worked with these servos decades ago, and remember that the pulse width range they expect is pretty small, from 1 ms to 2ms, at a 20ms period, resulting at a PWM duty cycle range between 5% and 10%
  • Mising documentation for uos.stat()

    16
    1 Votes
    16 Posts
    4k Views
    bmarkusB
    @robert-hh said in Mising documentation for uos.stat(): @soren @bmarkus I see this as a semi-commercial product. It is a commercial product range offered in form of development and OEM moduls.
  • Powering from 5V generates noise?

    power 5vdc noise ble lopy
    5
    0 Votes
    5 Posts
    1k Views
    J
    @aris Currently beacon scanning is done via GATT which adds a lot of stack overhead. It's possible to scan for beacons more efficiently.
  • Failed to connect to gateway - fault finding steps?

    lopy ttn lora lorawan
    7
    0 Votes
    7 Posts
    2k Views
    philwilkinsonP
    OK I managed to spend a little time this weekend tackling the LORA issue @jmarcelino . After a bit of travel and lots of outdoor testing I can confirm the issue was gateway related...! The code you recommended worked fine. As @jcaron mentioned, if the gateway is indoors you have to be really, really close to get a connection. As I can't get a connection near my home, I need to either persuade the local gateways to put up an external antenna, or go and buy myself a gateway!! Many thanks @jmarcelino and @jcaron for your advice.
  • 0 Votes
    3 Posts
    989 Views
    I
    Hi @jmarcelino I had already something like your solution in mind, but it would be nice to see the debug messages of booth lopys at the same time on screen ;)
  • PWM support for the LoPy?

    3
    0 Votes
    3 Posts
    988 Views
    L
    @soren always look at official documentation https://docs.pycom.io/chapter/firmwareapi/pycom/machine/PWM.html and yes it is 3v3 range

Pycom on Twitter