Web
Analytics
 

The ESP32 Voyager! The Ultimate Open Source ESP32 Adventure Robot

Updated: May 15, 2020

Ever since I started researching the ESP32, I have been hooked! With tons of GPIO pins, 16 PWM Channels, and tons of wireless communication options built it, it's the perfect candidate to serve as the heart of an awesome open-source adventure robot. After a few fun weeks of development, I'm very excited to present... the ESP32 Voyager!


This tutorial is meant to give you an overview of the Voyager, as well as provide all of the board files, schematic, BOM, and everything else you'd need to build your own! As always, we have these bots available in our shop here, if you'd prefer to get all of the parts from us! We set aside a large portion of all proceeds to donating robotics supplies to students all around the world!


If you'd like to see this guy in action, feel free to watch our ESP32 Voyager overview video on our YouTube channel here!




This robot is a blast! Let's take a second and go over some of the features we've designed in. First, we'll start with power.

Part One: The Features!

The Power System:

Now, often when you see larger exploration robots, you'll see big powerful RC Lipos, and for this bot, I decided to go with a series of 18650 cells for a number of reasons. One major factor is cost. Coming from an educational background, my whole goal with ACBR is to be able to provide robots to students all around the world, and so my goal is to provide robots that are tested in the wild, well designed, and strong, as well as affordable. By using 18650s, someone can use more budget-conscious cells, or pop in genuine Samsung or LG cells if they'd prefer! The cost of 4 18650's is much lower than a 4S Lipo, with the same voltage! The second reason is safety! My goal here was to make a rugged adventure robot and the thought of puncturing a lipo and starting a fire would be a major bummer. So that's why I went with 4 18650 cells in series, to send around 16 volts (depending on your charge) to our dc motors for a ton of power! When you're adding in your batteries, it's really important that they are all charged to the same voltage.


While our motor drivers and dc motors can handle 16 volts no problem, our ESP32 and our servos for our robotic arm, definitely cant! That's why I've included the very popular XL4015 buck converter IC and support circuitry to provide us a steady 5 volts, at almost 5A to power our ESP32 and a ton of servos! For this bot, I'm using DS3218 high torque servos, which may be a little overkill, but make for a really strong robotic arm. These servos draw a ton of current, so I wanted to make sure we had plenty of amperage to get the most out of our robotic arm!


The ESP32:

The ESP32 was the inspiration for this build, as it's built-in features make an awesome platform for our adventure robot! In the examples posted in this tutorial, I'll be using a PS3 controller, but I've tested this bot with our ESP-NOW based esp32 controller and wifi control as well, but we'll save that for another set of tutorials. The ESP32 can connect to the PS3 without any additional hardware, it has great range, and it's a pretty affordable and intuitive way to add a wireless controller to your esp32 projects! In this case, we're using the ESP32-WROOM-32U due to its external antenna.


With the Voyager, we have the ESP32 sending PWM signals to our 4 motor driver ICs, as well as our 4 servo breakout pins. I also have a second set of header pins that break out every single pin on the ESP32 to develop projects with the Voyager using all kinds of awesome sensors! I've even included a mini breadboard upfront to connect to the breakout headers!


The Motor Drivers:

For this bot, all of our dc motor control is handled by the epic DRV8871, not to be confused with the DRV8833 (a great lower power motor driver), the DRV8871 is a beast! It has a peak amperage of 3.6A and a max voltage of 45 volts! It's a tiny little Mosfet based IC, really affordable, and needs only minimal support circuitry to get rolling! It's the perfect IC for our four 25mm dc motors we have moving our ESP32 Voyager.

The Robotic Arm:

One of my biggest goals with this bot was to make it really versatile, and so I knew we had to include an awesome robotic arm. I decided to include the hole pattern for the super common aluminum servo brackets you see on more affordable robotic arms. Their footprint is pretty small, they're strong enough, and they are compatible with more budget-friendly servos, as well as crazier high torque servos such as the DS3218. When building your own robotic arm, you may be able to get away with a cheaper servo like the MG996 for the top two servos, but I highly recommend using the DS3218 (or something similar) for the bottom two servos.


Part Two: The Schematic!

I had a blast putting this robot together, I certainly went through a few different versions over the last few weeks, but this version I'll be posting here has worked really well. That being said, feel free to take our board files and run with it! We're posting all of our design files open source so that way anyone can have fun building one of our bots, or using these files to make their own! Let's go over the individual parts of our circuit!


The 18650 cells

This part of our schematic is really straight forward, we have our 4 18650 cells arranged in series to provide ~16 volts to our motors! For this robot, I was sure to include a really nice higher power tolerate switch, as I planned on using larger traces to handle the power coming from the 18650 cells, and didn't want to be bottlenecked by needing to flow that amperage through small traces going to a smaller switch. This MFP211N has been great!











