Questions tagged [micropython]

MicroPython is a Python interpreter (with partial native code compilation feature). It provides a subset of Python 3.5 features, implemented for embedded processors and constrained systems.

About

MicroPython is a lean and fast implementation of the Python 3 programming language that is optimised to run on a microcontroller. It was originally created by the Australian programmer and physicist Damien George and first appeared in May of 2014.

The MicroPython board is a small electronic circuit board that runs MicroPython on the bare metal, and gives you a low-level Python operating system that can be used to control all kinds of electronic projects.

MicroPython was successfully funded via a Kickstarter campaign. The software is available to the public under the MIT open source license.

Books

Sites

Damien George's KickStarter project to develop a API to use with ESP8266 WiFi chip, optimised and well supported. ESP8266 is one of the best boards to use with MicroPython.

Example projects

1031 questions
3
votes
1 answer

How to have the Pico W set correct time on boot

When running on batteries the Pico W's clock/utime starts at 2021-01-01 00:00:00 by default. At every boot it obviously should: Get the current time on its own, likely off the internet. Set it's internal chips to that time so that its utime library…
Flood
  • 345
  • 7
  • 12
3
votes
1 answer

urequests only working on specific websites

I am using a nodemcu esp8266 and the plan is to make a spotify api request to automate playing some songs, and I have a fully functional python script that does exactly that, but when I tried to convert it to upython it failed. I have now spent…
3
votes
3 answers

How to retrieve and format wifi MAC address in MicroPython on ESP32?

I have the following MicroPython code running on an ESP32: import network wlan_sta = network.WLAN(network.STA_IF) wlan_sta.active(True) wlan_mac = wlan_sta.config('mac') print("MAC Address:", wlan_mac) # Show MAC for peering The output looks…
Dave H.
  • 538
  • 5
  • 11
3
votes
1 answer

How to write tests for micropython

I would like to write tests for the micropython code I am writing for the micro:bit. The examples here use doctest. I am open to work arounds for any testing system. Working python example called testing_python.py: def sum(a, b): ''' >>>…
Oppy
  • 2,662
  • 16
  • 22
3
votes
1 answer

Is there a version of Pandas that will work with MicroPython?

I have a program that utilizes Pandas and Numpi which I want to operate on an ESP32 micro controller. Is there a version of Pandas and Numpi that will work on the ESP32 so I can run the existing code program? If yes, does anyone know of any…
3
votes
1 answer

How do I manually install a library in Thonny

I want to install this library using Thonny https://github.com/adafruit/Adafruit-uRTC to use a DS3231 with my Raspberry Pi Pico. I cannot install it via the built-in package manager feature for two reasons. The version on PyPi is out of date and…
Ben Robinson
  • 21,601
  • 5
  • 62
  • 79
3
votes
1 answer

Convert CRC16 CCITT code from C to Python

I want to do a Python implementation (actually MicroPython) of a specific checksum calculation based on CRC16-CCITT. It will be used on a microcontroller to check data integrity over a serial connection. The algorithm is available as C…
chiefenne
  • 565
  • 2
  • 15
  • 30
3
votes
1 answer

Esp32 Micropython Max31865 Spi connection and data read

I need to read temperature data with using MAX31865 SPI communication. First of all, I tried to read 4 byte data: import machine import ubinascii spi = machine.SPI(1, baudrate=5000000, polarity=0, phase=0) #baudrate controls the speed of the clock…
noobinmath
  • 175
  • 2
  • 12
3
votes
1 answer

BLE scan() not returning complete advertisement payload

Summary: Micropython Bluetooth BLE scan() does not return the complete advertisement payload, specifically missing "Complete Local Name". Setup: ESP32-WROOM-32 esp32-idf4-20210202-v1.14 Micropython GitHub examples/bluetooth/ble_simple_central.py…
Blip
  • 161
  • 8
3
votes
2 answers

Raspberry pi pico rfid rc522 (Micropython)

I want to read data from mfrc522 (Iduino RFID-rc522) card reader using my RPi Pico but I don't know how to. I was trying to use mfrc522.py MicroPython library made for this purpose. Reader is communicating with Pi over SPI and I connected it to…
HeyNobody
  • 33
  • 1
  • 4
3
votes
3 answers

Using TLS with SIM7080 (SIM7000) AT commands. How to deal with certificates

I have a module with a sim7080 chip. I want to use NBIoT to send data via mqtt to my server. But as a first step I wanted to start with http. Sending HTTP Requests works pretty well. The problem occurs if using…
emch2
  • 211
  • 2
  • 11
3
votes
1 answer

How do I transfer my Python script including my module to the micro:bit?

We use the micro:bit with the accessory Bit:bot XL. I have a module (robot.py) with just a single function for the Bit:bot (for now). In my script (my.py) I import this function. But after flashing the micro:bit (uflash my.py), there's an error on…
3
votes
1 answer

Cannot install uasyncio package on esp32 using upip

I have been using uasyncio on ESP32-WROOM-32D. After all the testing, I am trying to use the firmware to my other boards but uasyncio is not installed by default with the micropython. I tried to install the package by >rshell -p comX >repl >>>…
Raj Masud
  • 61
  • 2
3
votes
1 answer

Can circuitpython libraries be imported and used in micropython?

I am researching on micropython to use for an IoT project for school using nodeMCU esp8266. one of the use cases requires the device to receive IR signal from an Aircon remote control and save it as well as being able to transmit this code using and…
3
votes
1 answer

Why does this code display 'A' on start without any input?

This is a morse code translator for microbit but it displays 'A' on start from microbit import * morse={'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L',…
YEp d
  • 154
  • 1
  • 9
1 2
3
68 69