This post is part of the Rack box project series.

Serial (RS-232) interface module; providing 15 digital inputs. Uses an AVR ATmega8 microcontroller.

Table of contents

Details

This serial I/O module is connected to a computer serial port, and reports the status of 15 inputs. It is a rebuild of a previous module.

When an input is activated; the unit sends the status to the computer instantly. Each input has a hysteresis of three seconds to prevent unwanted rapid switching. It’s also possible to request the status of any input at any given time.

Every 20th second a life pulse is sent to Serial Server.

After the Rack box project was terminated, this project was rebuilt into Temperature and humidity sensor.

I/O

Inputs

  1. PC0 In 1
  2. PC1 In 2
  3. PC2 In 3
  4. PC3 In 4
  5. PC4 In 5
  6. PC5 In 6
  7. PD3 In 7
  8. PD4 In 8
  9. PD5 In 9
  10. PD6 In 10
  11. PD7 In 11
  12. PB2 In 12
  13. PB3 In 13
  14. PB4 In 14
  15. PB5 In 15

Outputs

  1. PB0 Life-signal (to Module stability monitoring unit 2)
  2. PB1 Link activity LED

Interface

  • PD0 RS-232 Rx
  • PD1 RS-232 Tx

Connectors

Wires

  • Red: 5V
  • White: 0V
  • Green: Life-signal

15-pin

  1. In 1
  2. In 2
  3. In 3
  4. In 4
  5. In 5
  6. In 6
  7. In 7
  8. In 8
  9. In 9
  10. In 10
  11. In 11
  12. In 12
  13. In 13
  14. In 14
  15. In 15

9-pin

  • 2 Transmit
  • 3 Receive
  • 5 GND

Communication

Interfacing is done with RS-232, using MAX232 or MAX202 and the SIOS protocol.

001:i:02:1:116 'in 2 on
001:i:01:1:115 'in 1 on
001:i:02:0:116 'in 2 off
001:i:01:0:115 'in 1 off
001:s:01:1:126 'life-signal

Serial settings

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

Source code

Photos

Stripped enclosure from previous module
Parts laid out, brackets to mount the module on a DIN rail
D-sub connectors mounted in enclosure
New circuit board complete, AVR microcontroller not yet installed
Module complete
Mounted in the rack box

Schematic drawing

Schematics for the 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
  • 1 × Capacitor, ceramic, 1 nF, 100V
  • 2 × 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 × 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
  • 2 × Mounting bracket, DIN rail, Plastic
  • 32 cm2 PCB, stripboard, 100x160mm, 160cm2
  • 17 × Resistor, carbon film, 0.25W, 330 Ω, 5%
  • 2 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
  • 15 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
  • 1 × RS232 interface, MAX232CPE, dual
  • 22 × Straight pin header, female, Single row, 2.54mm
  • 30 × Straight pin header, male, Single row, 2.54mm
  • 1 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B

Last commit 2023-02-05, with message: Add series for the rack box project.