NTC-thermistor incubator with Arduino
Recently, when I stuck with limited lab equipments and decided to produce some for my agricultural post-harvest related research, my eyes fixed with Arduino! This is enough to wake up my old time hobby with electronics (what I really mean was soldering, XD). I never touch them for the past 15 years. I am a total noob in this matter. Arduino recreates a new passion, just like when I learned GNU/Linux some 10 years ago.
Last year, I purchased an Arduino UNO R3 for the purpose of learning and found this is incredibly simple to deliver solutions in my field. I do not need (and do not want too) to learn assembler or AVR languages in depth, just to produce thermocouple logger for cacao fermentation or to build a small scale DC powered incubator for example.
Arduino UNO (pic. from www.arduino.cc)
Enough talking, now I proceed to the core of the article, a tutorial for NTC-thermistor incubator. In this occasion, a “brain” for incubator using negative temperature coefficient thermistor is explained, hopefully clear enough for a beginner like me. The setup is as follow:
- The MCU: ATmega328P-PU chip with Arduino UNO R3 bootloader (howto burning bootloader OR burning bootloader for ATmega328 (without P) ).
- The probe: 3x 10kΩ NTC thermistors
- The output: a led and a buzzer
- Some electronic parts: 4x 10kΩ±5% and 1x 2.2 kΩ±5% resistors, 1x 100nF and 2x 22pF capacitors, 1x opto-isolated 5v relay module, 1x 16Mhz crystal, and some jumper cables.
- The USB to serial: 1x FTDI 5v basic (that also acts as power source).
- Planned electronic parts: 1x double digits 7-segment display and 2x 74HC595 chips (will be explained later in next part)
All of these were purchased from local online shops (I live in Indonesia), i.e. SFE-electronics, iseerobot, famosastudio, geraicerdas, kedairobot, klinikrobot, and many others.
At first, I followed the Arduino standalone tutorial (or from a youtube video if you like). This is the result.
To make things a litter easier, I produced homemade breakout for my triple thermistors with this schema:
Then I slowly added one component after another.
- FTDI basic, with pinouts connected to VCC, GND, CTS (GND), TX (pin 0), RX (pin 1), and DTR + 100nF (pin 0).
- Thermistor breakout is connected to VCC, GND, pin A0, pin A1,and pin A2.
- Relay is connected to VCC, GND, and pin 3.
- Buzzer is connected to pin 4 and GND.
Now it comes to the interesting part: programming. Thanks to Arduino developers and community around the world. Microcontroller programming could not be more fun than before (considering I do NOT have an electronics background). You may visit the official forum, instructables, adafruit, sparkfun and too much resources to read on the net.
Firstly, thermistor runs on the principle of changing resistance upon increase/decrease of environmental temperature. After some reading, I decided to use Steinhart-Hart equation (others may use lookup table), hence the codes (frankly, taken from adafruit page with some modifications) are in the two separated functions (getResistance and getTempC). Since the explanation on the Internet is quite extensive, already, I do not find any use to re-pasting them here (you may download the whole program at the end of this article).
Next step is to check whether probes are working in the expected environment (i.e. 0-70°C). Since I have triple thermistors, I can afford to lose two of them at maximum to get a temperature value. Hence, the function is called checkProbe.
To call the function is pretty basic.
The rest is to create an action function based on temperature reading, i.e. I wanted a range of temperature in between 27-33°C.
All are (almost) done, except for readable message with double digits 7-segment. You may download the code from here. No github account yet :(.
TIME FOR FUNLets connect the FTDI to a USB port.
Part 2: Multi buttons input for single Arduino analog pin
Part 3: Integrating double digits 7-segment (coming soon)