ESP8266 WIFI AP Controlled Quadruped Robot

by MusaW in Circuits > Robots

53513 Views, 228 Favorites, 0 Comments

ESP8266 WIFI AP Controlled Quadruped Robot

Quadruped V2 Wifi Web Server Demo

This is tutorial to make a 12 DOF or four leg (quadruped) robot using SG90 servo with servo driver and it can be controlled using WIFI Web server via smartphone browser

Total cost for this project is around US $55 (For Electronic part and Plastic Robot Frame)

Prepare the Frame

_MG_1390.JPG

All the 3D object is free to download @ www.myminifactory.com or www.thingiverse.com

Print it using material support for some part like Foot, Hips and Thighs

List of printed part:

1x base body

1x Cover

1x Battery holder

4x Hips (type A & B)

4x Thight (type A & B)

4x Foot (type A & B)

4x Shield

12x Bushing + 12x 2mm screw

Assembly the Robot Frame

Quadruped V2 Robot Assembly

follow step by step video above to assembly the frame, the screw is for 2mm size hole

Electronic Parts (Wemos D1 Mini)

Wemos D1 Mini, ESP8266 Getting Started Guide With Arduino
2988-1.jpg

There is a lot of NodeMCU variant in the market and basically have the same functionality, for this project i choose Wemos D1 Mini.

This part will be serve as a Web Servers for our quadruped as an Access Point.

What u need is just connect to the Quadruped AP and control all the movement of your robot, and maybe for the future project it will displaying all the sensors dashboard you need...

This D1 mini, is a mini WIFI board based on ESP-8266EX. and it have
11 digital input/output pins, all pins have interrupt/pwm/I2C/one-wire supported(except D0) 1 analog input(3.3V max input) a Micro USB connection

