Wifi joystick with display
Posted: Fri Mar 20, 2020 2:03 pm
I am just building a fast caterpillar robot (raspcatbot):
https://www.raspberrypi.org/forums/view ... 7&t=267999
Even when it will drive autonomously, it needs a wireless heartbeat signal from wireless device.
Either on command or when heartbeat got missed, the robot will do immediate emergency stop (because it runs up to 5m/s or 18km/h).
I want to have a wireless joystick as well for initial driving tests with that robot.
Using an ESP32 with builtin SSD1306 OLED is ideal:
With joystick screwed to ESP32 board with OLED, and (380mA) lipo for powering via GND/5V:
The two 12V/1500rpm caterpillar motors get (over)powered by diy 3S+1S=4S lipo with 16.8V (original T101 motors are 12V/330rpm only).
Robot gets controlled by onboard (after assembling) Raspberry Pi3A+ (quad core, camera, Wifi, ...).
In this photo last night Pi3A+ did run robot motor at maximal speed (pwm=255).
Measured speed was 1600rpm (26rps!), or 5m/s (18km/h) with wheel diameter of 60mm (measured with laser tachometer):
https://www.raspberrypi.org/forums/view ... 7&t=267999
Even when it will drive autonomously, it needs a wireless heartbeat signal from wireless device.
Either on command or when heartbeat got missed, the robot will do immediate emergency stop (because it runs up to 5m/s or 18km/h).
I want to have a wireless joystick as well for initial driving tests with that robot.
Using an ESP32 with builtin SSD1306 OLED is ideal:
- has analog inputs, so can deal with joystick
- has Wifi to send heartbeat and/or joystick data to robot
- has display for
- joystick data
- status information from robot
Code: Select all
#include <Wire.h>
#include "SSD1306Wire.h"
SSD1306Wire display(0x3c, 5, 4);
void draw(String &s) {
display.clear();
display.drawStringMaxWidth(0, 0, 128, s);
display.display();
}
void setup() {
display.init();
display.flipScreenVertically();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_16);
}
void loop() {
draw(String(map(analogRead(15),0,4095,0,255))+" : "+String(map(analogRead(13),0,4095,0,255))+" : "+String(analogRead(12)==0));
delay(100);
}
With joystick screwed to ESP32 board with OLED, and (380mA) lipo for powering via GND/5V:
The two 12V/1500rpm caterpillar motors get (over)powered by diy 3S+1S=4S lipo with 16.8V (original T101 motors are 12V/330rpm only).
Robot gets controlled by onboard (after assembling) Raspberry Pi3A+ (quad core, camera, Wifi, ...).
In this photo last night Pi3A+ did run robot motor at maximal speed (pwm=255).
Measured speed was 1600rpm (26rps!), or 5m/s (18km/h) with wheel diameter of 60mm (measured with laser tachometer):