Basic project 083e ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – Joystick PS2 module and 5V servo


Basic: Project 083e

Project name:  ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF  transceiver moduleJoystick PS2 module and SG90 mini servo motor

Tags: Arduino IDE, ESP8266 ESP-12E module, Nodemcu v3, Lolin, nRF Serial Adapter, nRF24L01, 2.4GHZ NRF24L01 Module, with PA LNA SMA antenna, NRF24L01 transceiver module, WINGONEER, PA, SMA and LNA with antenna , 2.4G NRF24L01 antenna wireless transceiver module,  Arduino, Arduino Uno, Arduino Mega, Arduino Nano, Arduino using NRF24L01 RF module, RF transceiver module,  2.4G, antenna in antistatic foam, wireless transceiver module kit, SPI wireless data transmission module, wireless data acquisition, NRF serial adapter, 5V-3.3V VCC adapter board for NRF24L01 wireless module, breakout adapter for NRF24L01, shield for NRF24L01 with ATMEGA48, base module for nRF24L01 with 3.3V regulator, socket adapter plate for 8pin NRF24L01, ATMEGA48 and NRF24L01 interface, USB adapter for NRF24L01, YL-105, YL 105, AS01-ML01DP3, Arduino Wireless Communication, nRF24L01 – 2.4GHz RF Transceiver With Arduino, nRF24L01 Arduino, joystick PS2 module, servo, 5V servo, SG90 mini servo motor

Attachments: transmittersketch, receiversketch, library2

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. ESP8266 ESP-12E module and Micro USB cable 1pc

A6 GSM GPRS module

2.Arduino IDE (you can download it here)

3. Breadboard 1 pc

breadboard

4. NRF24L01 2.4GHZ RF transceiver module without or with external antenna PA LNA SMA  – 2pcs

NRF24L01

5. Jumper wires F-M, F-F, M-M

wires

6. Arduino Nano with Mini-B USB cable 1pc

arduino nano

7. Joystick PS2 module 1 pc

joystick ps2 module

8.SG90 Micro servo motor 9g 1 pc

5v servo

General

We will learn how to turn the servo attached to ESP8266 ESP-12E module using joystick PS2 module attached to Arduino Nano via NRF24L01 transceiver module. The transmitter will be Arduino Nano with NRF24L01 transceiver module and receiver – ESP8266 ESP-12E module with NRF24L01 transceiver module.

Understanding the SG90 Micro Servo Motor

You can read more about it here.

Understanding the joystick PS2 module

You can read more about it here.

Understanding the Arduino Nano

You can read more about it here.

Undestanding the NRF24L01 2.4GHZ RF transceiver module

You can read more about it here.

Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

You can read more about it here.

Signals and connections of the joystick PS2 module

You can read more about it here.

Signals and connections of the SG90 mini servo motor

You can read more about it here.

Signals and connections of the NRF24L01 2.4GHZ RF transceiver module

You can read more about it here.

Signals and connections of the Arduino Nano

You can read more about it here.

Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

A6 GSM GPRS module

TX – transmit pin. GPIO pin

RX  – receive pin.  GPIO pin

3V3 (or 3V or 3.3V)- power supply pin (3-3.6V). 

GND ( or G) – ground pin.

RST – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

EN – Chip enable. Keep it on high (3.3V) for normal operation.

Vin – External power supply 5VDC.

D0-D8 – GPIO (General Purpose Input Output) pins 

D5-D8 – SPI interface

D1-D2– I²C/TWI Interface

SC (or CMD) – (Chip Select) – the pin that the master can use to enable and disable specific devices. GPIO pin

SO (or SDO) – Master In Slave Out (MISO) – SPI communication. The Slave line for sending data to the master. GPIO pin

SK (or CLK) – SCK (Serial Clock) – SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin

S1 (or SD1) – Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin

S2 (or SD2) – GPIO pin

S3 (or SD3) – GPIO pin

VU (or VUSB) – external power 5VDC.

A0 – ADC output.

RSV – reserved

Wiring

1.Receiver side

 NRF24L01 transceiver module  adapter servo esp8266 esp-12e
NRF24L01 transceiver module adapter ESP8266 ESP-12E module
VCCVV(5V)
GNDGND (G)
CED4 (GPIO2)
CSND2 (GPIO4)
SCK D5 (GPIO14)
MOSI (MO)D7 (GPIO13)
MISO (MI)D6 (GPIO12)
IRQ NOT USED
SG90 mini servo motor ESP8266 ESP-12E module
GNDG(GND)
VCCVV(5V)
S(Data)D3(GPIO0)

2.Transmitter side

