Maker.io main logo

Welcome to the Arduino MRF24J40 Wireless Shield

18

2015-10-19 | By Boris Landoni

License: None Arduino

We will equip Arduino with wireless connectivity based on Microchip MRF24J4. As a sample application, we will remotely control a relay, operated by a floating input, and virtualize the Arduino USB serial port.

MRF24J40MA is a RF transceiver, compatible with 2.4GHz IEEE 802.15.4 standard. Module integrates a tuned antenna, quartz and other external components required for WiFi communication. 

Wiring

The hardware is based mainly on the WiFi module (chip U1) managed by a main CPU through the SPI port on pins 5, 6, 7. These must be connected to Arduino SPI pins (SCK, MISO and MOSI). The radio module requires a power supply of 3.3V, while the Arduino works at 5V, so you cannot make a direct connection, but you must match the right voltage levels. 74HC4050D (U2 chip in the diagram) is the great circuit for this purpose. Since all the connections between Arduino and radio module need different voltages, we will convert all of them through the U2. However, we choose not to implement a simple transmission shield, but equip it with at least a minimum set of input and output. In particular, we have provided a photo-coupled input (based on the 4N25 photocoupler) and an output relay (RL1 relay driven by BJT T1 stage).

Image of MRF24J40 Diagram

Coding

Available libraries provide an object called “Mrf24j” for the complete WiFi stack management. The object constructor gets as input the number of Arduino pin to be used for reset, chip select, and radio module interrupt (the SPI port is the default, ie pins 11, 12 and 13 of the Arduino Uno).

To work properly, every node needs to have its WiFi network and unique network address specified. We have to use two functions (void set_pan (word PANID) and word get_pan (void)). Instead to configure node addresses, we will use void address16_write (word address16) and word address16_read (void). We applied Arduino CPU Interrupt technology, it allows us to manage everything more efficiently involving the Arduino CPU only when necessary.

Finally, the real functions for transmitting and receiving are respectively void send16 (word dest16, char * data) that needs parameters like network address of the destination node and the pointer to the data buffer to be transmitted and rx_info_t * get_rxinfo (void), which returns a pointer to a structure type rx_info_t specially defined to encapsulate all the information received.

More detailed description on building and programming the device.

Schematic

Arduino MRF24J40 Wireless Shield Scheme-it

Block Diagram

Arduino MRF24J40 Wireless Shield Block Diagram

Mfr Part # MRF24J40MAT-I/RM
RF TXRX MOD 802.15.4 TH SMD
Microchip Technology
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.