Skip to content

jlmyra/PS3--JEEP-LANDY-BUGGY

Repository files navigation

IMG_7249 3DSets (https://www.3dsets.com/) offers excellent 3d printable Jeep and Landy models complete with .stl's and gcode. As an alternative to using traditional RC parts for the radio control system the following is an alternative DIY bluetooth radio control system using inexpensive off-the-shelf parts. These parts will fit within the electronics box for each vehicle.

PS3 Controller Parts:

Other Parts:

Background:

This project is a continuation of a previously posted project - Wemos - Blynk - iPhone Remote-Controlled 3D-Printed Jeep. That project describes hardware and software to control a 3D Sets 3D printed remote controlled vehicle using an ESP8266 and Blynk on an iPhone as the remote control. While it was an elegant solution requiring a Raspberry Pi as a server between the car and phone it has some shortcomings. The Blynk interface on the iPhone does not give much precision on the steering joystick and inadvertent touching of the iphone-Blynk interface can cause the app to disappear leaving the vehicle momentarily uncontrolled. More importantly it didn't really pass the grandson test! This effort began when my grandson asked if we could use a Playstation 3 controller instead of the iPhone. In this arrangement the ESP8266 is replaced with a ESP32 to take advantage of the built-in bluetooth radio. More importantly all of the hard work involved with connecting an ESP32 to a PS3 controller has been done by JVPernis(https://github.com/jvpernis/esp32-ps3). I simply took advantage of his work to make this setup functional.

Software Implementation:

  • Set-up ESP32 in Arduino IDE (for help see: https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions/)
  • Install PS3 Library in Arduino IDE https://github.com/jvpernis/esp32-ps3 (for help see: https://techtutorialsx.com/2020/02/16/esp32-connecting-a-ps3-controller/)
  • Install ESP32Servo Library in Arduino IDE https://github.com/jkb-git/ESP32Servo (for help see:https://dronebotworkshop.com/esp32-servo/) - I had to make a small modification to espservo.h . This library uses all of the pwm channels for servos leaving none for motors. You will need to change line 96 of espservo.h to 2 servos max leaving channels 2-16 available for motors
  • Description: The sketch is presented in a 'tabbed' format for ease of editing. JEEP_LANDY_PS3_ESP32.ino contains the variables, setup, and loop. Pay attention to the steering servo section. You can 'align' the front end by changing 'servomin' and 'servomax'. The ESP32Servo library needs a minor modification. It is written in a way that dedicates all of the pwm channels to servos. Two pwm channels are required for the drive and winch motors. Line 96 of espservo.h needs to be set to 2 servos max. The sketch is designed to produce forward and backward movment of the vehicle by moving the left joystick forward and back. The 'normal' speed is throttled to 45% of the available speed. Pressing the L1 button before moving the left joystick will produce a "nitro' mode producing 65% of the available speed. The right joystick controls the steering left-right. The winch is operated using the triangle button to unwind the winch and the x button to rewind the winch. There is also a circuit for monitoring the charge state of the battery in the vehicle. There is a tap on the + side of the battery that goes to a voltage divider. The output of the voltage divider is read on GPIO32 an ADC pin. The charge state of the battery is displayed on the controller LEDS. 4 LEDS - full charge, 3 LEDS 75%, 2 LEDS 50%, and 1 LED- time to recharge. When the voltage goes below 7 volts for 15 seconds the controller will begin vibrating to remind the operator to recharge the battery. The sketch includes many comments to follow the logic.
  • The sketch is presented in a 'tabbed' format. There are five files that need to be downloaded into a folder:
  • JEEP_LANDY_PS3_ESP32.ino contains the variables, setup, and loop. Enter your PS3 MAC Address on Line XX in void Setup().
  • BATTERY_CHECK.ino This function monitors the battery charge state and warns the operator to recharge the battery by activating the vibration motors in the PS3 controller.
  • Connection.ino check for a connection with the PS3 Controller
  • Citations.ino Recognition of others whose know-how contributed to this project
  • EVENTS.ino Is the routine that communicates with the PS3 controller and translates it into actions for the motor and steering servo.

Wiring Diagram:

Wiring

  • I used 2.54mm pitch screw terminal blocks for making circuit board connections instead of soldering wires directly to the circuit boards. This makes it easy to fix wiring issues (mistakes!). It also makes it easy to reuse the boards in other applications.
  • I offer suggestions for 2 different BEC's necessary to reduce the battery voltage from ~8V to 5V for the ESP32. The second one in the parts list is much smaller making it preferable over the other. Any device that will reduce the battery voltage to 5V can be used.
  • You will have to solder the screw terminals to the MD13S and DRV8871 motor controllers.

About

ESP32 Sketch for PS3 controller for 3d printed JEEP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published