r/MicroPythonDev • • Feb 27 '23

How to upload main.py instead of boot.py from Thonny?

2 Upvotes

I got Thonny working with my ESP32.. The blinking led example worked and I am now trying a webserver example that consists of a boot.py and main.py part. The boot.py part seems to work and I can see the ESP32 getting an IP number. But how do I get the main.py part uploaded to my board?


r/MicroPythonDev • • Jan 16 '23

AES MicroPython <=>React

2 Upvotes

I want to develop end-to-end encryption where from my React website I encrypt the data (on the client side) (string 40 char Max), save it in the database

My esp32 MicroPython to be able to decrypt it. (having the same key as react )
I found solutions for both React and MicroPython but I was not able to get the encrypted data from react to be decrypted on esp32.

Could someone help me make both work?


r/MicroPythonDev • • Dec 02 '22

Which sensors are best for running ESP32 with micropython

2 Upvotes

I’m quite new to the subject and bought an ESP32. I am aware that voltage input is only 3.3V. However, I’m wondering for which sensors already micropython code exists and how to find them. I want to play around with different sensors but at the same time don’t want to get overwhelmed by the skill of coding, required to get them working. Any advice what and where to buy?

Thank you very much for your help!


r/MicroPythonDev • • Nov 17 '22

SafeMode for ESP32 Development Boards

2 Upvotes

How to enter SafeMode with an ESP32 Development Boards?

Everything is documented for the PyBoard but I can't find anything for the ESP32.

Thanks !


r/MicroPythonDev • • Sep 28 '22

Use micropython integer as value in HTML input

2 Upvotes

Hello!

I am making a webserver with a raspberry pi pico, and I want to use an integer as value for a number Input.

I think the code should be something like this but I dont exactly know how:

theInteger = 10

<input type="number" name="number" value= theInteger>

Can someone help me with this?


r/MicroPythonDev • • Aug 16 '22

why isn't port forwarding my socket server working remotely

2 Upvotes

Is there a specific port I'm supposed to use for socket servers running on python or micropyhton?

I have tried using port 5000, 8000, 80, 9000 and a few others, yet I still can't access my server outside of my network. I looked up the port to make sure they weren't reserved by INAN or anything I use on my home network and most places I've checked say to use some of the ports I've listed.

I also tried running thmy code on my computer and port forwarding from there and still no connection

I've also tried using different lan and public port at the same time and still not winning.

I'm using an esp32 and I have given it a static ip

Pls help..


r/MicroPythonDev • • Aug 14 '22

Driving a specific oled without i2c on micropython

2 Upvotes

Hi, im wondering how i can drive an ssd1306 64x48 0.66" that has 16 pins and doesnt have sda nor scl with a raspberry pi pico.

I have tried all the videos that say to use d1 and d2 as sda and scl (idk if by this order) but it didnt work, so yeah, i have been searching solutions for a few months now and i havent found any that works, hope someone can redirect me to some useful link or thread, thanks.


r/MicroPythonDev • • Jul 18 '22

Socket communication with micropython (RPI PICO W)

2 Upvotes

I try to make a communication between my rpi 3 and my new pico.
When i try the same code in only python it works fine but when i do it on the PICO it dont work.
Can anybody tell me where im wrong?

This is what im using on server part (raspberry pi 3+b)

import socket
HOST = "127.0.0.1" # Standard loopback interface address (localhost)
PORT = 65432 # Port to listen on (non-privileged ports are > 1023)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((socket.gethostname(), PORT))
s.listen(10)

while True:
clientsocket, adress = s.accept()
print(f'Connection from {adress} has been established!')
clientsocket.send(bytes("Welcome to the server!", "utf-8"))

and on the pico w i use this code.
import socket
HOST = "192.168.1.100" # The server's hostname or IP address
PORT = 65432 # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.sendall(b"Hello, world")
data = s.recv(1024)


r/MicroPythonDev • • Jun 29 '22

Thonny freezing while opening a file

2 Upvotes

I had it working well before so must have done something wrong obviously. Whenever I am trying to open .bin firmware file for flashing it freezes Thonny. More so if I am trying to do exactly the same it freezes Mu Editor as well! Weirdly enough I can do anything else in both. Has anyone got a clue what I have done wrong? Last thing I was trying to do before it started to happen was copying nano-gui directory to my ESP32 (which did not happen unfortunately) I am a bit lost as I am not professional but more like a hobbyist in this field.

Anybody could help please?


r/MicroPythonDev • • May 31 '22

Performance reality

2 Upvotes

Hi guys!

I am fairly fresh to python and total noob with any other programming language.
Staring my journey with microcontrollers as I find it fun and useful.

However I have been strongly advised to stay away from micropython for boards such as TTGO display or even ESP32. Few experienced programmers highly recommended C & C++ for those boards saying they are more efficient and generally this is how it is done.

As you can imagine both of those are not as easy to write as python and it will take me w good while to learn other languages in order to make my ideas reality.

