I rebuilt an existing interface module — to be a stand-alone temperature and humidity sensor, with serial RS-232 interface. Uses an AVR ATmega8 microcontroller.
Table of contents
About
This module was originally installed in the rack box, as an I/O module. When the rack box project was terminated, I instead repurposed the unit to become a stand-alone temperature and humidity sensor.
It has two sensors, LM35 and HIH 4000, connected to ADC inputs on the AVR microcontroller. When requested; the device returns the ADC value. This must be converted into a proper unit by the receiver.
I/O
Inputs
- PC0 Temperature sensor (analog)
- PC1 Humidity sensor (analog)
Calculations
Temperature
ADC × 5
------- ≈ °C ± 0.5
10
Humidity
ADC × 5 - 826
------------- ≈ %RH ± 3.5
31.5
Outputs
- PB0 Life signal
- PB1 Link activity
Serial communication
- PD0 Rx
- PD1 Tx
D-sub 15-pin
- 13.8V
- 0V
Communication
Interfacing is done with RS-232, using MAX232 or MAX202 and the SIOS protocol.
Serial settings
- Baud: 38400
- Data bits: 8
- Parity: None
- Stop bits: 1
Source code
- Bascom-AVR source is available in a git repository:
- https://github.com/thomasjsn/AVR-Temp-humidity-sensor-RS232
Photos
Schematic diagram
Parts used
- 1 × AVR ATmega8-16PU, DIL-28, 16 MHz, 23 I/Os
- 5 × Capacitor, aluminium electrolytic, 1 µF, 50V
- 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
- 2 × Capacitor, aluminium electrolytic, 47 µF, 25V
- 1 × Capacitor, ceramic, 1 nF, 100V
- 3 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
- 1 × D-sub soldering cups, 15 pin male
- 1 × D-sub soldering cups, 9 pin female
- 1 × DIL socket, 16-pin, 7.62mm
- 1 × DIL socket, 28-pin, 7.62mm
- 1 × Enclosure, plastic (1591 FL), 120x65x40mm, flange
- 1 × Fuse 5x20 mm, 200 mA, fast-acting
- 1 × Fuse holder, open, PCB, 5x20mm
- 1 × Fuse holder, open, PCB, Protective cover
- 1 × Heatsink, 27.3K/W, 19mm, attachable, TO220
- 1 × Humidity sensor, HIH 4000, 0 - 100 %, +4 to +5.8 V
- 1 × LED 5mm clear, Yellow, 2.0V, 20mA, 250mcd, 6°
- 1 × LED 5mm coloured clear, Green, 2.1V, 20mA, 30mcd, 10°
- 2 × LED holder 5mm, RTC51, black plastic
- 64 cm2 PCB, stripboard, 100x160mm, 160cm2
- 1 × Power jack, panel, 2.1mm, plastic housing
- 2 × Resistor, carbon film, 0.25W, 330 Ω, 5%
- 2 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
- 1 × RS232 interface, MAX232CPE, dual
- 25 × Straight pin header, female, Single row, 2.54mm
- 25 × Straight pin header, male, Single row, 2.54mm
- 1 × Temperature sensor LM35DZ, 0 to +100 °C, +-0,6 °C
- 1 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
- 1 × Voltage regulator +5V, 2 A, L78S05CV
Last commit 2024-11-11, with message: Add lots of tags to posts.