ESP8266 WIFI AP Controlled Quadruped Robot

17,760

127

48

About: Designer, Artist, Engineer

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)

Step 1: Prepare the Frame

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

Step 2: Assembly the Robot Frame

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

Step 3: Electronic Parts (Wemos D1 Mini)

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...

Step 4: Electronic Parts (Arduino Nano)

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...

Step 5: Electronic Parts (Tower Pro 9g Micro Servo)

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

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

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.

Step 7: PWM to Servo Pin Connection

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

Step 8: Electronic Parts (UBEC)

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

Step 9: Electronic Parts (DC-DC Mini Stepdown)

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

Step 10: Other Electronic Part

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)


Step 11: Power Source

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

Step 12: Wire Diagram

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.

Step 13: Coding and Initial Pose

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)

Step 14: Controlling the Robot

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...

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

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...

Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Sew Tough Challenge

      Sew Tough Challenge
    • Paint Challenge

      Paint Challenge

    48 Discussions

    0
    None
    felixjhon

    3 days ago

    Hello, excellent project! I love quadrupeds, and I need help. I'm not an experienced programmer, but I want to add an ultrasonic sensor, so that it does not collide with objects, could you help me with that? Thank you

    0
    None
    kaiezer1980

    20 days ago

    Why use arduino nano and esp8266
    It is possible with only NODEMCU?

    0
    None
    MarlonM49

    Question 3 months ago on Introduction

    Donde puedo pedir todo el circuito(hardware). Gracias

    0
    None
    Jona55

    Question 9 months ago on Step 14

    Where can I find the app to control the spider. The http adres seems not to work (time out in loading)
    Regards,

    Johan

    2 answers
    0
    None
    MusaWJona55

    Answer 8 months ago

    it should be working fine on smartphone... but some clone wemos have some issue with production... i have 3 of 10 wemos have the same problem like u... the solution is just replace the wemos... sorry about that

    0
    None
    MusaWMusaW

    Reply 3 months ago

    i have fix the issue, please download it again here

    0
    None
    marcusb101

    Question 5 months ago on Introduction

    Hi (a newbie here) I have done as per instructions but the quadruped controller does nothing when i press any controll, help needed .paul

    1 answer
    0
    None
    MusaWmarcusb101

    Answer 3 months ago

    i have fix the code, update 31-3-2019... please download it again

    0
    None
    Bernan86

    Question 4 months ago on Step 1

    Mr Wilmar saya membuat project spider robot berdasarkan instruksi anda, akan tetapi saya tidak memiliki printer 3D bisakah saya memesan Frame untuk project robot ke anda?

    1 answer
    0
    None
    ChristopheE2

    6 months ago

    Merci beaucoup, très bon projet et passionnant .
    Pour améliorer la page :
    Revoir le lien pour les câbles qui sont de piètre qualité.
    Donner les liens des différentes librairies nécessaires.
    Je suis passé par une breadboard pour faire le câblage .
    Prévoir un trou dans la coque pour mettre l'interrupteur.
    Christophe

    0
    None
    orlyyan

    Question 6 months ago

    I can use battery pack of 6v 700mah?

    0
    None
    Wickedweed

    7 months ago

    Hi. I noticed that all electronics run on 5V. Instead of using a RC Lipo battery with UBEC and another DC/DC regulator, do you think it is possible to replace all these and power the quadruped with a portable USB Powerbank capable of 2A output?

    1 reply
    0
    None
    MusaWWickedweed

    Reply 6 months ago

    yes u can, but remember better to split the power source between controller and servo. because if the power drop your robot still working fine...

    0
    None
    binhb5

    7 months ago

    i have done every thing likes you do but my robot not working, can you let me know what setting you chose in arduinoIDE-tool when you upload code to Wemos mini, it have too many setting to chose

    1 reply
    0
    None
    MusaWbinhb5

    Reply 6 months ago

    first, what error did u have now?

    0
    None
    mukeshgupta12

    Question 6 months ago on Step 11

    hello sir
    i have one question in my mind
    i have a code for temperature sensor with esp 8266 12 e. i set this code to take reading every 30 min
    but when i insert this code to esp it take reading every 27-28 min. i cannot understand that where is the error in code or hardware plz tell me. i can share my code also ...thanks
    please reply me

    1 answer
    0
    None
    MusaWmukeshgupta12

    Reply 6 months ago

    did u mean that the code is not runing exacly every 30 min or what?
    one thing that u must understand that this servo driver have to wait for every servo finish move acknoledge...
    sometime that acnoledge take more time and sometimes is not... maybe that's the reason that u looking for...

    0
    None
    Jona55

    Question 8 months ago on Step 3

    Hello, my quadruped worked fine in the beginning when I was using a stabilised power supply at 5volts for the connection of the wemos, the arduino uno and the 16 servo controller. I made nice soldering connections to the dc dc step down ( 5.2 volts calibrated) to power up arduino, wemos and servo controller and the ubec for powering up the servo board. But now I can connect to the wemos ( wifi connected, no internet) but the ip adres to start the android app won't start. When I read out the op adres of the wemos he give a other adres (192.168.4.2 instead of the 192.168.4.1). What can be wrong. The blue led on the wemos blinks on the start up and the go out. Is this normal. Regards, Johan