lib | ||
config.json | ||
input_tests.py | ||
lcd_big_hello.py | ||
LICENSE | ||
main.py | ||
README.md | ||
utils.py |
uv-belichter-software
A collection of programs run on a Raspberry Pi Pico to control a uv exposure unit (mainly used for exposing PCBs)
Hardware
This program is strongly customized to my needs, and my DIY exposure unit has two buttons and one switch to interact with the software (and a power switch FWIW). Also, a 16x2 display (maybe 20x4 or others do also work, but these are not tested) can show information to the user. A relais is used for switching all the LEDs.
Device Pin | Pi Pico Pin |
---|---|
BTN_1 Pin 1 | 3.3V |
BTN_1 Pin 2 | GPIO15 |
BTN_2 Pin 1 | 3.3V |
BTN_2 Pin 2 | GPIO14 |
SWITCH Pin 1 | 3.3V |
SWITCH Pin 2 | GPIO13 |
LCD SDA | GPIO8 |
LCD SCL | GPIO9 |
LCD GND | GND |
LCD VCC | 5V |
Relais control pin | GPIO21 |
Installation
To install this, use Thonny, open all the files present in this repository and then save them onto a Raspberry Pi Pico (or Pico 2, but it's not tested on this platform yet) running MicroPython. Then, given you followed above wiring, it should just be running! Then you can jump over the configuration section.
Configuration
All the configuration can be done in the config.json file in JSON format just have a look around there. Some hints for editing this file:
-
For a description of all of the attributes, see below
-
When editing the startup section strings, make sure the "STARTUP_PROJECT_NAME" and the "STARTUP_MESSAGE_FINISHED" values have the same length as your display can show (likely 16 characters). Otherwise it could be that some things won't be displayed correctly.
-
When changing Pins in the Pinout section, make sure to follow the pinout assignment of your Pi Pico board (e.g. the i2c sda and scl pins)
-
If your display doesn't work properly - the first issue might be a wrong i2c address. To find the address of your display, just follow some of the tutorials on the internet on scanning for i2c devices (e.g. here).
Attribute table
Attribute name (on top level in config.json) | Type | Description | Default |
---|---|---|---|
"LOG_LEVEL" | int | defines up to which log level to show log messages in the serial console: warn (0), info (1), debug (2) | 2 |
"STARTUP_WELCOME_SHOW" | bool | show the startup screen? | true |
"STARTUP_PROJECT_NAME" | str | the name shown at the welcome/startup screen | " UV-Belichter " |
"STARTUP_MESSAGE_STARTING | str | the message shown at startup when starting | "Starting..." |
"STARTUP_PROJECT_FINISHED" | str | the message shown at startup when finished | " Started! " |
"STARTUP_WELCOME_CYCLES" | int | how often the starting string shall go over the welcome screen | 1 |
"PIN_IN_BTN_1" | dict | the dict must contain the "pin" and "pull" keys with respective values | {"pin": 15, "pull": "down"} |
"PIN_IN_BTN_2" | dict | as above | {"pin": 14, "pull": "down"} |
"PIN_IN_SWITCH" | dict | as above | {"pin": 13, "pull": "down"} |
"PIN_OUT_RELAIS" | int | pin number where the relais is connected | 21 |
"PIN_SDA" | int | the pin number of the sda wire connected to the lcd | 8 |
"PIN_SCL" | int | the pin number of the scl wire connected to the lcd | 9 |
"LCD_I2C_CH" | int | the channel of the i2c bus used | 0 |
"LCD_I2C_ADDR" | int | the i2c address of the lcd; make sure to convert hexadecimal to decimal numbers | 38 |
"LCD_I2C_NUM_ROWS" | int | how many rows for character display has the display? | 2 |
"LCD_I2C_NUM_COLS" | int | and how many characters can it display per row? | 16 |
Note that this software has it's own small wrapper for the config file, e.g. to have instant access to an LCD object generated on the fly. These are all documented in the utils.py file!
Used libraries
- PCF8574T - a driver for the i2c multiplexer used to address the 2x16 lcd display
- WelcomeScreen - used to display a small welcome message in the beginning
- lcdMenu - used for the menus
License
This project is licensed under GPL-3.0-or-later. See LICENSE.