I have started migrating content to my Hugo blog at https://blog.cavelab.dev, already migrated pages will redirect there.

Multi-purpose AVR module

From CaveLab
(Redirected from Multi-purpose module 1)
This page is kept for historical interest. It may document projects or methods that are obsolete and/or no longer relevant. The information here is not kept up-to-date.

This module was part of the rack box project — which was terminated when I moved out of my first apartment.
MPM1 installed in the Rack box

Monitor status panel, IR sensor, porch door and turn off lights. Uses an AVR ATtiny2313 microcontroller.


This module does many things:

  1. Monitor the Rack status panel.
    • Connected: green flashing LED.
    • Disconnected: red flashing LED.
    • Alarm: If the Rack status panel has been connected and is disconnected the alarm is triggered, the LED will flash both red and green. This condition must be reset using the reset switch.
  2. Monitor the movement (IR) sensor and porch door.
    • Open porch door: slow yellow flashing LED. A signal is also sent to Oven and signal unit, a unit that controls the living room heating.
    • Movement detected: fast red flashing LED.
    • If the porch door is closed and no movement is detected a "all-ok" signal is sent to Alarm unit, this is the alarm input signal.
  3. Turn of lights in the living room using signals from the Light control unit.
    • The living room lights can be turned off instantly or after 45 seconds. It's however not possible to turn the lights back on again, this is caused by the digital regulator on the lamp. It does not turn it self back on when power is restored.




  1. Panel OK (to Rack status panel)
  2. IR Sensor
  3. Porch door
  4. Lights out (from Light control unit)
  5. Lights out 45 sec (from Light control unit)
  6. Reset panel error (N.C)


  1. Panel OK
  2. Panel NOK
  3. Signal to Alarm unit (N.C)
  4. Living room lights off relay
  5. Porch door LED
  6. IR Sensor LED
  7. Panel error (to Signal and lights controlling unit)
  8. Lifesignal (to Module stability monitoring unit 2)

D-Sub 15-pin

  1. +5V
  2. 0v
  3. Lifesignal
  4. In: Panel OK +
  5. In: Panel OK -
  6. In: IR Sensor (N.C)
  7. In: Porch door + (N.C)
  8. In: Lights out
  9. In: Lights out 45 sec
  10. Out: Signal to ALU (N.C)
  11. Out: Living room lights off relay
  12. Out: Porch door LED
  13. Out: IR LED
  14. Out: Panel error

Source code

Bascom-AVR source is available in a git repository:


Schematic drawing

Mpm1 circuit.png

Parts list

Qty. Part
1 × AVR ATtiny2313-20PU, DIL-20, 20 MHz, 18 I/Os
1 × Capacitor, aluminium electrolytic, 10 µF, 25V
1 × Capacitor, ceramic, 1 nF, 100V
1 × D-sub soldering cups, 15 pin male
1 × DIL socket, 20-pin, 7.62mm
2 × DIL socket, 6-pin, 7.62mm
1 × Enclosure, plastic (1591 FL), 112x62x31mm, flange
1 × LED 5mm coloured clear, Green, 2.1V, 20mA, 30mcd, 10°
1 × LED 5mm, Red, 2.0V, 20mA
1 × LED 5mm, Red/Green, 2.0 2.1V, 10mA, 100 63mcd, 30°
1 × LED 5mm, Yellow, 2.0V, 25mA
1 × LED holder 5mm, RTC51, black plastic
1 × LED lens 5mm, CLF 280, Clear
1 × LED lens 5mm, CLF 280, Red
1 × LED lens 5mm, CLF 280, Yellow
2 × Optocoupler, single, CNY17F-3, DIL-6
64 cm2 PCB, stripboard, 100x160mm, 160cm2
11 × Resistor, carbon film, 0.25W, 330 Ω, 5%
7 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
6 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
2 × Resistor, metal film, 0.6W, 1 kΩ, 1%
18 × Straight pin header, female, Single row, 2.54mm
18 × Straight pin header, male, Single row, 2.54mm
1 × Switch, push-button, 1-pole, 1A, 50VAC, on-(off)
6 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B