Vacuum cleaner remote control

This is vacuum cleaner remote control using Telecontrolli RR3 receiver and RT2 transmitter operating at 433.92MHz. For speed controll and receiver decoding we use Microchip PIC12C508 microcontroller. Decoding is based on counting the number of modulated pulses generated with transmitter as simple 50 percent duty cycle bistable oscilator based on 4069 as coding circuit. The RC frequency should be above 1KHz and at leas 0.3ms for decoder to change the spead UP/DOWN according to current status.

Triac is pulse driven with high Z between pulses. Pulses are -5V biased. The software is timed for 50Hz line.

PCB

Here is the PCB:
and the source in PCB format and postscript file for solder side.

Assembly program for PIC12C508A and for PIC16F84

;**********************************************************************
;                                                                     *
;    Filename:	    bip.asm                                           *
;    Date:          16.5.02                                           *
;    File Version:  0.2.0                                             *
;                                                                     *
;    Author:        Leon Kos                                          *
;    Company:       LECAD - University of Ljubljana                   *
;                                                                     * 
;                                                                     *
;**********************************************************************
;                                                                     *
;    Notes:  Vacuum cleaner Speed control with remote RX/TX at 433Mhz *
;    UP/DOWN speed with single button                                 *
;                                                                     *
;                                                                     *
;                                                                     *
;**********************************************************************

	TITLE 'Vacuum cleaner Speed control'

#define C508
#ifdef C508
	list p=12c508
	#include <p12c508.inc>
	__CONFIG _CP_OFF & _WDT_ON & _MCLRE_OFF & _IntRC_OSC
freemem		EQU	0x07
#define		MAINS	GPIO, 3
#define		TRIAC1	GPIO, 0
#define		TRIAC2	GPIO, 1
#define		LED	GPIO, 4
#define		BUTTON	GPIO, 2
#define		IOPORT	GPIO
#define		TRIAC_ON 0xEC
#define		TRIAC_OFF 0xEF
#else
	list      p=16F84             ; list directive to define processor
	#include <p16F84.inc>         ; processor specific variable definitions
	__CONFIG   _CP_OFF & _WDT_ON & _PWRTE_ON & _XT_OSC
freemem		EQU	0x0F
#define		MAINS	PORTB, 3
#define		TRIAC1	PORTB, 6
#define		TRIAC2	PORTB, 5
#define		LED	PORTB, 2
#define		BUTTON	PORTA, 4
#define		TRIAC_ON  0x9B
#define		TRIAC_OFF 0xFB
#define		IOPORT	PORTB
#endif


	RADIX	DEC

;***** VARIABLE DEFINITIONS

temp		EQU	freemem	;zacansni reg
state		EQU	freemem + 1; operating state
pulse		EQU	freemem + 2 ; pulse delay
cnt		EQU	freemem + 3 ; delay counter
debounce	EQU	freemem + 4 ; debounce counter
#define		SINUS	state, 0
#define		UP_DOWN	state, 1
#define		BUTTON_DEPRESSED state, 2


#define		MIN_DELAY	30	; minimum delay 
#define		SAFE_DELAY	203-MIN_DELAY ; safe delay for at which triac is triggered 
#define		MAX_DELAY	230-MIN_DELAY 	
#define		DEBOUNCE_TIME	10	; in 20ms multiples 
;**********************************************************************
		ORG     0x000             ; processor reset vector
#ifdef	C508
		movwf   OSCCAL            ; update register with factory cal value
;		goto	main		; we can program two times
;		ORG	0x80		; if the code size < 128bytes
#endif

main
		movlw	MAX_DELAY	; set default delay
		movwf	pulse
		bsf	UP_DOWN		; we are increasing
		bsf	BUTTON_DEPRESSED
		clrf	debounce	; clear debounce counter
		movlw	TRIAC_OFF
		bsf	LED
		tris	IOPORT
		movlw	0xF8		; timer set to T0CKI, WDT prescaler to 0
		option
		movlw	50		; count several periods
		movwf	cnt
		clrwdt
stable_zero	btfss	MAINS		
		goto	stable_zero	; to stabilise line
		clrwdt
stable_one	btfsc	MAINS		; to debounce when
		goto	stable_one - 1	; when plugging in
		decfsz	cnt, F		; mains
		goto	stable_zero
		bcf	LED
		clrf	TMR0

mainloop	btfss	MAINS
		goto	mains_zero
mains_one	btfsc	SINUS
		goto	mainloop
		bsf	SINUS	; raising edge
		clrwdt
		call	delay
		call	oneshoot

		
		movlw	20	; minimum samples in 20ms
		subwf	TMR0, F ; C set if TMR0 >= W
		btfsc	STATUS, C ; skip if less than
		goto	button_pressed ;; to little
		clrf	TMR0	; button_depressed
		bsf	BUTTON_DEPRESSED
		bcf	LED
		clrf	debounce
		goto	mainloop


button_pressed	clrf	TMR0
		incf	debounce, F
		movlw	DEBOUNCE_TIME
		subwf	debounce, W ; C if debounce >= W
		btfss	STATUS, C
		goto	mainloop  ; count doubounce times before activating


		movlw	200		; if debounce greater than 200
		subwf	debounce, W	; to protect from overflow
		btfsc	STATUS, C
		decf	debounce, F	; debounce is fixed to 200

		btfss	BUTTON_DEPRESSED
		goto	not_depressed
		bcf	BUTTON_DEPRESSED
		btfss	UP_DOWN		; toggle UP_DOWN
		goto	toggle_set
		bcf	UP_DOWN
		goto	not_depressed
toggle_set	bsf	UP_DOWN
not_depressed	bsf	LED
		btfss	UP_DOWN
		goto	speed_down
		decfsz	pulse,F
		goto	mainloop
		bcf	UP_DOWN		; already max speed
		goto	mainloop

speed_down	movlw	MAX_DELAY
		subwf	pulse, W
		btfsc	STATUS, Z
		goto	min_speed_reached
		incf	pulse, F
		goto	mainloop
min_speed_reached	
		bsf	UP_DOWN
		goto	mainloop


mains_zero	btfss	SINUS
		goto	mainloop
		clrwdt
		bcf	SINUS

		call	delay
		call	oneshoot

		goto	mainloop



delay		movlw	MIN_DELAY
		addwf	pulse, W
		movwf	cnt		; delay = (cnt-1)*(5+(12-1)*3) + 4 ; max 9.66ms
delay38us	movlw	12		; delay = cnt*38 - 34 us
		movwf	temp
delay3us	decfsz  temp, F		; delay3us = 2+(temp-1)*3, [2, 5, 8, ...]
		goto	delay3us
		decfsz	cnt, F
		goto	delay38us
		retlw	0

oneshoot	movlw	SAFE_DELAY
		subwf	pulse, W
		btfsc	STATUS, C
		retlw	0		; not safe so not triggered

		movlw	TRIAC_ON
		tris	IOPORT
		bcf	TRIAC1		;negative trigger
		bcf	TRIAC2		;fixed output state
		movlw	100
		movwf	temp
oneshoot_d	decfsz  temp, F
		goto	oneshoot_d
		movlw	TRIAC_OFF
		tris	IOPORT
		retlw	0

		
		END                     ; directive 'end of program'




Copyright 2002, Leon Kos