8-Position Controller

This  controller was made to control the 4-Outlet Receiver, but has been re-programmed. It uses a single button and a 8-position rotary switch.

This results iin 8 possible control codes. All are On-Off.

It consumes no battery current until the button is pressed, then it transmits the selected code and shuts down. The battery has not needed ever to be changed. It is retired

Circuit Diagram

The circuit uses a Picaxe 08M2 which has 3 functions:

1. Get switch position.

2. Maintain the power until the message has been transmitted.

3. Construct the message and transmit it,

The 9 diodes on the left encode the switch position to 3-bit BCD.

The push-button turns on the MOSFET which completes the power circuit.


C2 provides an AC voltage using PWM which is rectified to keep the power on.

When not being programmed, the top two hider pins are shorted with a jumper block.

The transmitter was recycled.

Program Declarations

#rem 4-Light-transmitter2024.bas

New version to control the Cube Alarm 

John Saunders 10/9/2024

#endrem

#PICAXE 08M2


'Ports

symbol TX_Data_Port     = C.0        'Idle low serial transmission at 2400 baud

symbol Sw_2             = pinC.1    'Switch BCD bit 2

symbol Sw_1             = pinC.3    'Switch BCD bit 1

symbol Sw_0             = pinC.4    'Switch BCD bit 1  

symbol PWM_Port         = C.2        'Keeps the power flowing, charges the gate with a 10 KHz square wave


'Variables

symbol swPos             = b1        'The value of the code for switch position

symbol index        = b2        'For loop counter

symbol dataAddr        = b3        'Addree of string to be transmitted

symbol char            = b4

symbol charPos        = b5


'Constants

symbol TX_Interval    = 500      'Time between transmissions

symbol TX_Times        = 1        'The number of transmissions before shutoff

symbol TX_Preamble      = 20        'A long pulse before the serial transmission to trigger an interrupt

symbol TX_Ser_Setup     = 10        'Gives time to execute the serial in command in the interrupt procedure


DATA 0,(20,22,24,26,28,30,32,38)


DATA 20,("e",0)    'Cube Blue LED 

DATA 22,("D",0)    'Cube green LED

DATA 24,("i",0)    'Pole Lamp ON

DATA 26,("R",0)    'Ceiling Lamp ON

DATA 28,("I",0)    'Hanging Lamp ON

DATA 30,("K",0)    'Pineapple Lamo ON

DATA 32,("S","m","7","d","Y",0)    'Background Lights ON

DATA 38,("f","C","6","J","8","9","W","G","g","F","U",0)    'All OFF

Program Init and Main

Init:

SETFREQ m4

PWMOUT  PWM_Port,100,200        'Time to start up = 30 ms, freq = 10 KHz 

LET swPos = 2*Sw_1 + Sw_0

LET swPos = 4*Sw_2 +swPos


main:

FOR Index = 1 TO TX_Times

    LET dataAddr = swPos

    READ dataAddr,charPos            'First output character

   DO

        READ charPos,char

        IF char > 0 THEN

            HIGH TX_Data_Port            'This pulse unlocks the receiver

            PAUSE TX_Preamble

            LOW TX_Data_Port

            PAUSE TX_Ser_Setup

            SEROUT TX_Data_Port,N2400_4,("14L1776",char,13,10)        'The CR,LF is for debugging

        ENDIF

        PAUSE TX_Interval

        LET charPos = charPos + 1    

    LOOP WHILE char > 0

NEXT

LOW TX_Data_Port

PWMOUT PWM_Port,OFF

PAUSE 300

END