• Convert namedtuple to json for mqtt - thingsboard

    1
    0 Votes
    1 Posts
    200 Views
    No one has replied
  • TEROS 12 and SDI-12

    teros12 sdi-12
    41
    0 Votes
    41 Posts
    6k Views
    robert-hhR
    @tttadam I think it because there may be values in the read buffer, which are discarded when you init the device. You could try to call tou.read() to flush the buffer instead of re-initing the UART. if that does not work, it's no big harm. Reestablising the UART does not harm.
  • MCP3428 I2C Data Errors

    4
    0 Votes
    4 Posts
    294 Views
    J
    Great! Thanks for the explanation. It all makes sense now!
  • dfrobot 1602 rgb lcd micropython library

    1602 lcd displays rgb micropython
    1
    0 Votes
    1 Posts
    165 Views
    No one has replied
  • ADC and ML-020S-O Lux Sensor

    luxsensor adc analog read
    2
    0 Votes
    2 Posts
    195 Views
    robert-hhR
    @tttadam If I understand the data sheet right, the orange should go to GND an the white to an Analog input, like P13 to P18. The uncovered one is shielding. You can put that to GND. The output range is small, 0-30mV, which means, that you will get no reasonable reading, because there is no reading at all below ~70mV. The value you read should mostly be 0. So you need to insert an amplifier. Edit: The ESP32 has an built-in amplifier. But that is not supported by the Pycom firmware and not by espressif itself.
  • Modifying boot.py

    2
    0 Votes
    2 Posts
    253 Views
    No one has replied
  • Capturing console messages to a log

    console
    5
    0 Votes
    5 Posts
    2k Views
    S
    @fsergeys same problem here :-(
  • Math Module log10 cannot be used

    2
    0 Votes
    2 Posts
    225 Views
    robert-hhR
    @Terry666 You can derive that from math.log() math.log10(x) = math.log(x)/math.log(10) math.log2(x) = math.log(x)/math.log(2) Since math.log(10) and math.log(2) are constant, you can pre-calculate them. P.S.: Looking at the code, they are not included in the PyCom build. You can do so by building you own firmware and setting #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1) in mpconfigport.h.
  • logging for investigating

    9
    0 Votes
    9 Posts
    607 Views
    C
    @tttadam If you have trouble with fragmentation, you have to redesign your program. Running the garbage collector will not help in all situations and small changes can get you into trouble again. You can reduce fragmentation by using precompiled scripts and allocating huge buffers at early stages. Reinitialize your buffers instead of allocating them each time.
  • Disabling WiFi on LoPy

    Moved
    3
    0 Votes
    3 Posts
    3k Views
    R
    There is also pycom.wifi_on_boot method which can be set to False. more info in the Docs
  • json over mqtt and json in general

    4
    0 Votes
    4 Posts
    287 Views
    T
    @robert-hh what I see in the docs is ujson, and I think it is very basic. But I will search for some sample code, and write what I come up with. (last year when I checked this topic, there was no support for json in micropython. Or I was lazy when did my research)
  • config file on sd card

    configuration sdcard source-code
    3
    0 Votes
    3 Posts
    273 Views
    T
    Json on the sd is come up to my mind also for config, I will give a try with that. :) I hoped, that there is an easier solution for source code protection, but it seems there isn't. Still thanks for your suggestion.
  • MLX 90614 Sleep mode

    1
    0 Votes
    1 Posts
    178 Views
    No one has replied
  • 1602 LCD and I2C backpack with pycom

    1602 i2c lcd displays
    17
    0 Votes
    17 Posts
    1k Views
    robert-hhR
    @Lucas_Vieira I'm missing the print statements form the script. So your test script is not executed at all.
  • decode regex search

    python
    2
    0 Votes
    2 Posts
    184 Views
    robert-hhR
    @misterlisty for instance: indexs.group(0) But if you search for a fixed string, you can as well use index, e.g. try: found = response.index("2,1") except: found = -1 it returns either the position of the string or raises an error.
  • strptime

    4
    0 Votes
    4 Posts
    260 Views
    P
    Actually I think I can do what I need by using mktime() : t = (2009, 2, 17, 17, 3, 38, 1, 48, 0) secs = time.mktime( t ) print("time.mktime(t) : %f" % secs)
  • string.indexof() ?

    python
    2
    0 Votes
    2 Posts
    212 Views
    S
    @misterlisty Not sure of the context exactly, but I am thinking you want to extract the "2,1" from the data returned from the CREG+ AT command? I came up with this to extract the RSSI from the LTE connection and use it in a text string for example.. # Get the current LTE signal quality squallteM = lteM.send_at_cmd('AT+CSQ').strip().split() rquallteM = int(squallteM[1].split(',')[0]) # Evaluate the returned signal quality Data rssilteM = 113 - ((rquallteM) * 2) ltesqual = ("LTE RSSI: -{} dbM".format(rssilteM)) The .strip() and .split() operators should do what you want.. Hope it helps.
  • Import of variables from boot.py

    boot.py
    9
    0 Votes
    9 Posts
    2k Views
    robert-hhR
    @PeterB I'm not using the pymakr plug-in, but form the discussion i recall, that there is an option to run safe boot before upload. Safe boot bypasses boot.py and main.py. In that case the objects defined in boot.py to not exist.
  • Sending sensor data to server using LoRa

    lora fipy pysense
    11
    0 Votes
    11 Posts
    2k Views
    J
    @Lonefish Do you actually have a valid IP connection between the FiPy and the server? The topic of the subject talks about LoRa, but you can't perform HTTP requests over LoRa, you need to go through a gateway for that.
  • How to use "libpcre" on the Pycom MicroPython runtime?

    6
    0 Votes
    6 Posts
    634 Views
    A
    Hi again, we resolved this issue and it is easy to tackle if you know what has been happening to make things go south. So, let me explain. When installing micropython-urllib.parse with upip, this obviously pulls in all package dependencies. One dependency, the package micropython-re-pcre brings in the re.py module along with ffilib.py as a utility module to be able to talk to libpcre. However, all of this is not available on the Pycom platform, but Pycom itself ships a built-in re package, which would have worked right away when not being masked by the vanilla re.py shipped through micropython-re-pcre. So, we manually remove re.py and ffilib.py from the dist-packages folder before uploading the firmware using rshell. Then, urllib will use the built-in re.py module and everything works like a charm. Sorry for the noise and happy hacking, Andreas. P.S.: If you are interested in what we are building here, you are welcome to have a look at the Hiveeyes MPY data logger firmware. We'd love to hear about any feedback and suggestions you might have.

Pycom on Twitter