Lights and relays controller with 3 channels

From StdOut
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.
LCU installed in the Rack box

The unit controls three outputs for lights, etc. in the apartment. Every output has one LED and one switch, if the switch is active for more then one second the output toggles. The LEDs only light up when a change to an output is made. To see actual status the switch can be activated for less then one second, the LEDs will then show the state without toggling the output.

When lights out 45 seconds is counting down all LEDs flash, the speed is increased the last 10 seconds. The output status is saved in EEPROM, and set to last state at power-up. The auto light input is used by the Alarm unit to turn on the lights when someone enter the apartment. The IR sensor input is used so that the light stays on as long as there is movement. Two minutes after the movement stops the lights turn back off.

Control:

  1. Lamp living room
  2. Subwoofer
  3. Lights and printer on desk
  4. Lights living room (handled by Multi-purpose module 1)

I/O

Inputs

  1. Switch channel 1
  2. Switch channel 2
  3. Switch channel 3
  4. IR Sensor (from Multi-purpose module 1)
  5. Lights out 45 sec
  6. Auto light 2 min
  7. Lights out

Outputs

  1. Relay 1
  2. Relay 2
  3. Relay 3
  4. LED 1
  5. LED 2
  6. LED 3
  7. Lifelight
  8. Lifesignal (to Module stability monitoring unit 2)

Wires

Top

  • Red +5V
  • Black 0V
  • Brown Lifesignal
  • White IR sensor
  • Green Lights out 45 sec
  • Orange Auto light 2 min
  • Blue Lights out

Bottom

  • White Switch 1
  • Orange Switch 2
  • Green Switch 3
  • Yellow Relay 1
  • Blue Relay 2
  • Red Relay 3
  • Brown LED1
  • Black LED2
  • White (clear) LED3

Panels

Hall

  • Blue LED 1 -
  • Purple LED 2 -
  • Red LEDs +
  • Yellow Switch 1 -
  • Green Switch 2 -
  • Black Switch lights out 45 sec
  • White Switches common

Living room

  • Red +12V
  • Black 0V
  • Yellow Relay subwoofer -
  • Green Switch lamp
  • White Switch subwoofer
  • Orange LED lamp
  • Brown LED subwoofer
  • Blue Relay living room lights - (N.C)

Source code

Git-alt-brands.svg
Bascom-AVR source is available in a git repository:
https://github.com/thomasjsn/AVR-Lights-and-relay-controller

Gallery

Schematic drawing

Lights-control-unit-circuit-qjed84.png

Parts list

Qty. Part
1 × AVR ATtiny2313-20PU, DIL-20, 20 MHz, 18 I/Os
1 × Capacitor, aluminium electrolytic, 10 µF, 25V
2 × Capacitor, ceramic, 22 pF, 100V
1 × Capacitor, ceramic, 1 nF, 100V
1 × DIL socket, 20-pin, 7.62mm
1 × Enclosure, plastic (1591), 100x50x25mm
1 × LED 5mm coloured clear, Green, 2.1V, 20mA, 30mcd, 10°
1 × LED holder 5mm, RTC51, black plastic
32 cm2 PCB, stripboard, 100x160mm, 160cm2
1 × Quartz crystal oscillator, 4 MHz
8 × Resistor, carbon film, 0.25W, 330 Ω, 5%
8 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
7 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
7 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B