3-Button Controller

Circuit Diagram

This was the first controller. It uses 3 arcade-style buttons which may be pressed single or in any combination, resulting in 7 possible control codes. All are On-Off.

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

It is still in daily use.

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

1. Decode the buttons.

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

3. Construct the message and transmit it,

The first 3 diodes on the left are an or-gate to turn on the MOSFET which completes the power circuit.

The fourth keeps to power on until the program stops.

The other 3 diode are needed to prevent crosstalk.

C2 provided an AC voltage 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

#rem    3-button_transmitter.bas This has three large colored buttons

They may be pressed individually or in any combination.

The transmitter sends a lettercode corresponding to the combination.

John Saunders

11/21/2020 Different codes:

Code    Red    Green    Blue    Count    Receiver        Action

 OC    +     -    -    1    rgb Display          Temperature

 OD    +     +    -    3    rgb Display          Humidity

 OE     -     -    +    4    rgb Display          Solar Current,Barometric Pressure

 OA     -     +    -    2    rgb Display          Garage Fan

 OB     +     +    +    7    rgb Display          Battery and Charge Voltages

 S     +     -    +    5    Speaker          Bluetooth ON

 U     -     +    +    6    Speaker          Bluetooth OFF

#endrem

#picaxe 08M2


'Inputs

symbol Blue_Button  = pinC.1

symbol Green_Button = pinC.3

symbol Red_Button   = pinC.4


'Outputs

symbol Out_Port = C.0

symbol PWM_Port = C.2


'Variables

symbol Press_Val = b1    '0 never happens,1=Red,2=Green,3=Red+Green,4=Blue,5=Red+Blue,6=Blue+Green,7=All 3 buttons

symbol Out_Alpha = b2

symbol Out_Cnt   = b3 

symbol Index     = b4

symbol Sel_Val = b5


'Constants

symbol Button_Wait      = 300

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 SERIN command in the interrupt procedure


SETFREQ m4

PWMOUT PWM_Port,100,200 

PAUSE Button_Wait

LET Press_Val = 2*Green_Button + Red_Button

LET Press_Val = 4*Blue_Button + Press_Val

REM                0   1   2   3   4   5   6   7

LOOKUP Press_Val,("O","O","O","O","O","S","U","O"),Out_Alpha 

LOOKUP Press_Val,("C","C","A","D","E","X","X","B"),Sel_Val

HIGH Out_Port            'This pulse unlocks the receiver by an interrupt via an integrator

PAUSE TX_Preamble

LOW Out_Port

PAUSE TX_Ser_Setup

SEROUT Out_Port,N2400_4,("14L1776",Out_Alpha) 'This preamble locks out other transmissions

IF Out_Alpha = "O" THEN

    SEROUT Out_Port,N2400_4,(",",Sel_Val)

ENDIF

SEROUT Out_Port,N2400_4,(13,10)

PWMOUT PWM_Port,OFF

END