• Starting with LoPy

    lopy expansion board upload failure
    3
    1 Votes
    3 Posts
    1k Views
    robert-hhR
    @aimette You can set up your own firmware build environment from the repository at https://github.com/pycom/pycom-micropython-sigfox, which in addition to changing the frequency allows you to embed your Python code into the flash, if it solid.
  • Lopy and Matchx usage

    matchx gateway lorawan server
    37
    0 Votes
    37 Posts
    12k Views
    M
    @jmarcelino Any update on this? or suggestion?
  • Wipy3. Pin.hold during deepsleep

    wipy 3.0 pin.hold deepsleep
    1
    0 Votes
    1 Posts
    623 Views
    No one has replied
  • Measuring current with the ADC

    adc sample rate app developmen
    7
    0 Votes
    7 Posts
    3k Views
    robert-hhR
    @robert-hh Another variant for measuring, which determines the difference between a minimal and maximal value over a window of samples, which should be at least a period of the signal to be tested, e.g. 20 ms for a 50Hz net. More simple than the last example, and immune to offset drifts. Still, the ADC is bad. The noise is a little bit lower if WiFi is switched off, but that only matters at small signals. # import math import array from machine import ADC, Timer, idle samples = 600 freq = 50 _BUFFERSIZE = const(64) # # acquire ADC values at a fixed rate/s, which is given in # the constructor. The second argument is the size # of a ringbuffer, the third a string with the Pin name # class Acquire: def __init__(self, samples, buffersize, pin): self.put = 0 self.get = 0 self.buffersize = buffersize self.buffer = array.array("h", 0 for _ in range(self.buffersize)) self.adc = ADC(bits=9) self.apin = self.adc.channel(pin=pin, attn=ADC.ATTN_11DB) self._alarm = Timer.Alarm(self.read_adc, 1/samples, periodic=True) def stop(self): self._alarm.cancel() def read_adc(self, alarm): self.buffer[self.put] = self.apin.value() self.put = (self.put + 1) % self.buffersize def next(self, period): vmin = 4096 vmax = 0 for _ in range(period): while self.get == self.put: idle() # calculate the moving average over the last three values: value = (self.buffer[self.get] + self.buffer[(self.get - 1) % self.buffersize] + self.buffer[(self.get - 2) % self.buffersize]) / 3 vmin = min(value, vmin) vmax = max(value, vmax) self.get = (self.get + 1) % self.buffersize return vmax - vmin # # calculate a moving average # The constructors argument is the window size # class Average: def __init__(self, size): self.size = size self.buffer = array.array("f", 0.0 for _ in range (size)) self.put = 0 self.sum = 0.0 def avg(self, value): self.sum -= self.buffer[self.put] self.buffer[self.put] = value self.put = (self.put + 1) % self.size self.sum += value return self.sum / self.size def run(noise=1.2): acq = Acquire(samples, _BUFFERSIZE, 'P20') avg_res = Average(freq) noise_sq = noise * noise try: i = 0 while True: res = avg_res.avg(acq.next(samples/freq)) i += 1 if i == freq: # remove the noise floor res = math.sqrt(abs(res*res - noise_sq)) print("{:6.2f} ".format(res/20.2)) i = 0 except KeyboardInterrupt: acq.stop() print("Handler stopped") run()
  • ABP on MatchX

    lorawan abp matchx
    1
    1
    0 Votes
    1 Posts
    566 Views
    No one has replied
  • LoraWan ABP

    lorawan abp
    2
    0 Votes
    2 Posts
    776 Views
    J
    @misterlisty ABP needs a device address but our function expects the binary value, not an hexadecimal string representation. Another option is to use binascii.unhexlify
  • Explain BLE Example Code

    ble wipy 2.0 bluetooth
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • Search Engine Python Code

    micropython
    6
    1 Votes
    6 Posts
    1k Views
    L
    @rcolistete Nothing really wrong. But if i for example need something for micropython i do: google: something micropython git e.g: WS2812 micropython git and result is really really better then on above link ;-)
  • Website access?

    website pycom
    3
    0 Votes
    3 Posts
    784 Views
    M
    sorry, that the url i'm using but it is very very slow!
  • Check datetime of files?

    file system
    2
    0 Votes
    2 Posts
    797 Views
    robert-hhR
    You can get a list of files with uos.listdir(<dir>). If you tell the version by the modification data, uos.stat()[7] tells you the file modification time, given that the clock was set appropriately, and machine.reset() can be called to reset the device. If you do not have RTC supplied by a battery, you can set the time via ntp by: from machine import RTC rtc=RTC() rtc.ntp_sync("pool.ntp.org") Then, the file modification times are valid. If you use another mechanism as version indicator, like the name of a file or the content of a file, you have to define and implement it yourself.
  • Arduino firmware on WiPy

    pytrack wipy 2.0 arduino
    3
    1 Votes
    3 Posts
    2k Views
    J
    Hi @river, this is a interesting idea, maybe, Did you get to burn esp32-arduino firmware?
  • Detect board type or availble services?

    design guide lopy sipy
    6
    0 Votes
    6 Posts
    2k Views
    robert-hhR
    @misterlisty Micropython uses the prefix u for its modules to indicate, that it may be a subset of what you have in CPython. For compatibility, the names without u are also provided. So, the genric name in MicroiPyhton is uos.uname, while os.uname is also possible. Likewise, you can write import uos or import os There are some deviations from that simple rule. Like in CPython, you can use _io, whereas in Micropython it's called uio (not u_io), and _io is not known. Also, why some modules have a non-u alias and others not is unclear. You could change that easily in mpconfigport.h of the respective port.
  • Determining status of individual sensors.

    pysense sensors
    7
    0 Votes
    7 Posts
    1k Views
    A
    The simplest solutions are the best. I'll give that a go. Many thanks @seb.
  • Uart Interrupt Wipy 2.0

    wipy2.0 uart interrupt
    6
    0 Votes
    6 Posts
    2k Views
    M
    @bucknall said in Uart Interrupt Wipy 2.0: We currently do not support interrupts in the ESP32 MicroPython branch for the UART bus. I know this is on the roadmap of things to do, so I'll check with Daniel to see where we are with this! Thanks for your patience! Hi Guys, there are updates that concern UART interrupt? This aspect is very important! Thanks
  • PIn usage for Lopy and FLopy design

    design guide lopy4 lopy flopy
    1
    0 Votes
    1 Posts
    704 Views
    No one has replied
  • Over the air updates?

    design guide
    2
    0 Votes
    2 Posts
    798 Views
    L
    @misterlisty look here https://forum.pycom.io/topic/518/ota-or-not-ota-that-is-the-question/80
  • OSError: Network card not available

    lopy
    7
    0 Votes
    7 Posts
    2k Views
    sorenS
    @livius Ah shoot, I thought I was enabling manual garbage collectin with gc.enable(). And the UART duplication is obviously a mistake. Thanks for pointing those out !
  • Sigfox and Lora functionality..

    design guide
    2
    0 Votes
    2 Posts
    725 Views
    L
    @misterlisty No, in ESP32 there is only built in Wifi and BT. For lora there is another chip SX1272. In lopy4 there is new one SX1276 which support both lora and sigfox. Sources are on the github https://github.com/pycom
  • Does deepsleep work at all

    deepsleep
    83
    0 Votes
    83 Posts
    50k Views
    B
    @johncaipa Hi, Im getting this same error - did you work out why this occurs?

Pycom on Twitter