Skip to content

lixianphys/pidML

Repository files navigation

pidML - Genetic-algorithm-trained PID controller

This project is to refactor my old kettle with a PID controller and its accessories to regulate water temperature below the boiling point like a Sous vide cooker. To dive deeper, please visit my personal website.

How to use

Clone this repository to your directory_to_project

git clone [email protected]:LarsonLaugh/pidML.git

For python users, use pidtrain.py to train your PID controller in simulation. The Micropython code for your MCU is stored in mpython folder. Please include the libraries in lib as well.

For C++ users, use pidtrain.cpp to train your PID controller instead (My test is .cpp code is 50 times faster). The Arduino code for your MCU is stored in Arduino folder and please include the libraries folder.

List of hardware components and wiring

Functional parts Models
Microprocessor Raspberry Pi Pico/ Ardurio Nano
Temperature sensor MAX6675
220V control Relay
User interface ICD 1602
User input rotary potentiometer

idea0

Intro to user interface via LCD 1602

The LCD is only 16 by 2, so we have to fully exploit the limited screen space and the switch button of the rotary potentiometer.

screen0

This is the main screen to display setting temperature and reading. Press button to go next.

screen1

This is the second screen (screen1) to monitor the PID paramters in use and the calculated output value in real time. Press button to go next and roll to the left to go back to screen0.

screen2

screen3

screen4

Above three screens (screen2 to screen4) to modify the PID parameters one by one manually. Use the rotary potentiometer. Press button to go next.

screen5

This is the last screen screen5. Roll left to adapt Auto mode (default setting) and press button to accept the manually set PID paramters and go to screen0.