An open API service indexing awesome lists of open source software.

https://github.com/epeios-q37/ucuq-python

A very light Python library with no dependencies for easy prototyping of projects based on Wi-Fi-equipped microcontrollers (RPi Pico (2) W, ESP32, ESP8266...)
https://github.com/epeios-q37/ucuq-python

esp32 esp8266 iot microcontroller micropython prototyping python raspberry-pi-pico remote-control wifi

Last synced: 11 days ago
JSON representation

A very light Python library with no dependencies for easy prototyping of projects based on Wi-Fi-equipped microcontrollers (RPi Pico (2) W, ESP32, ESP8266...)

Awesome Lists containing this project

README

          

# Microcontrollers unleashed

Python library for easy prototyping of assemblies based on microcontrollers such as *ESP32*, *ESP8266*, *Raspberry Pico (2) W*…

> Online demonstrations: .

## How to use it

> Above link gives access to an *ESP32* simulation with *UCUq* installed on it and can be very helpful understanding how to do this on your own microcontroller.

### On the microcontroller

1. Install [*Micropython*](https://micropython.org/) on the microcontroller;
2. put *main.py*, *ucuq.py* and *settings.py* on the microcontroller;
3. create an *ucuq.json* file with below content and put it on the microcontroller;
4. restart the microcontroller.

Content of the *ucuq.json* file to put on the microcontroller:

```json
{
"Identification": ["",""],
"WLAN": {
"": ["", ""]
},
"OnBoardLed": [, ],
"version": {
"format": "2025-09-19"
}
}
```

- *<device_token>*: token of the device ; choose one which can not be easily guessed; a token can be shared between several devices;
- *<device_id>*: id of the device, must be unique among devices with same token;
- *<wlan_name>*: name of the wlan (whatever value you want);
- *<wlan_ssid>*: SSID of the wlan;
- *<wlan_key>*: secret key of the wlan;
- *<led_pin>*: the pin of the onboard led from the microcontroller (usually an integer, but can be a string, as with the *RPI Pico (2) W*);
- *<led_logic>*: `true` when the led lights up when the pin level is high, `false` otherwise.

The `OnBoardLed` entry is optional.

You can put more then one entry under the `WLAN` entry; the microcontroller will automatically connect to the first available one. For example, one can be your smartphone's access point, the second your home's Wi-Fi.

### On you computer

1. Retrieve this repository;
2. launch the *Config* app (`python3 Config/` from the *demos* folder);
3. fill the fields accordingly to the content of the *usuq.json* file described above (`Identification`/`device_token` and `Identification`/`device_id`);
4. click on *Save* and quit the app.

As an example, try following code which blinks an LED connected to your microcontroller:

```python
import ucuq, time

for i in range(20):
ucuq.GPIO().high(i & 1)
time.sleep(0.5)
```

Replace ** with the number corresponding of the onboard led pin number or string (or of whichever LED connected to your microcontroller). Launch this program with *python3*.

See the above online demonstrations link for the *API* and examples of use.

## The daemon

Both the microcontroller and the local computer connects to a free public server.

You can use your own server by running the daemon available at . In this case, add also following entry to the *ucuq.json* file of the microcontroller:

```json
{

"Proxy": {
"Host": "",
"Port": ""
}

}
```

The *Port* entry can be omitted if you use the default port.

You have also to modify the *Proxy* settings in the *Config* app launched on the local computer.