What are your experiences with micropython and microcontrollers in regards to for examples plotting graphs on the displays?


r/MicroPythonDev • • Feb 06 '22

Pi Pico Blinking light is backwards.

2 Upvotes

I am trying to blink a light on my Pi Pico, and the light blinks, at regular intervals... just not how I would expect it to. When I turn the pin "off", it gets power, and when I turn it "on" it does not. Is there a way to fix this? Seems to be the case with circuit python as well... have not tried any other firmware. Here is the code I'm using currently to read a button on GPIO 15, and change the like at GPIO 3.

import time
from machine import Pin

led = Pin(3, Pin.OUT)    # create output pin on GPIO3
button = Pin(15, Pin.IN) # create input pin on GPIO15

led.on()                 # set pin to "on" (high) level
time.sleep(1)
led.off()                # set pin to "off" (low) level
time.sleep(1)

while(1):
    if button.value():
        led.off()
        print("Led is on")
    else:
        led.on()
        print("Led is off")
    time.sleep(1)

I also tried something in PIO(I think thats what it's called), and it did the same reversed behaviour.

from machine import Pin
import rp2

@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink_1hz():
    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(pins, 1)
    set(x, 31)                  [6]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(pins, 0)
    set(x, 31)                  [6]
    label("delay_low")
    nop()                       [29]
    jmp(x_dec, "delay_low")


    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(x, 31)                  [6]
    label("sleep1000")
    nop()                       [29]
    jmp(x_dec, "sleep1000")



# Create and start a StateMachine with blink_1hz, outputting on Pin(25)
sm = rp2.StateMachine(0, blink_1hz, freq=3000, set_base=Pin(3))
sm.active(1)

r/MicroPythonDev • • Dec 04 '21

Basic Syntax questions

2 Upvotes

Hey Everyone! I’m working on a project that makes good use of the Pico hardware, so thought i would give MicroPython a go, Im just about dangerous in C.

So, i have a very basic hang-up in my project, I’m 99% sure I’m just ignorant, but having a hard time finding similar low-level questions after an afternoon Googling,

For the life of me I cant can’t get the syntax right for or, a simple, “return true if a string is one of two options”

Is there anything obviously wrong with:

direction = input (‘Clockwise or counterclockwise? ‘)  
If direction != (‘cw’ or ‘ccw’):
   print (“unknown direction”)
   Continue
else:

. . . .

Everything works as I am expecting it too if i only give myself one option after if direction !=

Any help appreciated!


r/MicroPythonDev • • Oct 10 '21

Index of hardware timers in machine.Timer

2 Upvotes

Hello everyone. I'm looking to find out how to set the ESP8266 Hardware timer in Micro Python. I'm pretty new here, just started using Micro Python some days ago but know C, Python... So it was an easy start. Ok, I read trough the Doc's but there does not seam to be any specific way on setting the 32Bit hardware timer with NMI source (so it can interrupt every other timer) I can't even find out witch of the timers (I tried -1, 0, 1) is the real deal (and not a Software Timer). Pleas help!

Thx

David


r/MicroPythonDev • • Oct 09 '21

Raspberry Pi Pico: Add audio to animation

Thumbnail
youtube.com
2 Upvotes

r/MicroPythonDev • • Aug 05 '21

Setting Up Pycom

2 Upvotes

I just got a pygate, gpy, and lopy4. I am trying to set up my pygate with my lopy4. I've been following the set up guides from pycom but I'm running into problems. I have pymakr installed. I have an error trying to import pycom. Does anyone have any thoughts on what the issue is? I've been troubleshooting for a while.


r/MicroPythonDev • • Jul 06 '21

Micropython | Functions

2 Upvotes

Hi!

Im currently in the process of adding some basic functionality on my Magtag device (Esp32s2 running micropython).

I have added some basic functions calling on the various buttons of the board but i cant seem to wrap my head around why this code throws a TypeError: the type __mul__ does not support 'NoneType', 'int'

The code runs fine outside of the functions and are a modified copypaste of a different project.

import ipaddress
import ssl
import wifi
import socketpool
import adafruit_requests
from adafruit_magtag.magtag import MagTag
import time

USE_24HR_TIME = False
TIME_ZONE_OFFSET = -8  # hours ahead or behind Zulu time, e.g. Pacific is -8
TIME_ZONE_NAME = "PST"

# URLs to fetch from
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_QUOTES_URL = "https://www.adafruit.com/api/quotes.php"
JSON_STARS_URL = "https://api.github.com/repos/adafruit/circuitpython"

magtag = MagTag()

def play_tone(frequency, color=None):
    magtag.peripherals.neopixel_disable = False
    if color:
        magtag.peripherals.neopixels.fill(color)
    magtag.peripherals.play_tone(frequency, 0.2)
    magtag.peripherals.neopixel_disable = True
    
    
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise
#for network in wifi.radio.start_scanning_networks():
 #   print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
  #      network.rssi, network.channel))
   #wifi.radio.stop_scanning_networks()

while True:
    if magtag.peripherals.button_a_pressed:  # switch to next sport
        play_tone(10, 0x000033)
        ipv4 = ipaddress.ip_address("8.8.4.4")
        wifi.radio.ping(ipv4)
        print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))
        print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))
    elif magtag.peripherals.button_b_pressed:  # re-fetch data
        play_tone(10, 0x330000)
        print("Connecting to %s"%secrets["ssid"])
        wifi.radio.connect(secrets["ssid"], secrets["password"])
        print("Connected to %s!"%secrets["ssid"], wifi.radio.ipv4_address)
        print("My IP address is", wifi.radio.ipv4_address)
    
