This design is predicated on getting a minature toggle switch with double-pole momentary-off-momentary action, not a popular option. The device to be controlled is selected by a rotrary switch, and the toggle switch initiates transmission of ON or OFF codes for up and down. It is quicker than the pushbutton transmitters since no wait for multiple presses is needed,
It uses an analog approach for determining the rotary switch position which depends on the close matching typical of SIP resistor packs.
This is the inside. The design is very compact since the resistor divider consists of tiny SIP modules, and the rotary switch needs only one bank. The switch is a military type thanks to buying a pallet-load of spare aircraft communication panels at a Navy auction for $75.
This controller is still in daily use because it is small.
.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 8 resistors on the left encode the switch position to an analog voltage. Two 4-reristor SIP packs a re soldered together offset by one.
Thy are closely match by the manufacturing process.
One side of the toggle switch encodes its position, to form 14 codes The other turns on the MOSFET which completes the power circuit.
C1 keeps the power on.
When not being programmed, the top two hider pins are shorted with a jumper block.
#rem
Rotary 7-pos toggle.bas This is for the little wooden box with the 7-position rotary switch
and 2-way momentary toggle. It is labelled for and controls the living room lights:
Pos On Off Codes transmitted
1 I C (Hanging) The macrame lamp hanging from the ceiling, .
2 R G (Ceiling) ceiling Light
3 7 6 (String) The LED string hanging from the gazebo
4 m J (Icycle) The LED string hanging from the eves
5 d 9 (Eggs) The leads from the "Octupus" 60 MA series from the current regulator
6 Y W (Flashing) The bases with individual transformers
7 M g (Missions) The model missions.
John Saunders 10/31/2016
#endrem
#picaxe 08M2
'Inputs:
symbol TX_Data_Port = C.0 'Idle low serial transmission at 2400 baud
symbol On_Off_Port = pinC.2 'Low for ON (up)
symbol Rot_Sw_Port = C.4 'An analog value giving the position of the rotary switch
'Output
symbol Hold_Port = C.1 'A high maintains power to the circuits.
'Constants
symbol Start_Count = 22 'Half way to the count for the Floor position
symbol Step_Count = 42 'Count between switch positions
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
'EEPROM
'DATA 0,("I","C","b","f","K","8","Y","W","E","F","P","W","M","W")
'DATA 0,("I","C","R","G","K","8","Y","W","E","F","P","W","M","W")
DATA 0,("I","C","R","G","7","6","m","J","d","9","Y","W","M","g")
'Variables
symbol Sw_Pos = b1 '0-13, even = on, order = Hanging,Floor,Icicle,Top,Shelf,Circle,Bullseye
symbol Rot_Sw_Val = b2 'Analog measurement
symbol Threshold = b3 'The value to compare the analog to
symbol Char = b4
symbol Mom_Sw_Pos = b5 '0 for ON
init:
HIGH Hold_Port
SETFREQ m4
main:
LET Mom_Sw_Pos = On_Off_Port
READADC Rot_Sw_Port,Rot_Sw_Val
FOR Sw_Pos = 0 TO 5
LET Threshold = Sw_Pos * Step_Count + Start_Count
IF Rot_Sw_Val < Threshold THEN
EXIT
ENDIF
NEXT Sw_Pos
IF Rot_Sw_Val > Threshold THEN
LET Sw_Pos = 6
ENDIF
LET Sw_Pos = 2*Sw_Pos + Mom_Sw_Pos
READ Sw_Pos, Char
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
LOW Hold_Port
PAUSE 5000
GOTO main