How to get started in :

  1. Install for Arduino 1.6.7 from the for Arduino website.
  2. Start for Arduino and open Preferences window.
  3. into Additional Boards Manager URLs field. You can add multiple URLs, separating them with commas.
  4. Open Tools→Board:xxx→Boards Manager and install esp8266 by ESP8266 Community (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

For more detail you can check video above

Click here to search in Aliexpress

For this project all u need is connect this Pin:

  1. NodeMCU RX pin connect to the Arduino Nano TX pin
  2. NodeMCU TX pin connect to the Arduino Nano RX pin
  3. NodeMCU G pin connect to the DC-DC mini 5v Stepdown (-) Output pin out
  4. NodeMCU5V pin connect to the DC-DC mini 5v Stepdown (+) Output pin out

PS: For Programing this board u must disconnect all the pin attached to the arduino and DC-DC step down, otherwise u will get an error...

Electronic Parts (Arduino Nano)

51oYEG4MukL._SX355_.jpg
GB2hw.jpg

Same with NodeMCU, for the arduino board u can use any board which fit for u like Arduino Pro Mini, Arduino Nano or else.

But For this project i choose Arduino Nano, because don't need much of pin i used, it's small and don't need FTDI to program it.

click Here to search in Aliexpress

For this project i just use :

  1. Arduino nano RX pin connect to the NodeMCU TX pin
  2. Arduino nano TX pin connect to the NodeMCU RX pin
  3. Ardiono nano A4 pin connect to the PCA9685 SDA pin
  4. Arduino nano A5 pin connect to the PCA9685 SCL pin
  5. Arduino nano GND pin connect to the DC-DC mini 5v Stepdown (-) Output pin out
  6. Arduino nano 5V pin connect to the DC-DC mini 5v Stepdown (+) Output pin out

see the schema above for more detail

PS: For Programing this board u must disconnect all the pin attached to the NodeMCU and DC-DC step down, otherwise u will get an error...

Electronic Parts (Tower Pro 9g Micro Servo)

servo.JPG

This is the most popular mini servo. Only weighs 9 gram and gives
you a 1.5 kg/cm torque. Pretty strong regarding its size. Suitable for beam type robots.

PS : This servo only can rotate 180 degree angle

Key features:

• Translucent body

• Lightweight

• Less noise Specifications:

• Dimensions: 22.6 x 21.8 x 11.4 mm

• Connector wire length: 150 mm

• Operating speed (4.8 V no load): 0.12 sec / 60 degrees

• Stall torque (4.8 V): 1.98 kg/cm

• Temperature range: 30 to 60°C (-22 to 140℉)

• Dead band width: 4 usec

• Operation voltage : 3.5 - 8.4 Volts

Click Here to search SG90 servo in Aliexpress

Electronic Parts (16-Channel 12-bit PWM/Servo Driver - I2C Interface - PCA9685 for Arduino)

PCA9685-Diagram.jpg

Want to make robot walker? but using only microcontroller has a limited number of PWM outputs, and you find yourself running out! Not with the Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface. With this pwm and servo driver breakout, you can control 16 free-running PWM outputs with just two pins! Need to run more than 16 PWM outputs? No problem. Chain together up to 62 of these beauties for up to an outstanding 992 PWM outputs.

This board/chip uses I2C 7-bit address between 0x60-0x80, selectable with jumpers
Terminal block for power input (or you can use the 0.1" breakouts on the side) Reverse polarity protection on the terminal block input Green power-good LED 3 pin connectors in groups of 4 so you can plug in 16 servos at once (Servo plugs are slightly wider than 0.1" so you can only stack 4 next to each other on 0.1" header "Chain-able" design A spot to place a big capacitor on the V+ line (in case you need it) 220 ohm series resistors on all the output lines to protect them, and to make driving LEDs trivial Solder jumpers for the 6 address select pins i2c-controlled PWM driver with a built in clock. Unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, its completely free running! It is 5V compliant, which means you can control it from a 3.3V microcontroller and still safely drive up to 6V outputs (this is good for when you want to control white or blue LEDs with 3.4+ forward voltages) 6 address select pins so you can wire up to 62 of these on a single i2c bus, a total of 992 outputs - that's a lot of servos or LEDs Adjustable frequency PWM up to about 1.6 KHz 12-bit resolution for each output - for servos, that means about 4us resolution at 60Hz update rate Configurable push-pull or open-drain output Output enable pin to quickly disable all the outputs.

click Here to search in Aliexpress

In this project we just need 12 CH for all legs (3CH per leg), connect this PCA9685 pin to Arduino Nano:

  1. PCA9685 VCC to the DC-DC mini 5v Stepdown (+) Output pin out
  2. PCA9685 GND to the DC-DC mini 5v Stepdown (-) Output pin out
  3. PCA9685 Servo (PWM) power V+ to UBEC (+) Output pin out
  4. PCA9685 Servo (PWM) power GND to UBEC (-) Output pin out
  5. PCA9685 SDA pinto the arduino nano A4 pin
  6. PCA9685 SCL pin to the arduino nano A5 pin
  7. PCA9685 CH0 to the Front Right Thight, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  8. PCA9685 CH1 to the Front Right Foot, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  9. PCA9685 CH2 to the Front Right Hip, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  10. PCA9685 CH4 to the Back Right Thight, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  11. PCA9685 CH5 to the Back Right Foot, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  12. PCA9685 CH6 to the Back Right Hip, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  13. PCA9685 CH8 to the Front Left Thight, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  14. PCA9685 CH9 to the Front Left Foot, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  15. PCA9685 CH10 to the Front Left Hip, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  16. PCA9685 CH12 to the Back Left Thight, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  17. PCA9685 CH13 to the Back Left Foot, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)
  18. PCA9685 CH14 to the Back Left Hip, please match the cable color to the PCA9685 socket color (Yellow, Red, Brown/Black)

PS: Some PCA9685 don't have color code socket, so make sure that Yellow cable from SG90 servo goes to PWM data pin, Red cable goes to V+ pin, and Black/Brown goes to GND pin.

PWM to Servo Pin Connection

leg-layout.jpg
_MG_1437.JPG

Click and zoom picture above to see the pin maping between PCA9685 and the servos

PS: U only using 12CH from 16 CH for this project, so u still have 4CH left for expansion like putting radar servo or put some nerf blaster weapon on it... Just put an additional code in the arduino and NodeMCU

Electronic Parts (UBEC)

6192zYOx2fL._SL1000_.jpg

The 3A-UBEC is a switch-mode DC-DC
regulator supplied with a 2-6 cells lithium battery pack (or 5-18 cells NiMh /NiCd battery ) and it outputs a consistent safe voltage for your receiver, gyro and servos. It is very suitable for RC helicopter. Compared with the linear mode UBEC, the overall efficiency of the switch-mode UBEC is higher.

In this project we using it to powering all the servos, it has filtering so it will reduce noise that can effected the motor glitch and it has high Amp that's enough to lift up the robot load.

click Here to search in Aliexpress

Pin connection :

  1. UBEC (+) RED Output pin out to the PCA9685 Servo (PWM) power V+
  2. UBEC (-) BLACK Output pin out to the PCA9685 Servo (PWM) power GND
  3. UBEC (+) RED Input to the Battery (+) pin
  4. UBEC (-) BLACK input to the switch pin

Electronic Parts (DC-DC Mini Stepdown)

01-1.jpg
HTB1Uq.XKpXXXXc2XVXXq6xXFXXXM.jpg

It almost have same function with UBEC, but this one is only simple DC-DC step down module. It have potensio meter that we can adjust the V (+) output from 1V to 17V and does not have filtering.

click Here to search it on Aliexpress

PS: so remember, before u use it please adjust the V (+) out to 5V output using DC Volt meter

Pin connection :

  1. Mini stepdown (+) IN to the (+) Battery
  2. Mini stepdown (-) IN to the switch pin
  3. Mini stepdown (+) OUT in parallel to the NodeMCU (5V), Arduino nano (5V) and PCA9685 (VCC) pin
  4. Mini stepdown (-) OUT in parallel to the NodeMCU (G), Arduino nano (GND) and PCA9685 (GND) pin

Other Electronic Part

40 pin female to female jumper wire-750x750.jpg
41Ebf9bMCJL._SX342_.jpg
jst.JPG

What u need is around (20 cable or less) female to female jumper wire (Aliexpress Jumper wire search)

Self lock push switch or u can use other type of switch (Aliexpress Self locking switch search)

and a pair of JST connector from battery to switch and UBEC/DC-DC stepdown (Aliexpress JST Connector search)


Power Source

holder.JPG
batt.JPG

There is a lot of power source u can use, for me i prefer using rechargeable lipo 3S battery. It has 11,1 Volt Current and 500mAh or more capacity (not too much so it can be lighter).

But using 3S lipo need a charger and it's not cheap, so... u can use other power source like AAA battery, u can serial 6 AAA battery so it can produce around 9V power source and i think that's enough power for this robot.

Click Here to search Lipo 3S battery in Aliexpress

Click Here to search Lipo Charger

Click Here to search 6xAAA Battery holder in Aliexpress

Wire Diagram

quadruped_bb.jpg

Click and zoom picture above to see all the wire diagram for this project

PS: u need some soldering in some part and put a rubber head shrink to seal it for the connection between power switch, UBEC and DC-DC step down.

Coding and Initial Pose

init-pose.jpg

Connect the arduino nano using mini USB to USB port cable (but don't forget to disconnect all pin to the wemos D1 mini and DC-DC stepdown) and Open "spider_driver_open_v3_ESP8266_Rev280918.ino" and flash it to the Arduino nano, but don't forget to select the arduino board to the Arduino nano and select the correct port.

Next is connect the Wemos D1 mini to the computer using micro USB to USB (also don't forget to disconnect all pin to DC-DC stepdown and Arduino nano). Than open "QuadrupetV2_310319_fix_connection_issue.ino" and flash it to the board, but before that sellect the correct board in preference and select the correct port (more detail please back to the step 3)

After all finish u can reattach all the pin to between arduino nano, wemos D1 mini and DC-DC stepdown and powering up the robot to adjust the correct initial pose.

INITIAL POSE (See the picture above) --> readjust all the leg as close as possible to the picture above.

After u power up the robot, if the leg position not same with the picture above than all u need is:

  1. unscrew the Servo Horn and detach the servo horn from servo.
  2. turn the leg until close enough with the initial pose
  3. reattach the servo horn and crew it again
  4. do it for all miss match leg

PS:

  1. QuadrupetV2_310419_fix_connection_issue.ino is already fixed some issue like hard to connect (wifi) and web page render fail, for who flash the older program before 31-3-2019 please download it again above
  2. there is some additional library need to install (copy it to library folder)

Controlling the Robot

control.jpg

Because this robot is become WIFI Access Point so all u need is:

  1. Powering up the robot
  2. Open wifi setting on your smartphone
  3. Connect to the SpiderRobo Access Point with password is "12345678"
  4. Open web browser on your smartphone and type http://192.168.4.1

Now your Robot is ready to take your command...

For Whom Have a Problem With Opening Web Page or Connecting to the AP

wemos D1 mini Clone common AP problem

I HAVE FIX THIS ISSUE PLEASE DOWNLOAD IT AGAIN FROM STEP 13 ABOVE (fix @ 31-4-2019)

some of Wemos D1 mini clone have a bad or defect ESP, and it causing:
- Hard to connect to the AP

- Fail to open page

- Loading not finish

For more detail check my video above...