NRF24L01 transceiver module adapter arduino nano joystick ps2 module
NRF24L01 transceiver module adapterArduino Nano
VCC5V
GNDGND
CED8
CSND10
SCKD13
MOSI (MO)D11
MISO (MI)D12
Joystick PS2 moduleArduino Nano
GNDGND
+5V5V
VRxA0

Step by Step instruction

1. Adding ESP8266 platform to Arduino IDE

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 64 bit OS.

Download and install the Arduino IDE. You can download it here 

Open Arduino IDE. 

Open the Preferences window from the Arduino IDE. Go to File -> Preferences.

A6 GSM GPRS module

Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)

A6 GSM GPRS module

Open Boards manager. Go to Tools -> Board -> Boards Manager…

A6 GSM GPRS module

There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install

A6 GSM GPRS module

The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.

A6 GSM GPRS module
A6 GSM GPRS module

2. Uploading sketch to ESP8266 ESP-12E development board

If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. 

Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture’s driver (CH340)  for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.

If you have CP2102 chip then  you need to download the manufacture’s driver for this chip and install it in your PC. Driver for MacWindowsLinux or more.. 

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your ESP8266 ESP-12E module into your PC USB port.
  4. Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
  5. Select the correct com port.
  6. Open the receiversketch , verify and upload it to your ESP8266 ESP-12E module.

3. Uploading sketch to Arduino Nano

  1. Do wiring.
  2. Open Arduino IDE.
  3. Connect the Arduino Nano to your PC with Mini-B USB cable. 
  4. Go to Tools->Board and select Arduino Nano.
  5. Go to Tools-> Processor and select ATmega328P (from January 2018 sold NEW Arduino NANO boards). To program old boards you need to choose ATmega328P (Old Bootloader). If you get an error while uploading or you are not sure which bootloader you have, try each type of processor 328P until your board gets properly programmed.
  6. Go to Tools->Port and select correct serial port. If you have an origianl Arduino Nano the driver for it will be installed automatically, if you have chineese Arduino Nano (non-original) if you can not see your board check the project here
  7. Open, verify and upload the transmittersketch to your Arduino Nano. To upload the sketch to the Arduino Nano, click the Upload button in the upper left to load and run the sketch on your board.
NRF24L01 transceiver module servo joystick

Code

1. Transmitter side

First we need to include the necessary libraries and create an RF24 object. The two arguments of RF24 object are the CSN and CE pins : RF24 radio(8, 10); // CE, CSN . We create the angleValue variable and define a joystick pin.

Next we need to create a so called pipe through which the two modules will communicate.

We can change the value of this address to any string and this enables to choose to which receiver we will talk, so in our case we will have the same address at both the receiver and the transmitter.

In the setup section we need to initialize the radio object and using the radio.openWritingPipe() function we set the address of the receiver to which we will send data.radio. We setup and configure the RF radio: radio.begin();

In the loop section we read and map the value of Joystick from 0 to 180, and using the radio.write() function send the data to the receiver. The first argument here is the variable that we want to be sent. The second argument is the number of bytes that we want to take from that variable. In this case the sizeof() function gets all bytes of the data array. At the end of the program we will add a second delay.

2.Receiver side

First we need to include the necessary libraries and create an RF24 object. The two arguments of RF24 object are the CSN and CE pins : RF24 radio(2, 4); // CE, CSN . Next we need to create a so called pipe through which the two modules will communicate. We define the servo pin and create angleValue variable. We create the servo object too.

In setup section using the radio.openReadingPipe() function we set the same pipe (address) as in the transmitter sketch and in that way we enable the communication between the two modules.We have the radio.startListening() function which sets the module as receiver. We attach servo pin to servo object.

in the loop section using the radio.available() function we check whether there is data to be received. If that’s true, using the radion.read() function we will read a data, save it to the angleValue variable and then use that value to rotate the servo motor.

Summary

We have learnt how to turn the servo attached to ESP8266 ESP-12E module using joystick PS2 module attached to Arduino Nano via NRF24L01 transceiver module.

Thank you for reading and supporting us.

Libraries:

  • See attachments on the beginning of this project description
  • Servo library integrated in the Arduino IDE.
  • NRF24 library attached. You can read more about it here.Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.

Project resources:

  • See attachments on the beginning of this project description

AcoptexCom

2 comments to “Basic project 083e ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – Joystick PS2 module and 5V servo”

You can leave a reply or Trackback this post.
  1. ปั๊มไลค์ - 2020 June 2 Reply

    Like!! I blog frequently and I really thank you for your content. The article has truly peaked my interest.

  2. AcoptexCom - 2020 June 2 Reply

    You are welcome

Leave a Reply

Your email address will not be published.