The Buck Converter:

The XL4015 is an awesome buck converter IC, it's great at providing a steady power output, and can send up to 5A so it's much more efficient than a linear voltage regulator, and can give us all the power we need to power the servos of our robotic arm. In most other cases, R5 (our 10k Ohm resistor) is replaced with a potentiometer to control the output voltage but in this case, I decided to use a fixed resistor value to set the output voltage at 5 volts, since it's main job is to power our ESP32, and our servos.


The DRV8871:

I'm a huge fan of the DRV8871, and as I mentioned earlier it's a great all-round higher voltage motor driver IC. All you need to get it rolling it's two capacitors, and a current limiting resistor! The speed and direction of your dc motor are controlled by sending a PWM signal to the two "In" pins. We'll go over that more in great detail in the code section below.


Putting it all together:

To see the full schematic on easyEDA and alter or customize it, feel free to click the link here.


https://easyeda.com/matt_9455/esp-expedition


Part Three: The PCB!

The PCB for this robot was also really fun to put together, I was sure to include a few different hole patterns to make things easier, such as a space to mount an external antenna, and mount servos. The hole pattern to attach the PCB to our robot chassis is designed for the tank chassis we have in our shop, but they can be altered to fit any sort of chassis you'd like!

If you're interested in building a slightly smaller, more affordable version of our Voyager, I've also designed the ESP32 Explorer! It's the exact same robot, and all of the example code and circuitry is the same. The only difference is that it uses only 2 DRV8871's, and is designed to use only one tank chassis, and not two put together like the ESP32 Voyager. This is the ESP32 Explorer!


https://easyeda.com/matt_9455/esp-explorer



Part Four: The Chassis!

Now, I've spent years building robots, and I spent weeks searching for the perfect tank chassis for our new ESP32 adventure robot. While there's no such thing as the perfect robot chassis, I've been really impressed with what we came up with! At some point, I'd love to upgrade the tank track system, but I was shocked with just what this chassis could put up with! It's affordable, powerful, durable, and customizable! We use two chassis kits put together to create the structure of our Voyager, and one of the chassis kits to build the Explorer. In the near future here, we'll have a much more detailed build guide, but we'll save that for a separate tutorial. We have these chassis' available in our shop here!


https://www.anyonecanbuildrobots.com/product-page/full-metal-tank-chassis-kit




Part Five: Some Example Code!

We'll be finishing off this tutorial with some really fun example code! As we mentioned before, there are a ton of different ways to control this awesome little adventure bot, and one of the easiest methods is using a PS3 controller! If you're adopting this code to use with your own PS3 controller, be sure to change the MAC address in the example code to match yours! The sketch was designed to work with the PS3 controllers we have up in the shop, but you could use any sort you'd like. If you're curious, I have a more in-depth guide in a separate tutorial here on the site, as well as in a video on our YouTube Channel. You can find that video here.



Here's our example code! To drive our motors, I decided to use the joystick data, as well as the ESP32 "AnalogWrite" library which makes the whole process really easy. the only downside is not being able to choose your PWM Channel. That's why I chose the more traditional method of PWM control for the ESP32 to control our servos. The drive of the robot is controlled with the left joystick, and the robotic arm is controlled with the right joystick! The claw in this example is opened and closed using the left and right triggers! There are a ton more features you could program in, this example code is designed to get you started! Be sure and install the PS3 controller host library in the link below if you haven't already.


https://github.com/jvpernis/esp32-ps3


ESP32 Voyager / Explorer PS3 Controller Example Code:


/* Hey guys! 
 * This code is designed to take in data from a standard
 * ps3 controller, and use that data to control the ESP32
 * Voyager, and Explorer Robot.  Feel free to alter, or 
 * customize this code as you'd like.  Have fun!
 * 
 * - Matt ACBR 2020
 */
#include <Ps3Controller.h>
#include <Arduino.h>
#include <analogWrite.h>
#include <esp32-hal-ledc.h>

#define COUNT_LOW 1638
#define COUNT_HIGH 7864
#define TIMER_WIDTH 16

int posOne = 5000;
int posTwo = 6000;
int posThree = 5000;
int inOne = 12;
int inTwo = 13;
int inThree = 16;
int inFour = 17;
int inFive = 23;
int inSix = 22;
int inSeven = 2;
int inEight = 15;
int rX;
int rY;
int lX;
int lY;

