You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
5.1 KiB
Markdown

2 years ago
# Introduction
The Temperature Control Laboratory (TCLab) is an application of feedback control with an Arduino, an LED, two heaters, and two temperature sensors that are mainly based on the `APMonitor TCLab` project by Jeffrey Kantor and Carl Sandrock.
This TCLab consists of three main parts: hardware, Arduino sketch, and the `TCLab` library.
**The following guide provides step-by-step instructions to design and build from scratch your own TCLab version that can communicate with Python and Jupyter Notebook.**
## TCLab hardware
The TCLab is a modular, portable, and inexpensive solution for hands-on process control learning. The heat output produced by the transistor is adjusted by modulating (PWM) the current flow to each of the two devices. Then, thermistors measure the temperatures by the Arduino's ADCs.
The energy from the transistor output is transferred by conduction and convection to the temperature sensor. Heat transfer dynamics provide rich opportunities to implement single and multivariable control systems, modeling, and system identification applications. The TClab is integrated into a small PCB, which can be mounted to any Arduino or Arduino-compatible microcontroller.
The next Figure shows the TCLab version distributed by Jeffrey Kantor and Carl Sandrock.
2 years ago
![](http://apmonitor.com/pdc/uploads/Main/tclab_transparent.png)
The device is a resource for model identification, controller development, and machine learning applications. It is a pocket-sized lab with Python software for the purpose of reinforcing control theory for students.
2 years ago
### TCLab General Schematic
2 years ago
Below is the TCLab main schematic to attach to the Arduino UNO board.
2 years ago
![](./schematic.png)
2 years ago
The board considers the following components:
| Quantity | Description | Value | Package | Notes |
|----------|---------------|----------|------------|-------|
| 2 | TIP31C | | TO-220 | |
| 3 | Resistance | 470 Ohms | 1206 | |
| 2 | TMP36GT | | TO-92 | |
| 1 | LED | | 1206 | |
| 1 | Barrel jack | | | |
| 1 | 10 pins 0.1" | | pin header | |
| 2 | 8 pins 0.1 in | | pin header | |
| 1 | 6 pins 0.1 in | | pin header | |
You will find the complete project with the PCB layout in the open project at [Upverter]().
**The TIP31C and TMP36 data-sheets are in this repository**
## Arduino Sketch
The Arduino Sketch (TCLab sketch) is a set of methods that supports the Temperature Control Lab when downloaded and installed on a compatible Arduino device. The sketch is used in conjunction with the compatible Python library `TCLab` for programmable control of the Temperature Control Lab with Python.
### Hardware setup
2 years ago
1. Plug the Temperature Control Laboratory board in an Arduino UNO or Leonardo. Connect your computer to the Arduino via the USB connection. Plug the DC power adapter into the wall and attach it to the power input to the TCLab board.
2. Install Arduino Drivers if needed. For most users, there will be no need. If you are using Windows 10, the Arduino board should connect with no additional drivers. Mac OS users may need to install a serial driver for Arduino Uno clones. A suitable driver can be found [here](https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver) for clones using the CH340G, CH34G or CH34X chipset.
3. Install Arduino Firmware:
* Download and install the Arduino IDE application.
* Download the file TCLab-sketch.ino located in this repository in the folder with the same name.
* Open the Arduino IDE application. Select the Arduino board type from `Tools -> Board -> Arduino Board -> Arduino Uno` or your compatible board, and finally verify the port connection.
* Compile and upload `TCLab-sketch.ino`
4. Test
To confirm the board's proper operation, use the serial monitor (located under the tools menu of the Arduino IDE). Select serial monitor, set the baud rate to 9600, and line endings to 'newline.' If the firmware is operating correctly, enter the command
```
LED 100
```
will cause the LED to flash at 100% power for 10 seconds.
## TCLab library
First, install the Python TCLab library by using:
```
pip3 install tclab
```
then open a Python IDE or execute the next code in Jupyter Notebook.
```
import tclab
with tclab.TCLab() as lab:
print(lab.T1)
```
if everything was done properly, you should receive a message back indicating the temperature of transistor 1 `T1`:
```
Connecting to TCLab
TCLab Firmware Version 1.2.1 on NHduino connected to port XXXX
21.54
TCLab disconnected successfully.
```
---
2 years ago
# Main project objective
The `TC-Lab` project will be used for the students as a portable temperature controller system to implement several kinds of controllers. Thus, the student should develop the next tasks to reach the final goal (main objective):
- Develop the basic schematic
- Develop the PCB for the `TC-Lab`
- Test the `TC-Lab` in the Arduino platform
- Acquire temperature data from the heaters
- Develop a regressor and a classifier
![](http://apmonitor.com/pdc/uploads/Main/tclab_schematic.png)
2 years ago
![](./pcb.png)