• Devices lost LoRa activation

    lopy4 lorawan
    6
    0 Votes
    6 Posts
    509 Views
    J
    @River are you sure you’re not missing something in your code? When you wake up, you should restore LoRa settings, then check if the node thinks it has joined, and it not, try to join. If some any reason you don’t get to the LoRa save, the next restore will result in the device having lost the join state, and being unable to send anything...
  • LoRaWAN frame counters (fCnt) setters

    7
    0 Votes
    7 Posts
    568 Views
    G
    @jcaron In my case I don't go to sleep. Power-cycles are only exceptional cases, otherwise, of course, the whole logic of saving counter+N would not make sense
  • Unstable WiFi connection

    lopy wifi
    7
    0 Votes
    7 Posts
    524 Views
    C
    @Asb said in Unstable WiFi connection: this never happens if I use USB. You have to try harder! Or you have simply more luck when using USB. I noticed that this happens not very often, but when it happens a few times in short distance. So it may not be related to the kind of connection.
  • Who can recommend a good CO2 sensor?

    wipy lopy co2 sensor
    4
    0 Votes
    4 Posts
    390 Views
    T
    I've had success with the Cozair sensors from Gas Sensing Solutions. At the time I started looking at CO2 sensors a couple of years ago they were pretty much one of the few and the lowest cost sensor. Now there are others available using the same technologies. The sensor I have is now connected to a Lopy and Expansion board to provide regular readings via LoRa. Andrew
  • Two restarts on pin wake from deepsleep

    2
    0 Votes
    2 Posts
    164 Views
    T
    No ideas yet?
  • LoPy connection error via pymakr and pycom upgrade

    2
    0 Votes
    2 Posts
    189 Views
    P
    Update: I managed to get the device to do a hard reset and select the factory firmware by connecting P12+3v3 for 7-9 seconds. The LED flashed green, flashed green faster and then again green very fast. Afterwards, I disconnected the device. However, I still get the same connection error: Error: timeout. What is different now, is that I can run the Pycom Upgrade tool and it detects the device and performs an update: [image: FoIzSjr] But even afterwards: I can't access the device via Pymakr due to the same error. Has anybody another idea what I could do now? Best, Felix
  • method to return if lora.nvram is available

    nvramrestore lorawan lopy
    4
    0 Votes
    4 Posts
    343 Views
    philwilkinsonP
    OK @Asb comment got me thinking that everyone seems to be fine with the lora.has_joined() method call. So I put a slight delay following the nvram_restore call, and it seems to work ok. 2 seconds seems to be optimal. This code seems to work most of the time. lora = LoRa(mode=LoRa.LORAWAN) lora.nvram_restore(): time.sleep(2) if not lora.has_joined(): print('failed to join via nvram_restore') lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.AU915, adr=False, tx_retries=0, device_class=LoRa.CLASS_A) for i in range(16, 65): #AU915 TTN gateways need channels removed lora.remove_channel(i) for i in range(66, 72): lora.remove_channel(i) appeui = binascii.unhexlify(app_eui) appkey = binascii.unhexlify(app_key) lora.join(activation=LoRa.OTAA, auth=(appeui, appkey), timeout=0) while not lora.has_joined(): print('trying to join OTAA') time.sleep(0.5) print('connected and ready to publish') s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5) s.setblocking(True) s.send("some data") s.setblocking(False) rev_data = s.recv(64) print('recieved data: ', rev_data) lora.nvram_save() time.sleep(2)
  • COMO CREAR UN SERVIDOR IOT PARA COMUNICAR LOS LOPY4

    1
    0 Votes
    1 Posts
    145 Views
    No one has replied
  • Proper way to deepsleep....

    deepsleep
    16
    1 Votes
    16 Posts
    1k Views
    John BairdJ
    Wow! Thanks for the followup on this @PeterB, that looks great. I'm glad the idea works, though concerned by the issues you are still having. I appreciate the code sample and will be integrating it soon. If I learn anything more, I'll pass it along.
  • BLE characteristic advertsiing

    ble lopy4
    3
    0 Votes
    3 Posts
    286 Views
    M
    i have lopy4 that advertisers temperature data every 30minutes and want to consume this data when it's available. At the moment, I'm creating another lopy just to continually scanner for this characteristic and then forward it though mqtt. Would tyhis be the correct way to achieve this?
  • Lopy4 onewire has SyntaxError

    lopy4 onewire
    4
    0 Votes
    4 Posts
    365 Views
    robert-hhR
    @Dylan I just tried that code, and it works. Do you have a 4.7 kOhm Pull-up resistor between Vdd and Data of the DS18B20?
  • socket.SO_CONFIRMED with loraMAC

    1
    0 Votes
    1 Posts
    140 Views
    No one has replied
  • VL53L0X TOF laser distance sensor

    1
    0 Votes
    1 Posts
    173 Views
    No one has replied
  • lopy not running main.py

    lopy boot.py repl
    19
    0 Votes
    19 Posts
    7k Views
    李
    @gouao Have you deleted the first line? The first line cannot be deleted. # main.py -- put your code here!
  • MPU9250 I2C bus failure

    mpu i2c button
    6
    0 Votes
    6 Posts
    2k Views
    E
    @livius I test this code with my Gpy and its working fine. My suggestion is not connect the pytrack or pysense board and MPU9250 together, use the Gpy board stand alone because when you connect SDA and SCL the I2C bus fail. import machine, time, math, pycom, os from machine import I2C from mpu9250 import MPU9250 from ak8963 import AK8963 i2c = I2C(0, mode=I2C.MASTER, pins=('P22','P21')) pycom.heartbeat(False) sensor = MPU9250(i2c) sensor2= AK8963(i2c) #Declination Mex City #https://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination?lat1=%2719.48698%27&lon1=%27-99.18594%27 decli=4.56 print("MPU9250 id: " + hex(sensor.whoami)) print("AK8963 id: " + hex(sensor2.whoami)) print("To Calibrate Magnetometer please draw an 8 on the air 1 minute") cali=sensor2.calibrate(60) offset=cali[0] scale=cali[1] sensor2= AK8963(i2c,offset=offset, scale=scale) print("Calibration finished (offset), (scale): ",cali) time.sleep_ms(5000) n=0 while True: print('acc :',sensor.acceleration) print('gyro:',sensor.gyro) print('mag :',sensor.magnetic) #Compass Direction x=sensor.magnetic[0] y=sensor.magnetic[1] z=sensor.magnetic[2] if (y > 0): heading=math.atan(x/y)*(180/(math.pi)) if (y < 0): heading=180-math.atan(x/y)*(180/(math.pi)) if (y==0) & (x < 0): heading=180.00 if (y==0) & (x > 0): heading=0.0 #print('mx=',x,'uT, my=',y,'uT, mz=',z,'uT') print('Compass Direction:',round(heading+decli),'degrees') # Turn light on Green when 0 degrees if (round(heading+decli)==0): pycom.rgbled(0x000800) if (round(heading+decli)!=0): pycom.rgbled(0x000000) time.sleep_ms(50) n=n+1 [image: 1556943503915-gy_imu9250-resized.png]
  • LoPy4 - Narrow bandwidth modes (7.8/10.4/62.5 kHz)

    3
    0 Votes
    3 Posts
    228 Views
    A
    Yes. I saw that I would need a more stable oscillator somewhere else on the web. I have no problem sorting that out but it still leaves me needing the API calls.
  • Not receiving data - always empty

    17
    0 Votes
    17 Posts
    1k Views
    M
    @robert-hh ok, thanks
  • Pycom micropython libraries/ modules location

    2
    0 Votes
    2 Posts
    191 Views
    P
    @pkilcoyne D'oh, Found it... https://docs.pycom.io/firmwareapi/pycom/
  • LoPy micropython commands

    4
    0 Votes
    4 Posts
    314 Views
    C
    @pkilcoyne said in LoPy micropython commands: So am I right about the following command just reading 64 bytes and clearing the buffer? More or less ;) It takes up to 64 bytes from the buffer. If the buffer contains less bytes you will get less. I don't know the implementation details. I assume a ring buffer. So it will not clear the buffer it will only move a pointer and simply overwrite old data without clearing. Wikipedia ring buffer description.
  • Wifi and Lora Mesh on Lopy4

    10
    0 Votes
    10 Posts
    755 Views
    J
    @rfinkers Haven't used Atom in a while, and never used on PC (on macOS Copy is Command-C which is different from Ctrl-C, hence no issue in that respect), so I can't really say. But in the worst case you should be able to use the Edit menu?

Pycom on Twitter