Beginner
10 min

Deliver faster and more efficient data transfer with MICRF230 and PIC18LF45K50

Stay in control, stay connected

OOK RX Click with EasyPIC v7

Published Nov 07, 2023

Click board™

OOK RX Click

Dev Board

EasyPIC v7

Compiler

NECTO Studio

MCU

PIC18LF45K50

Our 433MHz wireless receiver puts you in control by ensuring a strong, uninterrupted link between your devices, keeping you connected no matter the distance

A

A

Hardware Overview

How does it work?

OOK RX Click is based on the MICRF230, a 400MHz to 450MHz ASK/OOK receiver with RSSI and squelch, from Microchip. The working principle of this device is based on decoding of information embedded in a radio signal. The ASK/OOK modulation is a way to encode information and assemble it into radio signals which can be transmitted and received wirelessly. Generally, ASK is an abbreviate for the Amplitude Shift Key modulation, which is realized by shifting the amplitude of the signal, depending on the number that is going to be transmitted. For example, if the transmitted number is 1, the transmitted signal amplitude would be equal to the carrier signal amplitude, if the transmitted number is 2, the transmitted signal amplitude is as twice as the carrier signal amplitude and so on. The ASK method of modulation allows not only the binary communication, as more than two signal amplitudes can be detected by the receiver. However, this method is very susceptible to noise and interferences. To overcome this problem, an OOK modulation method was introduced. The OOK modulation is very similar to the ASK, but it is of a binary type. OOK is an abbreviate for the Off-On Key, which perfectly describes this type of modulation. The presence of the carrier signal is recognized as the logical 1, while the absence of a carrier signal is recognized as the logical 0. This method is more immune to noise and interferences than the ASK modulation, and it allows for greater communication distance to be achieved. Signal demodulation starts with the RF signal being received and amplified by the low noise amplifier at the RF input. This signal is

additionally processed by the internal mixers, filters and frequency synthesizers, and the processed intermediate frequency (IF) signal of about 330kHz is generated. This signal is passed to the decoding section. Decoder removes the carrier signal from the IF and filters the remaining baseband signal. This is done by a low pass filter with a user selectable bandwidth. The bandwidth choice is very important as it provides the optimal bit error rate (BER) for a specific data rate. Depending on the transmitted information data rate, users can select the bandwidth of the low pass filter, by moving the onboard SMD jumpers, labeled as BW SEL. These jumpers are used to set SEL0 and SEL1 pins of the IC to the proper logic levels, as you can see from the table given below. Before the communication is attempted, the preamble burst should be received first. The preamble burst allows calibration to the receiving signal. When resuming from the Shutdown mode, the preamble should be long enough to allow the receiver to be fully awake and ready to receive data. The integrated squelch function is used to limit the activity on the DO (data output) pin. This is particularly useful if the DO is used for an interrupt generation, as the squelch function will suppress any activity unless valid communication bits are detected. When the SQ pin is set to a logic LOW level, the squelch functionality is enabled, reducing random activity (noise) on the DO pin when there is no RF input signal. The SQ pin is pulled to a logic HIGH level internally, so it is disabled if the pin is left afloat. This pin is routed to the CS pin of the mikroBUS™. Power consumption can be reduced if the device is put into the

Shutdown mode. When EN pin is pulled high, the internal logic of the MICRF230 IC is activated. The EN pin is internally pulled LOW so that the device starts in the Shutdown mode when this pin is left afloat. The onboard capacitor ensures a proper power-up cycle since it will generate a small delay before the EN pin is pulled to a logic HIGH level, giving time to the power supply voltage to stabilize. The EN pin is routed to the mikroBUS™ RST pin. OOK RX click has an RSSI (received signal strength indicator) output pin, used to directly measure the voltage level on the AGC (automatic gain compensation) section. The AGC is an integrated circuit section that provides a constant amplitude of the low pass filtered baseband signal. The voltage level on this pin determines the amplification of the AGC section. Since this level is not directly readable, an inverted, buffered version of the voltage is present on the RSSI pin, which can be directly used to determine the signal strength - which is inversely proportional to the signal amplification. The RSSI output pin has an impedance of 200Ω and it is routed to the AN pin of the mikroBUS™. OOK RX click can work both with an integrated PCB trace antenna or a 433MHz external antenna, which can be attached to the onboard SMA connector of the click board, for improved range and received signal strength. Both 3.3V and 5V operation is supported by this click board™. By moving the SMD jumper labeled as the VCC SEL, it is possible to select the operating voltage, so that both 3.3V and 5V capable MCUs can work with the OOK RX click board.