void setup()
{
    Serial.begin(115200);
    Ps3.begin("01:02:03:04:05:06");
    Serial.println("Ready.");
    pinMode(inOne, OUTPUT);
    pinMode(inTwo, OUTPUT); 
    pinMode(inThree, OUTPUT);
    pinMode(inFour, OUTPUT); 
    pinMode(inFive, OUTPUT);
    pinMode(inSix, OUTPUT); 
    pinMode(inSeven, OUTPUT);
    pinMode(inEight, OUTPUT); 
    ledcSetup(15, 50, TIMER_WIDTH); // channel 15, 50 Hz, 16-bit width
    ledcAttachPin(25, 15);   // GPIO 25 assigned to channel 15
    ledcSetup(14, 50, TIMER_WIDTH); // channel 14, 50 Hz, 16-bit width
    ledcAttachPin(27, 14);   // GPIO 27 assigned to channel 14
    ledcAttachPin(26, 14);   // GPIO 26 assigned to channel 14
    ledcSetup(13, 50, TIMER_WIDTH); // channel 15, 50 Hz, 16-bit width
    ledcAttachPin(14, 13);   // GPIO 14 assigned to channel 13
    ledcWrite(15,posOne);    
    ledcWrite(14,posTwo);    
    ledcWrite(13,posThree);
}

void loop()
{
 if(Ps3.isConnected()){
 lX =(Ps3.data.analog.stick.lx);
 lY =(Ps3.data.analog.stick.ly);
 rX =(Ps3.data.analog.stick.rx);
 rY =(Ps3.data.analog.stick.ry);

 Serial.print(lX);
 Serial.print(" ");
 Serial.print(lY);
 Serial.print(" ");
 Serial.print(rX);
 Serial.print(" ");
 Serial.println(rY);

 if(lY < -5){
  analogWrite(inOne, 0);
  analogWrite(inTwo, 200);
  analogWrite(inThree, 0);
  analogWrite(inFour, 200);
  analogWrite(inFive, 0);
  analogWrite(inSix, 200);
  analogWrite(inSeven, 0);
  analogWrite(inEight, 200);
  Serial.println("Forward!");
 }
 else if(lY > 5){
  analogWrite(inOne, 200);
  analogWrite(inTwo, 0);
  analogWrite(inThree, 200);
  analogWrite(inFour, 0);
  analogWrite(inFive, 200);
  analogWrite(inSix, 0);
  analogWrite(inSeven, 200);
  analogWrite(inEight, 0);
  Serial.println("Backward!");
 }
 else if(lX < -5){
  analogWrite(inOne, 255);
  analogWrite(inTwo, 0);
  analogWrite(inThree, 255);
  analogWrite(inFour, 0);
  analogWrite(inFive, 0);
  analogWrite(inSix, 255);
  analogWrite(inSeven, 0);
  analogWrite(inEight, 255);
  Serial.println("Left!");
 }
 else if(lX > 5){
  analogWrite(inOne, 0);
  analogWrite(inTwo, 255);
  analogWrite(inThree, 0);
  analogWrite(inFour, 255);
  analogWrite(inFive, 255);
  analogWrite(inSix, 0);
  analogWrite(inSeven, 255);
  analogWrite(inEight, 0);
  Serial.println("Right!");
 }
 else if(rX < -5 && posOne < 8000){
  ledcWrite(15,posOne);       
  posOne+=25;
 }
 else if(rX > 5 && posOne > 1500){
  ledcWrite(15,posOne);       
  posOne-=25;
 }
 else if(rY < -5 && posTwo < 8000){
  ledcWrite(14,posTwo);       
  posTwo+=25;
 }
 else if(rY > 5 && posTwo > 150){
  ledcWrite(14,posTwo);       
  posTwo-=25;
 }
 else if( abs(Ps3.data.button.l2) ){
  ledcWrite(13,posThree);       
  posThree+=25;
  }
 else if( abs(Ps3.data.button.r2) ){
  ledcWrite(13,posThree);       
  posThree-=25;
  }
 else {
  analogWrite(inOne, 255);
  analogWrite(inTwo, 255);
  analogWrite(inThree, 255);
  analogWrite(inFour, 255);
  analogWrite(inFive, 255);
  analogWrite(inSix, 255);
  analogWrite(inSeven, 255);
  analogWrite(inEight, 255);
 }
 }
 else {
  analogWrite(inOne, 255);
  analogWrite(inTwo, 255);
  analogWrite(inThree, 255);
  analogWrite(inFour, 255);
  analogWrite(inFive, 255);
  analogWrite(inSix, 255);
  analogWrite(inSeven, 255);
  analogWrite(inEight, 255);
 }
}

Part Six: Hack it!

I hope you enjoyed this tutorial, and I hope you have a blast building one of our ESP32 Voyagers, Explorers, or one of your own creations! We're planning on having a ton more content for these bots out soon, so be sure to subscribe to our YouTube Channel, or follow us on Instagram to stay up to date! Be sure to drop us a line if you have any questions!


922 views0 comments

Recent Posts

See All

Anyone Can Build Robots!

1+ (858) 434 5830

©2020 by Anyone Can Build Robots!