Introduction: Wheel-E the Self Balancing PCB Based Robot

About: Hobbyist, Content based on Robotics, electronics, PCB designing, animation and much more

Wheel-E is a two wheel self balancing Robot which doesn't need a body or mechanical parts to assemble. The PCB itself is body of the robot. This project is inspired by Sean HodginsPiddyBOT. Based on Arduino Nano, this is a great project for students to start learning Control systems such as PID system. With the powerful support of Arduino, advanced Robotics enthusiasts can use the Wheel-E PCB to incorporate complex codes with closed loop system using encoders or the IR sensor slots.

The code and libraries for project is available on my github. Wheel E is available as a Kit, DM for details.

Full build series on my Youtube : https://www.youtube.com/channel/UC5JisJw1YjSRWKqyGeFB4yA

Supplies

Components needed:

  • Wheel-E PCB x 1 (DM to Buy)
  • N20 micro metal motors x 2
  • MPU6050/9250 x 1
  • Arduino Nano x 1
  • TP4056 Battery charging Module x 1
  • XL6009 Boost Converter Module x 1
  • L293d motor driver x 2
  • TactileSwitch x 2
  • 10Kohm Preset x 3
  • 5050 RGB led x 1
  • Other miscellaneous resistors

Step 1: Designing the Schematic and PCB

I design my PCBs in Altium software (to download click here) .At the start you need to know which features you want to be in the PCB. I wanted this PCB to have Potentiometers for adjustment and tuning of PID algorithm in real time without changing the code every time. My design uses two motor drivers in dual channel mode to provide more current capacity to the motor.

Features of this design include:

  • Necessary passive components that'll be used for user interface.
  • MPU6050/9250 is used for angle measurement
  • L293D motor driver is used to control the N20 micro metal gear motors in Open loop
  • connections two IR sensors and two servos are also added for self stand-up of the robot.
  • Peripherals for Bluetooth and OLED are also provided.
  • TP4056 based battery charger module ( to charge the battery hence we wont have to disassemble the bot for charging)
  • GenericBoost module to boost 3.7V of the battery to operable 5V.
  • Buzzer for user interface.
  • Buttons to set Zero and Reset the system

Specifications of PCB:

  • Size of the PCB is 77 x 94 mm
  • 2 layer FR4
  • 1.6 mm

Step 2: Generating Gerbers and Ordering PCBs From PCBway:

GERBER FILES :

Select Fabrication outputs from File menu, then select Geber Files option. Select the necessary layers and the rest of the options can be left as default. A Camstatic File will be generated after clicking Ok, export Gerber files from this file by navigating to File->Export. Add these files in a zip Folder. For the drill file repeat the process by selecting NC drill Files in the Fabrication Outputs tab. Add this text file in the same zip Folder. Your Gerber files are now ready to be uploaded!

Refer to this video for a detailed tutorial on Generation of Gerbers:

These PCBs are ordered from PCBway , You can now order 5 pieces in just $5 now! You can get instant quotation by uploading the files. PCBway will review the files under a few minutes and you can order them instantly. Production takes just a few days and I'm always amazed by the quality of the PCBs received.

Step 3: Assembling and Test Run of Wheel-E:

Start by soldering all the SMD components first, followed by soldering other components with increasing height.Before inserting Arduino in the header pins carefully check for shorts and dry solder.Connect a 3.7V lipo battery to the PCB and secure it properly to the body. Set the boost output to 5V and now you can insert Arduino in the PCB .Once done, insert Arduino and all other modules on the PCB. Solder wires and fix the N20 Motors with the clamps and nut bolts.

Connect the Arduino to the PC and upload this test code in it to check if everything works fine.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h> 
#include <Adafruit_SSD1306.h> 
#define SCREEN_WIDTH 128 // OLED display width, in pixels 
#define SCREEN_HEIGHT 64 // OLED display height, in pixels 

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) 
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin) 

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define SYS_R A3
#define SYS_B A6
#define SYS_G A7


void setup() {
  // put your setup code here, to run once:

// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally 
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) 
{ Serial.println(F("SSD1306 allocation failed")); 
for(;;); 
// Don't proceed, loop forever } 
// Show initial display buffer contents on the screen -- 
// the library initializes this with an Adafruit splash screen.
display.display();

// Clear the buffer 

display.clearDisplay(); 
pinMode(SYS_G,OUTPUT);
pinMode(SYS_B,OUTPUT);
}


void loop(){
digitalWrite(SYS_R,LOW);<br>digitalWrite(SYS_G,LOW);
display.setTextSize(1);             // Normal 1:1 pixel scale 
display.setTextColor(WHITE);        // Draw white text 
display.setCursor(0,0);             // Start at top-left corner 
display.println(F("Welcome, I'm ready to Balance"));
}

If you've done everything correctly you will see the LED glowing Purple and Oled displaying "Welcome, I'm ready to Balance"

Now you're ready to upload the main code (will be uploaded on my github soon) and tweak around the code PID ranges and use the potentiometers to see how each parameter affects the system in what way :)

Step 4: Improvements and Capabilities:

  • Self Stand up:

Wheel-E provides slots for two Servo motor connections. These can be used to make Wheel-E stand from horizontal position on its own. Since the weight is less, small servos can be easily used for this Modification.

  • IR sensor based Second Feedback:

Two IR sensors can be connected directly on the PCB facing downward. These can be used as a second feedback to make the system closed loop and add potential of going forward and backward using external controller.

  • Bluetooth Controller:

Wheel-E has integrated slot for HC-05 bluetooth module that can be used to control the robot via smartphone using an app.

  • Encoder-Motors:

Encoded N20 motors can be used to make a complex yet fully precise two wheel balancing robot.