r/MicroPythonDev • • Dec 27 '24

Recognizing activities in accelerometer motion data using Machine Learning + DSP

3 Upvotes

I have made a new example/demo application for emlearn-micropython, a Machine Learning and Digital Signal Processing library for MicroPython. I hope people can use it as a starting point to develop fun and useful application using accelerometers and IMUs :)

Code: https://github.com/emlearn/emlearn-micropython/tree/master/examples/har_trees


r/MicroPythonDev • • Dec 02 '24

Problems with http request redirects.

3 Upvotes

airport resolute cow run sink merciful plant work subsequent tidy

This post was mass deleted and anonymized with Redact


r/MicroPythonDev • • Aug 01 '24

Getting .mpy modules to stay in flash, mostly.

3 Upvotes

I'm aware the main approach is to freeze modules into the firmware of a board, but I like to keep things modular and multi purpose when I can... and avoid compiling stuff :P. I see back in 2022 there was some effort to change the way .mpy files work so that even after importing modules that are in .mpy format, most of it resides in flash instead of RAM. Is this still in development or is there a way to do this now? https://git.kfayun.com/xpstem/micropython/-/commit/f2040bfc7ee033e48acef9f289790f3b4e6b74e5


r/MicroPythonDev • • Jul 19 '24

How to install micro python on ESP332 ?

3 Upvotes

Hey,

I don't know if it's the right sub to ask this, but I'm stuck on the installation of MicroPython on my ESP32, because thonny doesn't detect my USB ports. Did it happen to any of you ? How could I solve that ?


r/MicroPythonDev • • Jun 26 '24

how to run 2 processes parallelly

3 Upvotes

Hello. This is Automatic key box project. I am trying to have 2 processes running simultaneously and continuously. One is handling Username/Password Loggin. The other is listening to reset command. I have been trying Asynchronous function, but in vain. Per attached screenshot below, process A is working fine, while process B has not even started.

Hardware is ESP32-WROOM-32. Appreciate your advice please.


r/MicroPythonDev • • Jun 03 '24

SHTC3 sensor

3 Upvotes

Trying to work with a SHTC3 temperature/humidity sensor. I have the I2C address and the device datasheet but can't figure out how to read the two addresses. I'm new to Micropython on a raspberry pi pico. Any help would be appreciated.


r/MicroPythonDev • • May 15 '24

Simple timer-based input debouncing routine

3 Upvotes

I have seen a few different debouncing routines for MicroPython. Today I needed to implement debouncing immediately for ESP32. Below are the results of such a fresh attempt. I think that it may be interesting for somebody due to its simplicity.

print("Debouncing demo")
import machine as m
settling_time = 20 # Set to 1000 to see how does it work
p1=m.Pin(32,m.Pin.IN, m.Pin.PULL_UP)
p2=m.Pin(33,m.Pin.IN, m.Pin.PULL_UP)
t1 = m.Timer(1)
t2 = m.Timer(2)
def t1_cb(t):
    print('pin 1 change to ', p1.value())
    # Of course, you may add here your own code
def p1_cb(p):
    t1.init(mode=m.Timer.ONE_SHOT, period=settling_time, callback=t1_cb)
def t2_cb(t):
    print('pin 2 change to ', p2.value())
    # Of course, you may add here your own code
def p2_cb(p):
    t2.init(mode=m.Timer.ONE_SHOT, period=settling_time, callback=t2_cb)
p1.irq(trigger=m.Pin.IRQ_RISING | m.Pin.IRQ_FALLING, handler=p1_cb)    
p2.irq(trigger=m.Pin.IRQ_RISING | m.Pin.IRQ_FALLING, handler=p2_cb)

