Image of Complete 4-Channel Remote Control Project

Complete 4-Channel Remote Control Project – Free with Documentation Leave a comment

4-Channel Remote Control
In previous articles, we thoroughly explained ‘code-learning remotes and how to decode them’, and we released the full source code of a library for decoding remotes based on the EV15xx chipset family. The code was written in C and was originally developed for the ATmega8. However, that source only handled the decoding part — to build a real, usable remote control system, you still had to add the rest of the functionality yourself.

Due to the great interest and many requests from friends to complete the library and turn it into a real-world project, we decided to use that same library to build a fully functional 4-channel radio remote control.

Join EICUT in building this practical 4-channel wireless remote control!

4-Channel Remote Control Project

  • The project uses the ATmega328P microcontroller (the same one found on most Arduino boards).
  • With minimal changes, the code can be easily ported to other AVR microcontrollers, including the ATmega8.
  • We chose the ATmega328P specifically because it is already present on Arduino boards, so anyone can prototype the circuit extremely quickly using an Arduino.

In the tested prototype, an Arduino Nano running at 16 MHz was used — this is the default frequency of most Arduino boards. However, simply changing the clock frequency setting in the compiler allows the code to be compiled and run on other microcontrollers as well.

Updates to the Code-Learning Remote Library

The original code-learning remote library was written in 2009 and had never been updated or corrected since then. For this reason, several parts of the library have been completely rewritten to make the code more robust, cleaner, and truly portable.

The most important change is in the decoding routine. In the old version, the maximum and minimum allowed pulse lengths were hard-coded in microseconds. This caused serious problems whenever the timer clock frequency was changed — the code simply stopped working correctly if the MCU ran at anything other than the originally assumed frequency.

In the new version, all timing limits are now automatically calculated based on the actual microcontroller clock frequency, making the library fully independent of the clock speed and easily portable across different AVRs and frequencies.

Those hard-coded absolute values have been completely removed from the program, so changing the timer/clock frequency will no longer cause any problems in execution or decoding.

In the new version, pulse identification is now based solely on the ratio between high and low periods. Thanks to this method, you can now freely change the timer frequency without any worries.

The library has been successfully tested with timer counting frequencies of 1 MHz and 2 MHz — in both cases it worked perfectly with no issues.

Another important change concerns the way received bits from the remote are stored. In the old library, a full array of 24 bytes was used (one byte per bit), which unnecessarily wasted 24 bytes of precious SRAM.

In the new version, the 24 received bits are now packed into a single 32-bit variable (just 4 bytes).

In the rewritten library, each bit now truly occupies only one single bit of memory. All received data is packed into a 32-bit long variable, using just 4 bytes of RAM in total.

To keep decoding as fast as possible, a lookup table has been added (it takes 128 bytes of Flash memory). Given that the ATmega328P has 32 KB of Flash, 128 bytes is really negligible.

🔗This may be useful for you

Click here to read the article ‘ Remote Hopping ‘

And of course, several other small improvements have been made that further enhance the performance and reliability of the library. It is strongly recommended that you use this updated and improved version of the library in all your future projects.

Hardware

 

Schematic of 4-channel remote control
4-channel remote control schematic

You can download the 4-channel remote control schematic from the link below: Remote 4 channel schematic

For assembly and understanding the connections, please refer to the diagram above. All pins except RF_IN are fully configurable in the code.

In the program, Timer1 is used as the counter. Note: Because we need high precision when measuring pulse lengths, a 16-bit timer is required. If you plan to change the timer, make sure to select another 16-bit timer (such as Timer3 or Timer5 on larger AVRs).

How the 4-Channel Remote Program Works

The program operates in three distinct modes:

  • Normal Mode
  • Learn Mode
  • Clear Memory Mode

Normal Mode

After powering on, the device starts in Normal Mode. In this mode, the on-board LED blinks once per second (1 second on, 1 second off). When any button on a previously learned remote is pressed, the corresponding output relay toggles its state.

Learn Mode

To register (teach) a new remote to the receiver, the device must be put into Learn Mode. To enter Learn Mode: press and hold the on-board button for 1.5 seconds, then release it. The LED will start blinking rapidly. Now press any button on the remote you want to register — the device will store its unique code. After successful learning, the device automatically returns to Normal Mode.

🔗This may be useful for you

Click here to read the article ‘ Everything About Software MP3 Decoding Using a Microcontroller 

Clear Memory Mode

To erase all stored remotes from memory: press and hold the on-board button for 10 seconds, then release. The LED will stay on continuously for 3 seconds and then turn off. After this, all previously learned remotes are completely cleared from memory.

Download the 4-Channel Remote Control Project Source Code

For easier access, future updates, bug fixes, and version history tracking, the complete source code has been uploaded to GitHub and is now publicly available.

  • To view the repository, go to this address
  • To download the compiled hex file and full source code, go to this address

FAQ – Complete 4-Channel Remote Control Project

What is this 4-Channel Remote Control project?

A fully functional, code-learning 4-channel wireless remote control system based on the updated EV15xx remote decoding library. It uses an ATmega328P (Arduino-compatible) and supports learning any 433 MHz rolling-code remote.

Which microcontroller is used?

The project uses the ATmega328P running at 16 MHz (same as Arduino Nano/Pro Mini). It can be easily ported to other AVR MCUs like ATmega8 with minimal changes.

What are the main improvements in the updated library?

• Timing limits now calculated from clock frequency — works at any MCU speed
• Pulse detection based on ratio (high/low periods) instead of absolute μs
• 24-bit code packed into a single 32-bit variable (4 bytes RAM instead of 24)
• Lookup table for fast bit packing

What are the three operating modes?

Normal Mode: Default — LED blinks 1 Hz, pressing learned remote button toggles corresponding relay/channel
Learn Mode: Hold onboard button 1.5 s → rapid LED blink → press remote button to store code
Erase Mode: Hold onboard button 10 s → LED on for 3 s → all stored codes cleared

How many remotes can be learned?

The receiver can store multiple remote codes (limited only by EEPROM size). Each button on a learned remote controls one of the 4 output channels (toggle mode).

What RF receiver module is used?

Standard 433 MHz superheterodyne receiver (data pin connected to PD2/INT0). The library decodes EV1527-compatible rolling-code remotes.

Can I change the MCU clock frequency?

Yes — the updated library automatically adapts to any clock speed. Tested successfully at 1 MHz and 2 MHz timer frequencies.

How are the 4 output channels controlled?

Each learned remote button toggles one of the four outputs (PC0–PC3). Typically connected to relays or transistors for controlling lights, gates, appliances, etc.

Where can I download the source code and hex file?

The complete project (source code, hex, schematic) is hosted on GitHub. Links are provided in the original article for full repository and ready-to-flash files.

Is the code compatible with Arduino IDE?

Yes — since it uses ATmega328P, you can upload the compiled hex via Arduino as ISP or use AVR-GCC/AVRDude. The code is pure C with AVR-GCC, but easily adaptable to Arduino sketches.

Leave a Reply