This post is part of the Rack Box Project series.

Serial (RS-232) interface module; providing 6 analog and 2 digital inputs, and 9 digital outputs. Uses an AVR ATmega8 microcontroller.

Table of contents

Details

This interface module provides 6 analog and 2 digital inputs, and 9 digital outputs for the computer serial port.

The outputs are open collector, meaning GND when activated. Max load per output is 100mA.

The digital inputs are triggered when they are pulled low (connected to GND). The A/D converter on the analog inputs is 10-bit.

This module used to be installed in the rack box, where it measured the voltage of the 5, 13.8 and 24 volt supply and the temperature.

The two auxiliary analog inputs where used for two external LM35 temperature sensors outside the rack box. A 1uF capacitor was connected between GND and the signal input, this removed noise and stabilized the input signal.

I/O

Inputs

  • PC0 5V voltage meter
  • PC1 13.8V voltage meter
  • PC2 24V voltage meter
  • PC3 Temperature rack box
  • PC4 Input 5 (Analog)
  • PC5 Input 6 (Analog)
  • PD5 Input 7
  • PD6 Input 8

Calculations

Voltage

(ADC × 5) × 0.006 ≈ V ± 0.03 

Temperature

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

Outputs

  • PB0 Output 1
  • PB1 Output 2
  • PB2 Output 3
  • PB3 Output 4
  • PB4 Output 5
  • PB5 Output 6
  • PB6 Output 7
  • PB7 Output 8
  • PD2 Output 9
  • PD3 Lifesignal (to Module stability monitoring unit 2)
  • PD4 Link activity

D-sub 25-pin

  1. 13.8V
  2. 0V
  3. Input 5V (Analog)
  4. Input 24V (Analog)
  5. 5V to analog sensor
  6. 0V to analog sensor
  7. Input 5 (Analog)
  8. Input 6 (Analog)
  9. Input 7
  10. Input 8
  11. Output 1
  12. Output 2
  13. Output 3
  14. Output 4
  15. Output 5
  16. Output 6
  17. Output 7
  18. Output 8
  19. Output 9
  20. Lifesignal

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

Photos

Cutouts in plastic enclosure
Installing LEDs and D-sub connector
Mounting LEDs, fuse and D-sub connectors
Started work on circuit board
Backside of strip board
Circuit board assembly
Backside of strip board
Circuit board complete, AVR microcontroller and interface IC not installed
Backside of strip board
Inside the module during assembly
Inside the module during assembly
Inside the module during assembly
Module complete
AVR microcontroller inside module
Inside the module
Mounted in the rack box
Mounted in the rack box

LM35 sensors

Strip board for external LM35 sensor
External LM35 sensor
Temperature sensor in the hallway cabinet
Temperature sensor by the work bench
Capacitors to stabilize input signals from external sensors

Schematic drawing

Schematics for serial interface module

Parts list

  • 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
  • 2 × Capacitor, ceramic, 1 nF, 100V
  • 2 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
  • 1 × D-sub soldering cups, 25 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), 150x80x50mm, flange
  • 1 × Fuse 5x20 mm, 1 A, fast-acting
  • 1 × Fuse holder, panel, 5x20mm, PTF30
  • 1 × Heatsink, 27.3K/W, 19mm, attachable, TO220
  • 1 × LED 5mm clear, Green, 2.1V, 20mA, 385mcd, 6°
  • 1 × LED 5mm clear, Yellow, 2.0V, 20mA, 250mcd, 6°
  • 2 × LED holder 5mm, Black plastic
  • 64 cm2 PCB, stripboard, 100x160mm, 160cm2
  • 4 × Resistor, carbon film, 0.25W, 330 Ω, 5%
  • 11 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
  • 2 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
  • 3 × Resistor, carbon film, 0.25W, 100 kΩ, 5%
  • 3 × Resistor, metal film, 0.6W, 20 kΩ, 1%
  • 1 × RS232 interface, MAX232CPE, dual
  • 1 × Spacer, round unthreaded, 3mm, Ø6mm, Delrin
  • 33 × Straight pin header, female, Single row, 2.54mm
  • 33 × Straight pin header, male, Single row, 2.54mm
  • 1 × Temperature sensor LM35DZ, 0 to +100 °C, +-0,6 °C
  • 10 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
  • 1 × Voltage regulator +5V, 2 A, L78S05CV

External temperature sensor

  • 1 × Capacitor, aluminium electrolytic, 1 µF, 50V
  • 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
  • 1 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
  • 2 m Control cable, 4-cores, 0.25mm2, 250 V, Ø 4.6mm
  • 1 × Enclosure, plastic (1551), 50x50x20mm
  • 1 × Resistor, carbon film, 0.25W, 75 Ω, 5%
  • 1 × Temperature sensor LM35DZ, 0 to +100 °C, +-0,6 °C

Last commit 2024-04-05, with message: Tag cleanup.


Rack Box Project series

  1. Parallel port I/O module
  2. Power supply and fuse monitoring module, AVR
  3. Monitored fuse box, 6 channels
  4. Stack lights and horn controller — with AVR
  5. Mute and light controller for the Rack box — AVR module
  6. Monitored fuse box, 4 channels
  7. Module heartbeat monitor, 6 inputs — AVR
  8. Controller for lights and relays — AVR driven
  9. Emergency power off controller — controlled by 555 timers
  10. Fan controller with LCD — AVR powered
  11. Sound alarm control unit — AVR module
  12. Multiplexer output extender
  13. Multi-purpose AVR module
  14. Electric heater and timer controller — AVR
  15. Module heartbeat monitor, 15 inputs — LCD and AVR
  16. Serial port I/O module with 11 inputs — AVR
  17. Serial port I/O module with 9 in and outputs — AVR
  18. Serial interface for emergency power off — AVR
  19. Status panel for the Rack box project
  20. Intruder alarm system controller — AVR
  21. Serial port I/O module with 15 inputs — AVR
  22. Serial interface module, with analog and digital I/O — AVR
  23. The rack box project — an overview