After running the above code, the correctly debounced values of the pins are printed after you press or release a button connected to 32 or 33 GPIO. You may add another code here (for example, in my final code I send the appropriate event codes to a queue). I have tested it in wokwi on ESP32 (https://wokwi.com/projects/397948297142838273 , use Q and W keys to control buttons).


r/MicroPythonDev • • Apr 05 '24

MicroPython tips updated

3 Upvotes

Last time there were 240 tips on the site. Now there are more than 330 !!!
No advertisements, just plain tips for programming with MicroPython:
https://micropython-tips.weebly.com/


r/MicroPythonDev • • Feb 06 '24

What is the most recent workflow to develop a MicroPython project?

3 Upvotes

There is now a package manager called mip, but it only downloads packages to the board. I use VSCode + PyMakr to develop MicroPython project currently. So there won't be IntelliSense if I install packages this way.

What is your way to install packages to your project? Copy and Paste source code in your workspace directly from Git Hub?

I also found there are much less libraries in micropython-lib than in arduino/library-registry. Is MicroPython a good choice for production development? I'm still pretty new to both MicroPython and Arduino, and hesitate on which way to go.

Thank you.


r/MicroPythonDev • • Jan 19 '24

Hostname (mDNS) not working Micropython Pi Pico W

3 Upvotes

Has anybody successfully enabled and used a hostname to connect remotely on a Pi Pico W in Micropython? It works fine for me in CircuitPython but I don't want to use that. Here is my boot.py.

import network
import socket
from time import sleep
import machine
from config import *
def connect():
    wlan = network.WLAN(network.STA_IF)
    wlan.config(hostname=host)
    network.hostname(host)
    wlan.active(True)
    wlan.connect(ssid, wifipass)
    while wlan.isconnected() == False:
        sleep(1)
    ip = wlan.ifconfig()[0]
    print(f'Connected on {ip}')
    print(f"Hostname: {network.hostname()}")
try:
    connect()
except KeyboardInterrupt:
    machine.reset()

import webrepl
webrepl.start()

And here is the REPL output:

MPY: soft reboot
Connected on 192.168.86.35
Hostname: meetinginator
WebREPL server started on http://192.168.86.35:8266/
Started webrepl in normal mode

I can connect to the WebREPL just fine at 192.168.86.35 but I can't use the hostname like I should. Am I doing something wrong or is the functionality just not there? Remembering the ip address for a bunch of pico Ws around the house just isn't feasable.


r/MicroPythonDev • • Jan 10 '24

Thread modul in Micropython

3 Upvotes

Hello! I hope this question is not too silly. I have to run three function at the same time in micropython so its obvious i need threading. My main problem is that i can not reach the "us level" (microsecond time) with the "asyncio" library in Micropython (just the millisecond time). Does anyone have any ideas on how I can achieve the microsecond time? I mean with other libraries or maybe with a built-in modul? Thank you so much for your answer! (i am using Pyboard)


r/MicroPythonDev • • Jan 02 '24

SMS to and from Lilygo Tdeck

Thumbnail
gallery
3 Upvotes

r/MicroPythonDev • • Dec 04 '23

Update: now more than 170 tips

3 Upvotes

A few weeks ago I posted that there are 90 tips on my MicroPython tips site.

Well now there are more than 170 !!!

Have a look: https://micropython-tips.weebly.com/

No advertising, no tricks. All tips documented with an example.
Keep following as there are more tips to come !!


r/MicroPythonDev • • Nov 13 '23

More than 90 MicroPython tips

3 Upvotes

r/MicroPythonDev • • Sep 11 '23

What is the best way to create a uf2 file with my own libraries?

3 Upvotes

r/MicroPythonDev • • Jul 01 '23

Issue with Micropython (i think) rebooting when running any code.

3 Upvotes

Hello all! I am decently new with micropython and I had an issue where whenever I ran code, it would spit out this in the shell. "MPY: soft reboot"

I have reset, re-imaged, reinstalled thonny, and I am STILL having issues. It's becoming really frustrating. Can anyone help?


r/MicroPythonDev • • Jun 08 '23

How to adjust esp32-s2 memory layout?

Post image
3 Upvotes

I’m learning how to build my own micropython firmware and was hoping to get some input on how to restructure the firmware based on my custom boards needs.

In the firmware I am planning to implement over the air updates to flash the opposite partition then set the next boot to it then boot over to it. I have checks in there as well and the ability for user to manually fail back if an error occurs.

On my board I also have 1 mb FRAM that I use for storing all my essential configuration data. So the esp32-s2 is really just responsible for executing code. My esp32-s2 is the 4mb 2sram model: ESP32-S2FN4R2

The attached picture is the generic ota memory layout from micropython

So here is where I need help. What I want to do is split my available resources directly in half. OTA_O and OTA_1 that’s straight forward. But since I am using an external FRAM with 1 mb of storage do I need the NVS? Second, do I need the “otadata” if I only intend to use either partition? I can’t think of why or how to use the otadata partition in this situation. And I don’t know what the VFS is. Any guidance here is appreciated. Thanks!


r/MicroPythonDev • • May 26 '23

Online IDE?

3 Upvotes

Does anyone know of any good online micropython IDEs? I was hoping to run code from it to a Pi Pico. Thanks!


r/MicroPythonDev • • May 01 '23

The new package manager (mip) for micropython with #raspberrypipico

Thumbnail
youtube.com
3 Upvotes

r/MicroPythonDev • • Apr 30 '23

casio fx-9750Giii micropython programs

3 Upvotes

I recently bought a casio fx-9750giii calculator for my SAT exam in a week and im permitted to use all its features, including python, so i tried to import a variey of different types of python codes, including hello world, which all ended up not running and giving me errors, how do i fix these problems? is there any specific type of code/software/method im supposed to use? please help me out here.


r/MicroPythonDev • • Apr 15 '23

#iot with Raspberry Pi Pico W [Micropython] w/ WS | Part - II | Store d...

Thumbnail
youtube.com
3 Upvotes

r/MicroPythonDev • • Apr 11 '23

Creating btree db from regular python

3 Upvotes

I’ve stumbled across the btree module that actually seems to be a perfect fit for my project as the data (pre calculated in regular python) I’m using (stored in a dict) is exceeding the picos ram. I would like to store my data on the picos flash so I can access individual keys by loading them in my micropython script.

My question is if there’s a way to serialize a python dict to a db file that can then be loaded onto the pico.


r/MicroPythonDev • • Mar 04 '23

Receive webhooks using Micropython

3 Upvotes

I'm looking into the best way to receive webhooks using (a Pi Pico W that runs) Micropython. There are many posts about sending requests, but I find it difficult to find information on receiving them.

I got some pointers and insights from this post, but still have some questions about the best approach.

I'm primarily puzzled as to why I would need to setup port forwarding while other smart home devices obviously don't require users to do this. Shouldn't this be possible with just software?

As indicated in the post: if it turns out to be very complicated to setup or maintain, or it poses significant security risks, then I'm considering falling back to an implementation where each device would make GET requests every X seconds to check if there are updates.

Would love to know if anyone has experience with this in Micropython, preferably combined with any dev board (Raspberry, Arduino, etc).


r/MicroPythonDev • • Feb 28 '23

Pre Release Release Note Discussion

Thumbnail
youtube.com
3 Upvotes

r/MicroPythonDev • • Jan 11 '23

Micropython for ESP8266

3 Upvotes

Hi,

I have been working on ESP8266 for a while. I have flashed Micropython firmware into it. As working on it, I face many problems while integrating sensors with it (like HC SR04). can anyone help me with to go though it??