https://github.com/jkorte-dev/micropython-tm1652
micropython example code for weact studio tm1652 digital tube module
https://github.com/jkorte-dev/micropython-tm1652
micropython micropython-driver tm1652
Last synced: about 2 months ago
JSON representation
micropython example code for weact studio tm1652 digital tube module
- Host: GitHub
- URL: https://github.com/jkorte-dev/micropython-tm1652
- Owner: jkorte-dev
- License: mit
- Created: 2025-03-02T20:24:08.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-03-12T20:04:55.000Z (11 months ago)
- Last Synced: 2025-03-12T21:19:53.566Z (11 months ago)
- Topics: micropython, micropython-driver, tm1652
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TM1652 4x7-Segments LED Display with Micropython
=========================================================================================
Micropython example code for [WeActStudio Digital Tube Module](https://github.com/WeActStudio/WeActStudio.DigitalTubeModule) (TM1652) 4x7 segments LED display.
The module uses serial communication to control the LEDs. Connect the provided red cable (labeled with SDA) with the TX port of your MCU, the yellow cable with VCC (3.3 or 5V) and GND to ground (black cable).
Color coding is misleading but just follow the labeling on the module.
Important notes:
1. *communication with the tm1652 uses UART and needs to be set to parity odd.*
2. *brightness value is 4 bits reversed order (data sheet page 6)*
3. *default brightness is 0, therefore you have to set brightness to see anything. In tm1652.py 3 is set as default*
Mimimal code to display the numbers 0 to 3 on the display is:
```code
from machine import UART
import time
uart = UART(1, 19200)
uart.init(19200, bits=8, parity=1, stop=1, timeout=50)
uart.write(bytearray(b'\x18\x1c')) # set brightness to 3
time.sleep(0.006)
uart.write(bytearray(b'\x08\x3f\x06\x5B\x4f')) # display numbers
```
More convenient way using `tm1652.py`:
```code
from machine import UART
uart = UART(1, 19200)
display = TM1652(uart)
display.show_text("0123")
```
See `tm1652_exmaple.py` for more. E.g. there is experimental support for gpio tx instead of uart tx.
### Resources
Compiled from the following resource:
- [Mike Causer TM1638 driver](https://github.com/mcauser/micropython-tm1637) (most code borrowed from there)
- WeActStudio Python / Arduino examples