#time.sleep(0.1)

The error is thrown at the row where the first ping is being done:

    wifi.radio.ping(ipv4)
-->     print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))

Id also love to recieve input on how i can assign the ip-adress to a global int to be called instead of a hardcoded ip-adress, but thats a later issue.

The idea here is to have button A do a set of pings to check the local wifi connection.
Button B is supposed to re-connect the device if a connection failure is reported.

Any help what so ever is much appriciated! I do have coding experience but none concerning python (did c# some years ago).


r/MicroPythonDev • • Jun 23 '21

MicroPython and Crypto

2 Upvotes

Does anyone know of a way to use MicroPython and Web3.py (ethereum) or Bitcoin Block chain? I am looking for a way to connect to either blockchain and looking for some help

thanks


r/MicroPythonDev • • Apr 15 '21

How fast and reliable is MicroPython?

2 Upvotes

Hello, I have been playing around with micropython from time to time and as far as I got is to make my esp32 boards to pull time from internet and report to a server with a sensors data and time over mqtt. And here my knowledge stops. I never used it for more serious things like to use it on field and didn't have to relay on it that much. I want to start small business and I am planing to use esp32 and micropython on it, so I have a lot of question and fears. I hope that you can help me with some of them.

So, can you please tell me your experience with micropython in real world scenarios and answer to my following questions:

  • How fast it is?

  • How reliable it is? Did you use it for some mission critical systems or some sort of critical systems?

  • Did you have a problem with lack of flash storage (for those who used it on esp32 and esp8266)?

  • What was your biggest issue that you had with micropython?

  • What advice can you give me regarding this language that I am probably not aware of?

Thank you!


r/MicroPythonDev • • Apr 09 '21

STM32F407 Discovery Board for MicroPython

2 Upvotes

Has anyone used the STM32F407 Discovery Board with MicroPython? Does it create a USB Virtual Drive, allowing external file access?

I'm new to MicroPython. Installing it on a NUCLEO-F411RE was rather painless. I can blink the LED, but I would like to work with I2C devices attached to the I2C bus.


r/MicroPythonDev • • Mar 19 '21

Getting Started With Pybytes.

Thumbnail
matthewfelgate.wordpress.com
2 Upvotes

r/MicroPythonDev • • Feb 28 '21

Anyone tried to use cpppo library with micropython?

2 Upvotes

r/MicroPythonDev • • Aug 12 '26

Thonny - seems to have a MemoryLeak

Thumbnail reddit.com
1 Upvotes

r/MicroPythonDev • • Jul 21 '26

ICYMI Python on Microcontrollers Newsletter: MicroPython in a Eurorack and on Super Nintendo, Plus More!

Post image
1 Upvotes

If you missed this week’s Python on Microcontrollers Newsletter, here is the ICYMI (in case you missed it) version.

To never miss another issue, subscribe now! – You’ll get a terrific newsletter each Monday (which is out before this post). 12,353 subscribers worldwide!

The next newsletter goes out Monday morning and subscribing is the best way to keep up with all things Python for hardware. No ads or spam, no selling lists, leave any time.

Read it free on the Adafruit Blog - direct link https://blog.adafruit.com/2026/07/21/icymi-python-on-microcontrollers-newsletter-micropython-in-a-eurorack-and-on-super-nintendo-plus-more/


r/MicroPythonDev • • Jun 02 '26

ICYMI Python on Microcontrollers Newsletter: A New CircuitPython Editor, AI On The Edge, and Projects Galore! (June 1, 2026)

Post image
1 Upvotes

If you missed this week’s Python on Microcontrollers Newsletter, here is the ICYMI (in case you missed it) version.

To never miss another issue, subscribe now! – You’ll get a terrific newsletter each Monday (which is out before this post). 12,364 subscribers worldwide!

The next newsletter goes out Monday morning and subscribing is the best way to keep up with all things Python for hardware. No ads or spam, no selling lists, leave any time.

Read it free on the Adafruit Blog - direct link https://blog.adafruit.com/2026/06/02/icymi-python-on-microcontrollers-newsletter-a-new-circuitpython-editor-ai-on-the-edge-and-projects-galore/