OOK RX Click hardware overview image

Features overview

Development board

EasyPIC v7 is the seventh generation of PIC development boards specially designed to develop embedded applications rapidly. It supports a wide range of 8-bit PIC microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB-B. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyPIC v7 allows you to connect accessory boards, sensors, and custom electronics more efficiently than ever. Each part of

the EasyPIC v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use various external power sources, including an external 12V power supply, 7-23V AC or 9-32V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B) connector. Communication options such as

USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from PIC10F, PIC12F, PIC16F, PIC16Enh, PIC18F, PIC18FJ, and PIC18FK families. EasyPIC v7 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyPIC v7 horizontal image

Microcontroller Overview

MCU Card / MCU

PIC18LF45K50

Architecture

PIC

MCU Memory (KB)

32

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

2048

You complete me!

Accessories

Right angle 433MHz rubber antenna boasts a frequency range of 433MHz, ensuring optimal performance within this spectrum. With a 50Ohm impedance, it facilitates efficient signal transmission. The antenna's vertical polarization enhances signal reception in a specific orientation. Featuring a 1.5dB gain, it can improve signal strength to some extent. The antenna can handle a maximum input power of 50W, making it suitable for various applications. Its compact 50mm length minimizes spatial requirements. Equipped with an SMA male connector, it easily interfaces with compatible devices. This antenna is an adaptable solution for wireless communication needs, particularly when vertical polarization is crucial.

OOK RX Click accessories image

Used MCU Pins

mikroBUS™ mapper

RSS Indication
RA2
AN
Device Enable
RE1
RST
Squelching
RE0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Data Output
RB0
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

OOK RX Click Schematic schematic

Step by step

Project assembly

EasyPIC v7 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v7 as your development board.

EasyPIC v7 front image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyPIC v7 Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
EasyPIC PRO v7a Display Selection Necto Step hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for OOK RX Click driver.

Key functions:

  • ookrx_receive_data - This function receives data in the OOK communication.

  • ookrx_read_do_pin - This function reads the od pin digital input.

  • ookrx_read_rsi_pin - This function reads the rsi pin digital input.

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief OOK RX Click example
 * 
 * # Description
 * This example showcases how to initialize and use the OOK RX click. The click decrypts information
 * embedded in a 433 MHz frequency radio signal. In order for the OOK communication to work a receiver
 * click needs to be used. OOK TX plays that role - it encrypts, embeds and sends the data.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * This function initializes and configures the logger and click modules.
 * 
 * ## Application Task  
 * This function waits for the transmitter to send the data and then reads and displays it in
 * the console using the UART communication.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "ookrx.h"

#define BYTE_RECEIVE
// #define DATA_RECEIVE

#define PREABLE_WORD 0xCE35

// ------------------------------------------------------------------ VARIABLES

static ookrx_t ookrx;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( )
{
    log_cfg_t log_cfg;
    ookrx_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info(&logger, "Application Init");

    //  Click initialization.

    ookrx_cfg_setup( &cfg );
    OOKRX_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    ookrx_init( &ookrx, &cfg );
    Delay_ms( 100 );
    
#ifdef BYTE_RECEIVE
    log_info(&logger, "Application Task\r\n BYTE TRANSMIT DEMO");
#endif
    
#ifdef DATA_RECEIVE
    log_info(&logger, "Application Task\r\n DATA TRANSMIT DEMO");
#endif
}

void application_task ( )
{
#ifdef BYTE_RECEIVE
    uint8_t received_byte;

    if ( ! ( ookrx_receive_data( &ookrx, PREABLE_WORD, &received_byte, 1 ) ) )
    {
        log_printf( &logger, "%c", received_byte );
    }
#endif
#ifdef DATA_RECEIVE
    uint8_t received_package[ 10 ] = { 0 };

    if ( ! ( ookrx_receive_data( &ookrx, PREABLE_WORD, received_package, 6 ) ) )
    {
        log_printf( &logger, " * Received packet: %s\r\n", received_package );
    }
#endif
}

void main ( )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources