Hey everyone what's up!
So this is my microbot V1 which is an ESP32 based robot which is powered by a Wemos d32 pro and controlled by Blynk.
Its body is a 3D printed square surface that has mounting holes for the same size PCB which is mounted with this setup with screws in the sandwich config to hold the battery in middle.
The battery is 12V 2.6A li-ion and the Motors that I've used are small Micro Gear DC Motor
I prepared this robot with a custom PCB which is basically a breakout board for Wemos D32 pro and l293d motor driver IC.
Motors are powered by a 12V battery but the esp32 board that I'm using doesn't have a buck converter circuit onboard so I added an AMS1117 setup on it for stepping down the 12V to 3.3V for the MCU.
I designed this circuit in Orcad cadence and generated Gerber data and send that to JLCPCB.
THANKS, JLCPCB for supporting this project
the result was a nice ESP32 based motor board which can be now used to control DC motors or any Inductive loads.
But why did I made this microbot?
Well, the goal of this project was to make a small micro gear DC motor-based robot platform that is easy and fun to make.
this robot is partially 3D printed and partially PCB based as its upper part is just a 2mm Fr4 board and the bottom structure is generic white PLA with a battery in middle.
For those who are interested in this project, feel free to download its data and make your own version of this board!
Materials Required
these are the things that I've used in this project.
- Custom PCB (provided by JLCPCB)
- Wemos D32 Pro
- L293D
- Ams1117
- Cap 20uf 1206
- cap 2uf 1206
- dual Connector
- Female Header pins
- LEDs 0603
- 2Ohms 0805
- Gear DC Motors
- Wheels for Micro Gear Motor
- Caster wheels
- Li-ion battery with a BMS
and these 3D printed parts-
- Motor Holding bushes
- Mounting Pillars
- Base
After sourcing everything, I started the assembly process
the assembly process includes a lower base assembly, PCB assembly, and merging of Lower Base with assembled PCB Board.
First, I prepared the lower base which includes a 3D printed Base structure, Two Motor Mounts, Micromotor wheels, and caster wheels.
Motor Mounts holds the Micro Motor in its place and caster wheels are added in both directions for front and rear support as this robot has two wheels and its rotating point is at the center as this is a differential wheeled robot.
This is how the lower part looks after the assembly-
After the assembly of the lower part, I started the assembly of the Motor Driver PCB.
I first added the AMS1117 circuit on it and three led with soldering iron, and then tested the voltage regulator by connecting a multimeter at its output and GND and supply 12V to it.
AMS1117 circuit includes two SMD Caps of value 220uf and 20uf at input and output of the voltage regulator and an M7 diode for dropping output voltage a little bit.
After getting the step-down voltage, I added the through-hole components like the Motor Driver IC, connectors, and the MCU on the Motor Driver Board and this is how everything looks at the end of the PCB assembly
this setup is now ready to be merged with its lower part.
for that, I used long M3 Screws and nuts with the mounting pillar in between to connect the TOP PCB with the Assembled lower base.
And this is the final form of this project, not yet but it's pretty much final as we need to add wires to the motors in the right polarity and connect them with the wire connector of PCB.
now this setup is complete and we can check the working of this setup by first uploading a simple Chaser sketch for LEDs connected on 2, 15, and 0 pins of esp32.
int pinsCount=3; // declaring the integer variable pinsCount
int pins[] = {15,2,0}; // declaring the array pins[]
void setup() {
pinMode(15, OUTPUT);
pinMode(2, OUTPUT);
pinMode(0, OUTPUT);
}
void loop() {
for (int i=0; i<pinsCount; i=i+1){ // chasing right
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(50); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
for (int i=pinsCount-1; i>0; i=i-1){ // chasing left (except the outer leds)
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(50); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
}
Testing was a success, after this, I upload the basic motor test sketch for moving the motor forward and then stopping it (you know, the hello world sketch for the motor driver).
here's the code and this is how everything went
int motor1Pin1 = 13; //in1
int motor1Pin2 = 12; //in2
int motor1Pin3 = 14; //in3
int motor1Pin4 = 27; //in4
int enable1Pin = 26; //en1
int enable2Pin = 25; //en2
void setup() {
// sets the pins as outputs:
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor1Pin3, OUTPUT);
pinMode(motor1Pin4, OUTPUT);
pinMode(enable1Pin, OUTPUT);
pinMode(enable2Pin, OUTPUT);
Serial.begin(115200);
// testing
Serial.print("Testing DC Motor...");
}
void loop() {
// Move the DC motor forward at maximum speed
Serial.println("Moving Forward");
digitalWrite(enable1Pin, HIGH);
digitalWrite(enable2Pin, HIGH);
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor1Pin3, LOW);
digitalWrite(motor1Pin4, HIGH);
delay(2000);
// Stop the DC motor
Serial.println("Motor stopped");
digitalWrite(enable1Pin, LOW);
digitalWrite(enable2Pin, LOW);
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor1Pin3, LOW);
digitalWrite(motor1Pin4, LOW);
delay(2000);
}
After this motor test, now all that left to do was to set up Blynk and control this bot with the Blynk app.
And for that, I first installed the Blynk library in Arduino IDE from the library manager by searching the term Blynk.
more info about the installing process from here-
http://help.blynk.cc/en/articles/512105-how-to-install-blynk-library-for-arduino-ide
I then downloaded the Blynk app and setup 6 buttons for controlling each motor driver input and two enable pins for enabling two motors.
For controlling Motor A, these two buttons will send a high signal on GPIO13 and 12, also enable pi will be connected to gpio26 with a switch button.
The same is for Motor B, two buttons will send a HIGH signal on GPIO 25 and 27, Enable B is connected with pin 13.
Blynk sends an Auth code which links your setup with this app through WIFI, this auth code is sent by Blynk when you created any project in your logged-in email address. copy that auth code and paste it into the ESP32_WIFI sketch along with your network SSID and Password.
Select the right Board and hit upload and that's pretty much it.
Test RUN
Watch the video for the whole built process and test run.
Improvements
For now, this Robot has a Wemos D32 Pro on top of it but the future version will have an ESP32 module soldered on the PCB directly and instead of using L293D, I'll be using much powerful L298N which can even run much bigger 12V Motors.
also, this robot needs an SSD1306 OLED in the front part which will display a cute face on it to make this robot look more "ROBOTIC AND KAWAII"
anyways, that's the plan for V2, Leave a comment if this post was fun, point out what I did wrong!
Comments