Esp32 bluetooth joystick

Good morning. I have made a simple bluetooth joystick for AgOpenGps which emulates keyboard to send commands to AOG.
I have used the sketch for emulating keyboard with esp32 from Manuel BL, you can find all the info and the sketch he has made here ESP32 as Bluetooth Keyboard · GitHub.

It is very easy to setup, you only have to connect buttons PINS - to - GND of your esp32, without any resistors because my sketch use the internal resistor of the esp32.

COMMANDS LIST:

a = activate autosteer
t = Move line to the LEFT
y = Move line to the RIGTH
p = Snap line to the CENTER
o = Change AB Lines
m = Activate Manual Sections
g = Flag a Point

AOG has to be in full screen mode for moving line.
I had to add “t” “y” “o” shortcuts to AOG, for this reason you have to use my “modified” version of AOG 4.3.10. It is identical to the official ad it works the same.
All the files are here AOG_ESP32_BLUETOOTH - Google Drive

if you want to add your custom shortcut you have to compile your own version of AOG and modify the code in ProcessCmdKey. Open the source code of AOG and search ProcessCmdKey.
Once there you should use this type of code:

if (keyData == (Keys.???)) // Full Screen click
{
snapRightBigStrip.PerformClick(); // here you have to find the command you want to perform
return true; // indicate that you handled this keystroke
}

i hope can be usefull. Thanks to Daniel P from international telegram group.

8 Likes

Hello, Well done for your work I would like to do the same. With your solution is it possible to activate steer and imp? I unfortunately do not have the knowledge to add this function but I would very much like to make a wireless control box for guidance

1 Like

Hi ThomasM, yes it can. Once the esp32 is paired to pc, it is recognized as a wireless keyboard so you simply press the button linked to letter “a” to activate autosteer, and button related to letter “m” to activate sections.
If you want only use these two functions you can use any AOG version

1 Like

Thanks for your quick response, esp32 is already ordered! :grinning: It’s been a long time since I imagined a wireless remote control

Inspired by this topic, I made this with Wii Nunchuk Controller and M5 StickC

5 Likes

Hi guys,

is there also existing an ESP32 sketch for a USB Joystick? Since my Bluetooth connection isn’t that stable and the ESP is connected to the tablet anyway (power supply), I would prefer exactly the same code which sends the letters via USB.

Thanks!