Multi-purpose module 1

From uCtrl.net

(Redirected from MPM1)
Jump to: navigation, search
Symbols-Delete-256x256.png
Rack fullsize plan.png
The Rack box project is being discontinued!
I am moving to a new location, and therefor terminating the Rack box project, my plan is to build an even bigger system based on slot-in cards in a full size rack. I'll keep you posted. Feel tree to leave a comment if you have any question.
MPM1 installed in the Rack box

MPM1, driven by AVR ATTiny2313.

Contents

Information

YouTube Video: A Module is Born - MPM, Multi-purpose Modul

Tasks:

  1. Monitor the status panel.
    • Connected: green flashing LED.
    • Disconnected: red flashing LED.
    • Alarm: If the 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 OSU, 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 ALU, 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.

I/O

Inputs

  1. Panel OK (to Status panel)
  2. IR Sensor
  3. Porch door
  4. Lights out (from LCU)
  5. Lights out 45 sec (from LCU)
  6. Reset panel error (N.C)

Outputs

  1. Panel OK
  2. Panel NOK
  3. Signal to ALU (N.C)
  4. Living room lights off relay
  5. Porch door LED
  6. IR Sensor LED
  7. Panel error (to SLCU)
  8. Lifesignal (to MSMU2)

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

Images

Schematic drawing

Mpm1 circuit.png

Source code

The program is written in basic, using Bascom-AVR.

'--------------------------------------------------------------
'                         Thomas Jensen
'--------------------------------------------------------------
'  file: AVR_MPM1
'  date: 06/12/2006
'--------------------------------------------------------------
$crystal = 8000000
Config Portd = Input
Config Portb = Output
Config Watchdog = 1024
 
Dim A As Byte , Lifesignal As Integer , Dorled As Integer
Dim Stuelys As Integer , Rspledg As Integer , Rspledr As Integer
Dim Rspactive As Integer , Rspledgr As Integer , Rspalarm As Integer
Dim Rspalert As Integer , Irled As Integer
 
Lifesignal = 21
Dorled = 0
Stuelys = 0
Rspledg = 0
Rspledr = 0
Rspactive = 0
Rspalarm = 0
Rspalert = 0
 
Portb = 0
Portb.0 = Not Portb.0
 
For A = 1 To 15
    Portb.0 = Not Portb.0
    Portb.1 = Not Portb.1
    Portb.4 = Not Portb.4
    Portb.5 = Not Portb.5
    Waitms 200
Next A
 
Waitms 500
 
Start Watchdog
Portb = 0
 
Main:
'IR LED
If Pind.1 = 1 And Irled = 0 Then Irled = 2
'Dør LED
If Pind.2 = 1 And Dorled = 0 Then Dorled = 21
 
'Flash porch LED
If Dorled = 20 Then Portb.4 = 1
If Dorled = 10 Then Portb.4 = 0
If Dorled > 0 Then Dorled = Dorled - 1
 
'Flash IR sensor LED
If Irled = 2 Then Portb.5 = 1
If Irled = 1 Then Portb.5 = 0
If Irled > 0 Then Irled = Irled - 1
 
'ALU signal on (NC)
If Pind.1 = 1 Or Pind.2 = 1 Then Portb.2 = 0
'ALU signal off (NC)
If Pind.1 = 0 And Pind.2 = 0 Then Portb.2 = 1
 
'Lights livingroom off
If Pind.3 = 0 Then Stuelys = 21
If Pind.4 = 0 Then Stuelys = 461
If Stuelys = 10 Then Portb.3 = 1
If Stuelys = 0 Then Portb.3 = 0
If Stuelys > 0 Then Stuelys = Stuelys - 1
 
'Panel test
If Pind.0 = 0 And Rspledg = 0 And Rspalarm = 0 Then
   'Activate green LED
   Rspledg = 21
   'Arm alarm
   Rspactive = 1
   End If
 
If Pind.0 = 1 And Rspalarm = 0 Then Rspalert = 1
 
If Rspalert = 1 And Rspactive = 1 And Rspledr = 0 And Rspledg = 0 Then
   'Activate green and red LED
   Rspledg = 11
   Rspledr = 11
   'Panel faulted
   Rspalarm = 1
   'Activate lighttower/sound
   Portb.6 = 1
   End If
 
'Reset panel fault
If Pind.5 = 1 Then
   Rspactive = 0
   Rspalarm = 0
   Rspalert = 0
   'Deactivate lighttower/sound
   Portb.6 = 0
   End If
 
'Activate red LED
If Pind.0 = 1 And Rspalarm = 0 And Rspledr = 0 Then Rspledr = 21
 
'Green panel LED
If Rspledg = 11 Then Portb.0 = 1
If Rspledg = 6 Then Portb.0 = 0
If Rspledg > 0 Then Rspledg = Rspledg - 1
 
'Red panel LED
If Rspledr = 6 Then Portb.1 = 1
If Rspledr = 1 Then Portb.1 = 0
If Rspledr > 0 Then Rspledr = Rspledr - 1
 
'Lifesignal
If Lifesignal > 0 Then Lifesignal = Lifesignal - 1
If Lifesignal = 6 Then Portb.7 = 1
If Lifesignal = 1 Then Portb.7 = 0
If Lifesignal = 0 Then Lifesignal = 21
 
'Loop cycle
Reset Watchdog
Waitms 100
Goto Main
End
Personal tools
Namespaces
Variants
Actions
Navigation
Categories
projects
Toolbox