RF Remote Controller
RF Remote Controller
RF Remote Controller
You can jump to the page of photographs when you click the part where the pointer become the hand.
Transmitter
Hardware Software
Circuit Time chart
drawing Flow chart
Pattern List
drawing Processing
Circuit explanation
explanation Operation
Parts confirmation
explanation
Receiver-1
Hardware Software
Circuit Time chart
drawing Flow chart
Pattern List
drawing Processing
Circuit explanation
explanation Operation
Parts confirmation
explanation
Receiver-2
I looked for the IC for the FM receiver to use for a high frequency receiving part.
However, I could not get appropriate IC. Therefore, the making of receiver-2 is
stopped temporarily.
Circuit drawing for Transmitter
The figure on the left is the basic circuit of the Colpitts oscillation circuit.
Roughly oscillation frequency is found by the following formula. The oscillation frequency
changes by the length of the wiring, the capacitance of the transistor and other condition.
So, the way of making actually and ascertaining is realistic.
This formula is a simplified formula and in the correct formula, the condition of the
transistor is added.
To understand the operation of this circuit correctly, it is necessary to do the professional knowledge of the Electrical
Engineering. So, I don't do a detailed explanation. The operation of the outline is hereinafter.
Oscillation operation is done by dividing the voltage which occurs between the collector and the base by C1 and C2
and making it return to the emitter.
That is, there is little resistance when seeing C2 and C3 at the high frequency. It is
in the condition which is the same when connected with the wire.
It becomes a figure on the left when seeing this circuit at the high frequency.
As for this circuit, C4 is connected with the L in parallel but you find that it is Colpitts oscillation circuit.
The calculation of the value of coil (L) was difficult and this time, I decided it by the cut & try. I decided an
oscillation frequency on 83 MHz which don't overlap with the frequency of FM broadcasting station. There is no
problem at the other frequency if not overlapping with the strong electric wave.
The coil to be using this time is using the one to have wound a tin plating wire with 0.6mm diameter around the stick
(the screwdriver) with 4.6mm diameter seven times. I make a tap (the node of the power) at the position of 4.5 turns
from the side which connects with the collector. The position of this tap is my sense. As for this position, the supply
of the high frequency electric power to the amplifier of the following stage is considered. The adjustment of the
oscillation frequency is done by C4. The frequency fine control can do by expanding or crinkling a coil. It dosen't
need to touche this coil basically after adjustment. The frequency changes when a coil is transformed by the
vibration and so on. I used the a little thick diameter of 0.6mm for the wiring material of the coil to prevent the
change of the frequency by these phenomena.
In case of the high frequency circuit, the wiring becomes the part of the coil. So, when picturing the pattern of the
circuit, the wiring that the high frequency passes makes it as short as possible.
High frequency power amplification circuit
This is the circuit which amplifies the signal to have made with oscillator. An antenna is put to emit an electric wave.
When putting an antenna to the oscillator directly, the position of the antenna and so on change an oscillation
frequency. This amplification circuit is doing the function which prevents the operation of the oscillation circuit
from the situation of the antenna, too.
As the circuit which receives the signal of the oscillator, generally, the high
frequency transformer which has the 1st coil and the 2nd coil is used.
In the circuits which I made, it is making do the function of the transformer with one
coil. The signal can be transmitted to the power amplifier only with one coil because
the base of the oscillation circuit transistor is grounding potential on the high
frequency.
This power amplification circuit is a very simple circuit. It applies a few electric currents to the base and it makes the
amplifier which is near a class "B" amplification. When handling high frequency, to make a class "A" amplification
isn't necessary. It had better put a tuning circuit to the collector, too. However, the circuit this time omits for a circuit
to be simplified.
When emitting an electric wave, the output is prescribed in the electric wave law. I think that there is no problem of
the electric wave law because the electric wave which it is possible to emit with this circuit is very feeble. Please
examine electric wave law in your country.
PIC16F84A
The electric wave which was made with oscillato is
controlled by this PIC.
A control code is made with the software of PIC16F84A.
The control code can be easily changed if changing
software.
It uses RA0 and RA1 for the input to choose a control
code and it is using RA4 for the control of the oscillation
circuit.
2SC1906 is used for the high-frequency oscillator and the power amplification.
The transistor with high fT (the maximum cutoff frequency) is needed because it handles a high
frequency. The fT of 2SC1906 is 600MHz-1000MHz. Because it handles an about 80-MHz
frequency at the circuit this time, there is a lot of leeway.
Resonator
This is the oscillation device to make the clock of PIC. A ceramic vibrator and
capacitors are incorporated.
The clock frequency this time is 4 MHz. It is possible to make do the operation of
PIC16F84A with the a maximum of 20MHz clock.
Diode
This is the diode to control the input of PIC by the switch operation. This time, I used
diodes for the rectification. However, because few flowing electric currents occur, the
switching diode (Io=120mA) such as 1S588 and so on can be used.
Coil
The coil to be using this time is using the one to have wound a tin plating wire with
0.6mm diameter around the stick (the screwdriver) with 4.6mm diameter seven times.
I make a tap (the node of the power) at the position of 4.5 turns from the side which
connects with the collector.
You can use a coil bobbin with the core, too.
IC socket
This is an 18 pins socket for PIC16F84A.
I used a round hole type but you can use a board type, too.
Resistor
I will show the time chart of the control code in the figure above. This
composition is the composition which I contrived and is not standard
composition. The switching time of each bit is 10 milliseconds.
The signal to transmit from the transmitter is composed of three blocks. In the
program, three blocks are managed by transmission status (TX_STATUS). ST0,
ST1, ST2 show transmission status with the figure above. A bit in each block is
managed by sub status (TX_SUBSTATUS). The figure which is written under
the signal in the figure above shows sub status.
A preamble signal is transmitted in the first block. This signal repeats ON/OFF
and is used to confirm that it is a signal from the normally transmitter at the
receiver. Also, it uses to decide the detection position of the bit at the receiver. At
the end of the preamble signal, it is shown in the ON condition which was
continued twice and the OFF condition after that.
The following block is the block which sends a control code. Each bit of the
control code is put in by the ON signal and the OFF signal. With this, even if all
bits of the control code are "1"(ON), the OFF condition always exists. Also, the
ON condition always exists even if all the bits of the control code are "0"(OFF).
Wrong detection at the receiver is prevented by this. Moreover, because it uses 3
bits to send 1 bit, the detection of the signal which repeats ON/OFF can be
prevented.
In the last, it is a code ending block. It is in the ON condition which was
continued three times. The ON condition which was continued three times exists
only in this block. In case of continuously the electric wave, the ON condition
which was continued three times exists. However, the following in this block is
the block of the preamble again. So, the detection which was wrong with the
continuously electric wave isn't done.
Above-mentioned three blocks are repeatedly transmitted.
The receiver doesn't always receive the electric wave which was transmitted from
the transmitter from the beginning. The receiver checks a preamble signal when it
receives an electric wave. The receiver judges a preamble signal when receiving
the signal which changes as ON-OFF-ON. Such a change doesn't exist in the
control code block and the code ending block. When beginning to receive from
the control code block, it skips the control code and the ending code and it
catches a preamble signal.
Software Flow chart of Transmitter (1/6)
Environment setting
Various environment setting is done at the line number 008-011 of the list.
011 errorlevel It makes not show bank switching warning message [302].
At the RAM file register of PIC16F84A, a bank method is adopted. For example,
both memory addresses of TMR0 and OPTION_REG is 01. However, TMR0 is at
bank 0 and OPTION_REG is at bank 1. In the definition file which is read by
INCLUDE, it defines the address of OPTION_REG as being H'0081'. Bank
information is written. The bank must be designated with RP0 bit of the STATUS
register by the actual processing. In case of MPLAB, to prevent mistake in the bank
processing, warning message "Message[302]" is shown in the processing of the
register of bank 1.
"Register in operand not in bank 0. Ensure that bank bits are correct."
Even if specifying a bank normally, this message is shown. To make not display this
message, there is a way of changing a definition file designation. That is, the message
becomes not displayed when changing the address of OPTION_REG into H'0001'.
Or, there is a way of stopping the display of 302 messages using the ERRORLEVEL
directive to be using this time.
Label definition
;**************** Label Definition ********************
CBLOCK and ENDC are used for the block definition of the RAM register file. The area of the label
among these commands is automatically set in the order from the address which is specified by CBLOCK.
This time, it is the same as specifying as follows.
tx_status equ h'000c'
tx_substatus equ h'000d'
pattern equ h'000e'
ptn1 and ptn2 are the label which specifies control code data. If changing the value to specify here, the
control code to transmit can be changed. In the case, the side of the receiver must be changed too.
ra4 is the label which specifies the position of port A. "4" can be designated to direct by the instruction even
if it doesn't use ra4, too.
Program start
;**************** Program Start ***********************
The program memory address 0 is the program starting address when turning on or reset occurs. Also, the
program memory address 4 is a start address when interruption occurs. These addresses are decided with the
hardware of PIC16F series.
Initialization process
;**************** Initial Process *********************
Port initialization
First, the initialization of the port is done. RA0 and RA1 are set to the input mode and the other
RA ports which contain RA4 are set to the output mode.
Timer setting
This circuit controls the data to transmit in the 10-millisecond interval. Timer 0 is used to make
10-millisecond time. TOCS and PSA of OPTION_REG are set to "0" to use an internal clock and
prescaler for timer 0. It makes prescaler value "101"(1:64). Because it is using 4 MHz for the
oscillator of PIC, the clock is one microsecond. TMR0 is increased every 64 microseconds when
combining with prescaler. The timer interrupt generates TMR0 when count value (TMR0)
becomes 0 from 255(H'FF'). So, the value to set to TMR0 for the 10-millisecond timer is 256-
(10000/64)=100. The other value can be used for the prescaler value. In case of 1:128, the timer
increases every 128 microseconds. In the case, the set value of TMR0 is 256-(10000/128)=178. In
case of 1:256, it is 256-(10000/256)=217. When the prescaler value is small, the timer value by
TMR0 can be set, being detailed. However, in case of 1:32, it becomes 10000/32=312.5. The value
more than 255 can not be set to TMR0.
The frequency change when changing power supply voltage from 7V to 11V was to 16kHz be. This is not a
big change. It seems that it does the operation even if the dry battery weakens.
Confirmation of the oscillation
frequency by the dip meter
I recognize the oscillation frequency of the transmitter by
the frequency counter. Moreover, I checked a frequency
with dip meter.
I will use a dip meter for the frequency adjustment for
the receiver. So, this measurement is the operation
confirmation of the dip meter.
Rectifying the output of the high-frequency amplifier directly with Germanium diode and it
makes the DC voltage from high frequency voltage. This circuit can get twice voltage
compared with usual rectification circuit. Because the charging takes time when the value of
the capacitor (C6) to use for input is big, the change of the output voltage becomes late. I
decided a value of this capacitor by the cut & try.
Voltage comparator
The DC voltage which was made with high frequency detection circuit
changes at the strength of the electric wave to receive.
At the circuit this time, it identifies a control code in the existence in the
electric wave. It makes the output of the voltage comparator H level
condition if receiving an electric wave and it makes it an L level condition if
not receiving. Slightly positive voltage is applied to the negative terminal of
IC1 to prevent from a malfunction by the noise. It uses 10 k-ohm for R4,
100 ohm for R5 and the power supply voltage is 12 V. So, the voltage of the
negative terminal is 12x100/(10000+100)=0.12 V. Probably, because there
is no noise, a negative terminal may ground. When the output voltage (the
positive terminal input) of the detection circuit becomes higher than the
voltage of the negative terminal, the output of the voltage comparator
becomes H level. Because a Zener diode (for 5 V) is connected with the output, the H level is 5 V. This voltage
doesn't exceed the permission voltage of PIC.
3 terminal regulator is used to make the stable +5V voltage which PIC needs from
12V power.
It is enough in the 100mA type because it uses for PIC only.
PIC16F84A
This PIC analyzes the control code to take from the
transmitter and when receiving a normally code, it
controls a relay.
First, the receiver confirms that the electric wave exists. A 5-millisecond timer is
set when an electric wave is received and the input signal becomes ON. The
signal which is sent from the transmitter is a 10-millisecond interval. To detect
ON/OFF in the position of the stable state, it is shifting for 5 milliseconds from
the standing-up of the signal.
The electric wave which is sent from the transmitter is composed of three blocks.
In the program, it is managing three blocks by receiving status (RX_STATUS).
ST0, ST1, ST2 show receiving status with the figure above. A bit in each block is
managed by sub status (RX_SUBSTATUS). The figure which is written under
the signal in the figure above shows sub status.
When detecting the signal which doesn't match above-mentioned composition,
the detection operation returns first and begins with the condition of the existence
confirmation of the electric wave.
First, the detection operation of the preamble signal is done. It detects ON-OFF
three times, and it detects the ending mark (being OFF behind twice continuously
ON) of the preamble and it is judged a normally preamble signal. It makes status
"1" when receiving a normally preamble signal and the detection of the control
code is done.
Each bit of the control code is between the ON signal and the OFF signal. It is
stored in CONT_DATA every time it detects each bit. It makes status "2" when
receiving all of the 8 bits normally and it confirms an ending code.
The ending code is a three times continuously ON signal. When receiving an
ending code normally, the checking of a received control code is done. It is
checked with the beforehand registered control code. As a result, the RB port
which corresponds to the control code is controlled.
When finishing receiving above signal normally, it makes the condition of the
existence confirmation of the electric wave like the time of the receiving start-up.
Receiving timing is set once again by this. The clock of the transmitter and the
clock of the receiver aren't the same. So, when receiving long in the same timing,
the timing shifts and sometimes becomes that it isn't possible to receive. If
detecting the standing-up of the signal every time it receives each frame, the
receiving timing doesn't shift. Only the case to become ON condition from the
OFF condition is detected because it is using the last Look for the standing-up
detection of the signal.
Software Flow chart of Receiver (1/6)
You can jump to the corresponding flow chart when you click the part where the hand pointer.
Environment setting
Like the software of the transmitter, various environment setting is done at the line number 008-011 of the
list.
011 errorlevel It makes not show bank switching warning message [302].
At the RAM file register of PIC16F84A, a bank method is adopted. For example,
both memory addresses of TMR0 and OPTION_REG is 01. However, TMR0 is at
bank 0 and OPTION_REG is at bank 1. In the definition file which is read by
INCLUDE, it defines the address of OPTION_REG as being H'0081'. Bank
information is written. The bank must be designated with RP0 bit of the STATUS
register by the actual processing. In case of MPLAB, to prevent mistake in the bank
processing, warning message "Message[302]" is shown in the processing of the
register of bank 1.
"Register in operand not in bank 0. Ensure that bank bits are correct."
When specifying a bank normally, this message is shown. To make not display this
message, there is a way of changing a definition file designation. That is, the message
becomes not displayed when changing the address of OPTION_REG into H'0001'.
Or, there is a way of stopping the display of 302 messages using the ERRORLEVEL
directive to be using this time.
Label definition
;**************** Label Definition ********************
CBLOCK and ENDC are used for the block definition of the RAM register file. The area of the label
among these commands is automatically set in the order from the address which is specified by CBLOCK.
ptn1 and ptn2 are the label which specifies control code data. The value to specify here must be the same as
the control code of the transmitter.
RX_STATUS Receiving status management area
0 : Preamble code receiving status
1 : Control code receiving status
2 : Ending code receiving status
RX_SUBSTATUS Receiving status management area
In each above-mentioned status, a status every receiving bit is managed.
RX_EDGE Electric wave rising edge detection request flag
When detecting an abnormal condition when receiving a control code from the
transmitter, this flag ONs. When detecting flag ON, the rising edge detection of the
electric wave becomes done.
LAST_LOOK Last Look flag
For the rising edge detection of the electric wave, the detection of the electric wave is
needed from the condition which doesn't have an electric wave. The condition that an
electric wave isn't received when checking the input port (RA1) which shows the
condition of the electric wave is memorized in this Last Look area. The rising edge of
the electric wave can be known if comparing with the Last Look area when receiving
an electric wave at the RA1 port.
CODE_CK Code check flag
For the operating time of the output relay, the 10-millisecond timer is making do
always operation. Because it checks a receiving code using this timer, it controls
whether or not to process a code in the checking by this flag. When receiving an
electric wave, a flag is made ON.
CONT_DATA Control data saving area
A control data is received every bit. Every time it receives a bit, data is saved in this
area.
RELAY Relay operating time count area
The operation of the output relay makes hold for about 500 milliseconds. When
making do the operation of the relay, 50 is set in this area. This value is subtracted
with the 10-millisecond timer and stops the operation of the relay when becoming 0.
W_SAVE W register saving area
When the timer interruption occurred, the content of the W register to be using by the
processing which was interrupted is saved in this area.
S_SAVE STATUS register saving area
When the timer interruption occurred, the content of the STATUS register to be using
by the processing which was interrupted is saved in this area.
Program start
;**************** Program Start ***********************
The program memory address 0 is the program starting address when turning on or reset occurs. Also, the
program memory address 4 is a start address when interruption occurs. These addresses are decided with the
hardware of PIC16F series.
Initialization process
;**************** Initial Process *********************
Port initialization
First, the initialization of the port is done. RA0 to RA4 are set to the input mode and the RB0 to
RB7 are set to the output mode.
In the relation of the wiring, RA0 and RA3 are grounded. So, RA0 and RA3 must be always made
an input mode.
Timer setting
This circuit controls the data to transmit in the 10-millisecond interval. Timer 0 is used to make
10-millisecond time. TOCS and PSA of OPTION_REG are set to "0" to use an internal clock and
prescaler for timer 0. It makes prescaler value "101"(1:64). Because it is using 4 MHz for the
oscillator of PIC, the clock is one microsecond. TMR0 is increased every 64 microseconds when
combining with prescaler. The timer interrupt generates TMR0 when count value (TMR0)
becomes 0 from 255(H'FF'). So, the value to set to TMR0 for the 10-millisecond timer is 256-
(10000/64)=100. It uses the prescaler value which is the same as the transmitter to make a timer
error little.
Receiving preprocess
;*********** Initial Input check Process **************
The receiving state of the electric wave is checked by the condition of the RA1 port. When not receiving an
electric wave, Last Look flag (LAST_LOOK) is made OFF. You have the possibility to seem, that this
processing is unnecessary. To detect the rising edge timing of the electric wave, it is necessary to confirm
that there is not an electric wave. Also, it is possible to prevent the wrong operation which is due to the
continuously electric wave with this Last Look data. The time is the rising edge of the electric wave when
an electric wave is detected in the last Look flag is OFF. The pulse from the transmitter switches over in the
10-millisecond interval. So, the signal detection timing at the receiver is shifted for 5 milliseconds from
therising edge of the electric wave. These 5 milliseconds are only first. The signal detection timing after that
is a 10-millisecond interval. A 10-millimeter timer is set by the initialization processing. When detecting the
rising edge of the electric wave, this timer is again set to 5 milliseconds compulsorily. Therefore, to prevent
timer interruption's occurring during this timer setting processing of 5 milliseconds, interruption disable
processing is done.(INTCON.GIE=0) After it, it makes code check flag (CODE_CK) ON and it makes
execute code check processing to timer process. Because it detected an electric wave, it makes a Last Look
flag ON. An interruption is made enable after setting a 5-millisecond timer to TRM0. After this, it becomes
the processing to wait for the timer interruption. In the processing of interruption's wait, the checking of the
electric wave rising edge detection request flag is done. When to be illegal is detected by the detection
processing of a control code, this flag is made ON. When detecting ON of this flag during interruption's
wait processing, after clearing this flag, it jumps to the electric wave rising edge detection processing and
the receiving operation returns to the initial state.
Timer interrupt process
;************ Timer Interruption Process **************
Saving registers
In the timer interruption processing, the saving of W register and STATUS register is done first.
When not doing this processing, the contents of the register before the interruption are changed by
the interruption processing and the processing after interruption's ending becomes impossible. This
time, it is to be OK even if W register isn't saved, because W register isn't used in the processing
before the interruption. I saved them for the safety. When sharing the other register, they must be
saved too. Memory bank specification is set for the safety too.
Illegal process
;***************** Illegal Process ********************
This illegal processing is executed when the code to receive is not a prescribed string or all data is normally
received. In the illegal processing, the following processing is done.
It sets the electric wave rising edge detection request flag (RX_EDGE) and the rising edge detection of the
electric wave is done by this. It clears the receiving status management data
(RX_STATUS,RX_SUBSTATUS) and it makes the condition to check a preamble code. It clears code
check flag (CODE_CK) and it makes control code checking processing in timer processing of 10
millimeters skip. After that, it enters interruption's ending processing.
Adjustment of L1
It connects a high frequency detector with . It checks the resonant frequency of L1 while
changing the frequency of the dip meter. When different from the planned frequency (about 83
MHz) extremely, it changes the value of C1. Because there is not an amplifier in the part of , the
voltage is small. So, the circuit tester which is connected with the high frequency detector should
be set in the voltage range as small as possible. But, it is necessary to pay attention in the surplus
of the voltage to prevent circuit tester's breaking. Because the voltage of is small, it doesn't have
to adjust, being detailed.
Adjustment of L2
Next, it connects a high frequency detector with and it adjusts L2. When changing the value of
C1 in adjustment of L1, it makes C2 the same value too. Because there is a high-frequency
amplifier before , the output voltage becomes higher little than .
Adjustment of L3
Next, it connects a circuit tester with and it adjusts L3 as previous. Because the voltage of is
changed into the direct current by the diode, it can not connect a high frequency detector.
I made the value of C3 1pF less than C2. The core fitted the top of the transformer at this value.