1 of 26

REMOTE CONTROL

2 of 26

What We Need To Prepare

  1. Joystick & ESP32
  2. hardware to control the robot
  3. ESPNOW
  4. communication between robot’s brain and joystick’s brain
  5. Programming
  6. sending commands to the robot
  7. receiving commands from the joystick

3 of 26

Remote Control Base

ESP32 Expansion

Joystick

no engineering drawing

screw size 3mm

hole size 3.2mm

4 of 26

Joystick

Using dupont wires, connect the joystick to the ESP32 as follows…

Joystick ESP32�GND G (innermost row)�+5V V (middle row)�VRX D32�VRY D35

D35

D32

G

V

5 of 26

Get MAC address from Rover’s ESP32

Use “Get Device Info” to obtain the MAC address of the Rover

Note down this MAC address, you’ll need it when programming the remote control

6 of 26

JOYSTICK

center value of the joystick

  • The center values varies from joystick to joystick.
  • We need to measure the values for the joystick we are using; that value will represent the zero position
  • The center values for a joystick will also tend to drift, so we’ll need to allocate a buffer zone, within which we will consider the joystick to be at zero. This is called the deadband.

7 of 26

Joystick Center Value

  • These code are temporary.
  • Connect, download, and reset.
  • Then check the values printed in the monitor.

check the pin

8 of 26

Example of Joystick Center Value

You can also test moving the joystick forward/right (...value should increase) and back/left (...value should decrease)

example of joystick center value (around 30500)

write down the center value

9 of 26

Joystick Control Value

Let’s set the joystick control value to:

  • center = 0
  • most forward/left = -1
  • most back/right = 1

0

65535

Example

0

30500

29500

31500

-1

1

10 of 26

Example

check the pin

11 of 26

Do the similar for left joystick

  1. measure the left joystick’s X center value
  2. create ‘left joystick X’ function to change the joystick value to -1 to 1
  • measure the left joystick’s Y center value
  • create ‘left joystick Y’ function to change the joystick value to -1 to 1

LEFT JOYSTICK X

LEFT JOYSTICK Y

12 of 26

  1. Click on “File”
  2. Select “Load extension”
  3. Install extensions:

ESPNOW

1

2

JOYSTICK

ESP NOW

13 of 26

Key in the Rover’s ESP32 MAC address

JOYSTICK

Initialise ESP NOW

Before we can send messages to the Rover, we must add the Rover’s brain as peer

14 of 26

JOYSTICK

Check the joystick value

15 of 26

Joystick X and Y

16 of 26

Robot Movement

17 of 26

JOYSTICK

Preparing Left Joystick Data

18 of 26

JOYSTICK

Preparing Right Joystick Data

19 of 26

JOYSTICK

Send The Joystick Data to Rover

20 of 26

Install the following extensions:

  • Stepper Wheels
  • Stepper Wheels Drives
  • ESP-NOW

ROVER

Installing Extensions

21 of 26

ROVER

Initialise all the components

22 of 26

ROVER

Initialise all the components

23 of 26

ROVER

Wait for the Start (Boot) Button

24 of 26

ROVER

Save the message

If there is, get the message and save it in the “receive” variable

Check if there are new message to read

25 of 26

ROVER

Split The Message

Split the string into multiple shorter strings, using a comma as a delimiter. Save the result in “cmds”

Get the second item in “receive” and decode it into a string of text. (the first item contains the sender address)

26 of 26

ROVER

Convert The Message