- Making Your Own Photovoltaic 5V SystemPosted 2 days ago
- Sezme: a Memory Game for the ArduinoPosted 6 days ago
- Virtual arduino experimentPosted 7 days ago
- Tilt to TellPosted 1 week ago
- Nextion 3.5″ TFT LCD Digital Compass for ArduinoPosted 1 week ago
- An Autonomous RoverPosted 2 weeks ago
- Smart Air Cooler with ESP8266Posted 2 weeks ago
- Nano33BLESensor: Getting Started with the Nano 33 BLE SensePosted 2 weeks ago
- Interfacing Ultrasonic Ranging Module HC-SR04 With ArduinoPosted 2 weeks ago
- Make a Music Reactive RBG Light Box/ #smartcreativityPosted 2 weeks ago
433 MHz receiver 8 channels with self-learning
Self-learning UHF receiver consisting of a radio receiver board with Motorola decoding and a module equipped with 8 relays operating in impulse or bistable mode.
In many home automation applications and in general where it is necessary to exercise remote control by radio of multiple devices installed in the same place, the classic single and dual-channel handheld transmitters are not particularly practical, because using common radio controls (TX/RX) should be installed more than one receiver, with an obvious increase in cost, space and complexity, since each receiver unit has redundant parts that could be pooled: for example the RF receiver. This is why it would be useful to have a single radio control system and, in particular, a receiver unit that supports all the channels required by the system; an example is a receiver described in these pages, which allows the remote management, via AM radio links at 433.92 MHz, of 8 users manageable with the clean contact of one relay each. It is, therefore, a radio control system in which we can combine a receiver with eight outputs, a single eight-channel transmitter, two four-channel, four two-channel, or eight single-channel transmitters, or combinations of them because the beauty of the receiver is that it learns the code regardless of which transmitter it comes from.
Thanks to a suitable relay interface, the receiver can switch users either operating at low DC voltage or at 230Vac mains voltage, which absorbs up to 10 amps each.
The coding used is the Motorola MC14502x standard, so it allows a maximum of 19,683 combinations for each channel unless you use multi-channel TX; in fact, in this case, the combinations must be divided by the total number of channels, but this limit is not derived from the receiver (which, as we will see, treats each code individually, regardless of the type of transmitter that generates it) but rather from the encoder of the transmitter.
As it works, our receiver, compared to a traditional device, allows us to better exploit the encoding: in fact, if we had a single decoder onboard, such as the MC145028 for example, decoding 8 channels would mean allocating the last two three-state bits to the definition of the channels and leaving the remaining 7 to the actual encoding of the transmission; instead in the receiver we propose the decoding is managed by a microcontroller and each channel is treated independently from the others, i.e. the code that the relative TX transmits is memorized separately.
So here we could combine eight Motorola MC14502x single-channel encoded transmitters, each of which can be set by choosing from 19,683 combinations! This is the main advantage of our system, which allows maintaining high security against burglary while using coding that, if you like, can be considered outdated and not very effective in front of the most advanced rolling-codes.
The learning is done individually for each channel, which opens the way to many possibilities of use, as we can combine each output relay with a single-channel TX or a two-channel channel. The firmware of the microcontroller that controls the receiver makes sure that a remote control cannot control multiple relays.
But let’s leave this reasoning aside and let’s go immediately to see what it is about, analyzing the system, which is composed of a receiver unit described in these pages and a handheld transmitter that you can already buy and that therefore goes beyond this discussion.
The receiving unit is in turn composed of a printed circuit to be self-built and of which in the next paragraphs we describe the wiring diagram, as well as a relay power actuator board, which is a finished product that can be purchased in our store with the code 2846-RELAY8CH. The circuit to be built is the Motorola radio receiver and decoder block, in which we have integrated also the power supply stage for the whole set.
Let’s focus now on the circuit, better described by the wiring diagram you can find in these pages, which is based on a hybrid receiver module as RF section and on a Microchip PIC16F876A-I/SP microcontroller as a Motorola MC14502x standard decoder and output status manager. All this is completed by a voltage regulator that allows to obtain the 5 volts to operate the logic on board and the external relay board.
The radio receiver module is an AC-RX2/CS hybrid integrated circuit produced by Aurel, equipped with a front-end with 50-ohm antenna impedance, input amplifier and super-regenerative tuning stage with low spurious emissions (-65 dB), characterized by high sensitivity (-100 dBm) and discreet selectivity (the bandwidth at -3dB is 2 MHz) ensured by a ceramic filter; inside this hybrid, downstream of the tuning stage is the OOK (On-Off Keying) amplitude demodulator which provides pin 13 with the demodulated signal as it is and pin 14 with the demodulated signal but squared by a comparator based on the integrated LM358, which allows reconstructing the pulses transmitted by the handheld TX with the up and down fronts well squared, as required by the microcontroller of the circuit to ensure effective decoding.
The micro U2 receives at pin 7 (I/O RA5 configured as input without pull-up) the signal provided by pin 14 of the hybrid U3 and decodes it thanks to a special routine, which is started by the main program when, running in a loop, it verifies a level transition in the incoming signal, i.e. the start bit of the data sending.
If the code contained in the string received and demodulated by the AC-RX2/CS is not among those present in the dedicated EEPROM memory, the firmware returns to listen on pin 7, while if it is among those previously stored, the microcontroller brings from 0 to 1 logical the corresponding output level, among those of the RC register, that the firmware dedicates to the control of the relay card; to be exact RC0 controls the first channel of that card, RC1 the second and so on, up to RC7 that manages the eighth channel. The control signals reach the relay board through the pin-strip CN1, each line of which is connected to an IN line corresponding to an I/O of the RC7 register. On the same connector, which also serves to connect our board to the 8 relays one, the power supply for the same relay board travels, i.e. Vcc (+5V) and GND, i.e. the common ground, to which also the COM (common line) of the command inputs is connected.
Besides driving the relative input of the relay board, the pins of the RC register each turn on signaling LED, which lights up at the high logic level and whose current is limited by a resistor placed in series; thanks to the careful choice of the resistor value, the current supplied to each of the LEDs does not particularly lower the output voltage level of the microcontroller and this always ensures the correct control of the relays.
It should be noted that if, as mentioned at the beginning of the article, we combine two outputs to a single single-channel TX or to the same code of a multi-channel, when the command is received the firmware goes to command the output that comes first in order, so as to avoid the duplication of the command.
Remaining on the microcontroller, let’s move to port B, whose eight bits are used to acquire the logical state of the dip-switches that will be used in learning to select the channel to which to associate the transmitted code and in ordinary operation to establish whether the relative relay will have to operate in bistable or monostable mode (the output will be active until the transmitter button is released and in any case for a minimum time of 500mS). Since the RB register allows to activate the internal pull-up for its pins when working as input, we have set it to save us having to connect eight external resistors with the same function.
Let’s proceed with the I/O analysis with RA0 and RA1, which the firmware initializes as outputs to control the signal LEDs to be used, for example, during code learning and whose operation will be explained shortly. Then we have RA5, initialized as input without pull-up, which in the specific case is used to read the status of the button P1 that starts the self-learning; the pull-up is ensured by the resistance R1.
The operation of the microcontroller is marked by the clock generated by the internal oscillator, synchronized by the quartz connected between the OSC1 and OSC2 pins and the respective ceramic capacitors (C5 and C6) connected to the ground; in this case, being the 4 MHz quartz, the clock frequency is of equal value.
For in-circuit programming, we bring pin 1 (MCLR) and the +5V power supply line (plus ground) to the ICSP connector, in addition to the shared pins PGD (common to RB7) and PCG (common to RB6).
The 8 outputs can operate in both monostable and bistable, freely settable for each output.
Every single output has a 3 mm status LED (yellow) which, if it is on, indicates the output activated (relay energized), while if it is off, it indicates that the corresponding output is at rest.
Let’s finish the speech on the microcontroller specifying that the firmware, immediately after the I/O initialization and before listening on the RA5 line, checks the status of the dip-switches and then that of the P1 button: if the latter is pressed, it checks that it is ON and goes into learning, otherwise it goes into normal operation.
We conclude the analysis of the radio control receiver with the power supply block, which receives 12V (better if stabilized) through the PWR terminal block and passes it, through the protection diode (from polarity inversion) D1 and the capacitive filter formed by C1 and C2, to the integrated three-terminal regulator U1 (it is the canon 7805), which obtains 5 perfectly stabilized volts with which the microcontroller, the hybrid radio receiver module and the relay board connected through the CN1 connector work. The 5V line is accurately filtered by the C4 and C5 electrolytic and the C3 multilayer, suitably distributed on the PCB.
R1, R4: 4.7 kohm
R2, R3, R5, R6, R7, R8, R9, R10, R11, R12: 470 ohms
C1, C3: 100 nF ceramic
C2, C4: 470 µF 25 VL electrolytic
C5, C6: 22 pF ceramic
C7: 220 µF 25 VL electrolytic
LD1: LED 3 mm red
LD2: LED 3 mm green
LD3, LD4, LD5, LD6, LD7, LD8, LD9, LD10: LED 3 mm yellow
Q1: Quartz 4 MHz
U2: PIC16F876A-I/SP (MF1424)
DS1: 8-way Dip-Switch
ANT, PWR: 2-way terminal 5.08 mm pitch
CN1: 10 way female strip
ICSP: 6 Way Male Strip
- Screw 10 mm 3 MA
Nut 3 MA
Metal spacer F/F 20 mm (4 pcs.)
Screw 8 mm 3 MA (8 pcs.)
S1424 printed circuit board (140x55mm)
As mentioned, the relays are not present on the board, but by combining the RELAY8CH board the 8 outputs become relays. In case of a combination of the two boards, the relay one is installed under one of our exploiting the 10 ways pin strip connector, while the other 2 remaining ways will remain free.
The relay board is the 8 relay module 5 Vdc 10A code 2846-RELAY8CH. It is a board equipped with 8 relays that allows activating/deactivate the load connected to them, which can absorb up to 10 A and operate both at 250 Vac and 30 Vdc. For each relay, all the contacts, i.e. C, NC and NO (common, normally closed, and normally open), are brought to the output terminal board. The inputs of the board are all optoisolated (they have in common the COM line, which we connect to the ground of the receiver board) and for each one there is a status LED on board; each relay is activated when the corresponding input is at a high logic level, which specifically corresponds to a voltage between 1.5 and 5 V, so the board is driven with logic levels such as those provided by the I/O of our microcontroller (the absorption on each input line is of the order of a few milliamperes, just what is needed to turn on the LED inside each optoisolator) or by those of any Arduino board.
Transmitter code memorization
Before going into the details of the procedure, remember that the card does not distinguish between transmitting unit and buttons, in the sense that in self-learning it stores the code received in the memory location corresponding to the channel on which you are learning; this means that if you are combining a two-channel TX, each of the two buttons will be learned on its own.
Having said this, let’s see how to make the pairing: when the board is powered, turn ON only the micro-switch (the one corresponding to the output to be paired) of the DS1 dip-switch, then press and hold the P1 button on the board until the red LED lights up steady; at this point you must press the button on the transmitter, at a distance of at least half a meter, in order not to saturate the radio receiver section. When the red LED on the card will start flashing, the storage will be done correctly, then you can release the button on the card and the one on the remote control.
Repeat this procedure for all the outputs you wish to use by setting the desired channel with DS1, remembering that it is possible to memorize only one button identification code for each relay output and that the same button or transmitter code cannot be matched on more than one output.
Cancelation exit code
Turn off power to the board, then turn ON the dip-switch microswitches corresponding to the output where you want to turn off the remote control, then press and hold the button on the P1 board and supply power. The red LED will light steady for about 1 second to indicate that the pairing removal procedure is in progress.
When the red LED goes out, the receiving unit will be ready to resume normal operation, i.e. to receive commands and activate relays accordingly. Note that more than one microswitch can be turned ON.
Setting output mode
Each microswitch of the DS1 dip-switch corresponds to the respective output on the board, so dip 1 will correspond to output 1, dip 2 to output 2 and so on; this is valid not only when learning the codes of the radio controls or their buttons that will control the outputs, but also when setting the activation mode of the corresponding relays.
Therefore, in auto-learning, the status of each dip-switch indicates to the microcontroller that when P1 is pressed it must memorize the code corresponding to the OUT1 relay of the relay board, while in normal operation by turning the microswitch ON it will set the bistable operation, while it will be monostable if left OFF.
Table 1 clarifies the operation and the meaning of the eight micro-switches of DS1 according to the operating condition.
The output relay mode can be changed during operation without having to remove and reapply the power supply, as is the case with self-learning.
the remote control described in these pages is a modular design suitable when it is necessary to manage several users with a single control unit; it has the advantage of being able to be combined with several transmitters with different codes, so as to make, for example, selective the access to a passage with turnstile or motorized gate, i.e. the control of a certain user.