Temperature sensor with serial RS-485 interface. Two additional sensors can be connected using 3-pin headers on the circuit board. Uses an AVR ATmega8 microcontroller.

Table of contents

About

This was my first module using the RS-485 communication protocol. RS-485 has a number of advantages over RS-232; it allows for multiple nodes on the same bus, distances up to 1200 meters, and higher speeds.

The module has one internal sensor, LM35, connected to an ADC input on the AVR microcontroller. When requested; the device returns the ADC value. This must be converted into a proper unit by the receiver.

Two auxiliary sensors can be connected to 3-pin headers on the circuit board.

I/O

Inputs

  • PC0 Temperature sensor (analog)
  • PC1 Auxiliary sensor (analog) (not connected)
  • PC2 Auxiliary sensor (analog) (not connected)

Calculations

Temperature

ADC × 5
------- ≈ °C ± 0.5
  10

Humidity

ADC × 5 - 826
------------- ≈ %RH ± 3.5
    31.5

Outputs

  • PB0 Life signal
  • PB1 Link RX activity
  • PB2 Link TX activity

Serial communication

Schematics for the MAX485 interface IC
  • PD0 Rx
  • PD1 Tx
  • PD2 Mode

Communication

Interfacing is done with RS-485, using MAX485 and the SIOS protocol.

Serial settings

  • Baud: 38400
  • Data bits: 8
  • Parity: None
  • Stop bits: 1

Source code

Photos

Inside the module
Testing RD-485 communication
LM35 sensor poking out of enclosure
Strip board with capacitors, for LM35 sensor
Voltage regulator with heat-sink
MAX485 interface IC
Inside the module
Two auxiliary 3-pin headers on circuit board
Completed module

Schematic diagram

Schematic drawing for RS-485 temperature sensor

Parts used

  • 1 × AVR ATmega8-16PU, DIL-28, 16 MHz, 23 I/Os
  • 2 × Capacitor, aluminium electrolytic, 10 µF, 25V
  • 2 × Capacitor, aluminium electrolytic, 47 µF, 25V
  • 3 × Capacitor, ceramic, 1 nF, 100V
  • 3 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
  • 1 × DIL socket, 28-pin, 7.62mm
  • 1 × DIL socket, 8-pin, 7.62mm
  • 1 × Enclosure, plastic (1591), 120x120x59mm
  • 1 × Fuse 5x20 mm, 500 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 × LED 5mm coloured clear, Green, 2.1V, 20mA, 30mcd, 10°
  • 1 × LED 5mm, Red, 2.0V, 20mA
  • 1 × LED 5mm, Yellow, 2.0V, 25mA
  • 3 × LED holder 5mm, RTC51, black plastic
  • 64 cm2 PCB, stripboard, 100x160mm, 160cm2
  • 1 × Power jack, panel, 2.1mm, plastic housing
  • 1 × Resistor, carbon film, 0.25W, 100 Ω, 5%
  • 3 × Resistor, carbon film, 0.25W, 330 Ω, 5%
  • 1 × RS422/485 interface, MAX485CPA, HDX, 2.5 Mbps
  • 1 × Spacer, round unthreaded, 3mm, Ø6mm, Delrin
  • 2 × Spring-loaded terminal block, PCB, 0,5 mm2
  • 2 × Straight pin header, female, Dual row, 2.54mm
  • 22 × Straight pin header, female, Single row, 2.54mm
  • 32 × Straight pin header, male, Single row, 2.54mm
  • 1 × Temperature sensor LM35DZ, 0 to +100 °C, +-0,6 °C
  • 1 × Voltage regulator +5V, 2 A, L78S05CV

Last commit 2024-11-11, with message: Add lots of tags to posts.