ESP8266 WIFI AP Controlled Quadruped Robot

31,248

160

77

Introduction: ESP8266 WIFI AP Controlled Quadruped Robot

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

1 Person Made This Project!

Recommendations

  • Mason Jar Speed Challenge

    Mason Jar Speed Challenge
  • Bikes Challenge

    Bikes Challenge
  • Remix Contest

    Remix Contest

77 Discussions

0
federico.andreis
federico.andreis

Question 3 months ago

Hi there! Very nice project. I just finished printing everything and got to assembling it, however... the micro-servos do not fit! I bought some I thought to be identical (Same specs, sg90 blue ones by Kuman), yet I’m unable to fit them in place.

I was wondering whether I missed some indication about increasing the print size by a fraction, or some microservos Just have different size...

I might have to redesign the joints to fit them if there is no other fix quick!

thanks again For this!

0
injobho
injobho

Answer 6 weeks ago

I just noted that there are 2 varaities of these blue sg90 servos as in the picture. I got both but one with the golden color label is slightly longer which donot fit in this design. The one with the silver label fits. There are no other means of identification for these. These probably are Chinese made and the gear quality is bad for both. A little jerk can easily rips off the gears.

IMG_20200811_193451.jpg
0
injobho
injobho

Answer 2 months ago

Same here. Scale the hips and thigh by 1.03 and 1.04 times respectively, then it fits perfectly

0
SINONING
SINONING

3 months ago

we have same one,

0
stef338
stef338

5 months ago

Hello,
Merci pour ce projet bien fini. j'ai un problème. Je cherche la solution depuis une semaine sens résultat. les croquis se charge sens erreur pour nano et wemos d1. La connexion du wemos d1 avec le portable fonctionne. Quand j'appuie sur une direction le voyant bleu du wemos d1 s'allume. Mais le robot ne bouge pas. la LED " tx " du nano ne s'allume pas. Mes deux cartes fonctionne avec " Blink ". Les liaisons filaires entre les cartes électronique sont sans erreurs. Avec beaucoup de regret, je ne trouve plus de solution. Peux-tu me donner une idée, please. Merci d'avance pour ton aide.

0
Sumakovvadim
Sumakovvadim

8 months ago

Thank you friend for the cool project! we hanged with a child! https://youtu.be/_nSUqff-vR4 That's what I did. but what if I draw my frame with 12 servos but with a larger size with this code. will it work? Or is the code written for this size?

0
Sumakovvadim
Sumakovvadim

8 months ago

Hello Friend! Can you be contacted at whatsapp? My whatsapp number is +91 97045 99802. Or my mailbox is sumkovvadim@gmail.com Please contact me there are a couple of questions, the child can not understand
0
MusaW
MusaW

Reply 8 months ago

hi, i have emailing you... check it out...

0
felixjhon
felixjhon

1 year 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
MusaW
MusaW

Reply 1 year ago

sorry for late response, there is a lot of similar project using ultrasonic, maybe u can combine with another project such as arduino ultrasonic radar for this... sorry i can't help u much for now... maybe some day i will put additional plugins for this

0
felixjhon
felixjhon

Reply 9 months ago

Hi, thanks for answering, I made it work with the ultrasonic sensor and an LDR light sensor, I presented it in my school project. Thank you for your work.

0
MusaW
MusaW

Reply 8 months ago

good work... and u r welcome

1
jy1999
jy1999

9 months ago

Hi, I have some error when loading the Wemos file. It was giving me the following errors:

WARNING: library Esplora claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp8266 architecture(s).
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:35:36: error: 'A1' was not declared in this scope
const byte MUX_ADDR_PINS[] = { A0, A1, A2, A3 };
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:35:40: error: 'A2' was not declared in this scope
const byte MUX_ADDR_PINS[] = { A0, A1, A2, A3 };
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:35:44: error: 'A3' was not declared in this scope
const byte MUX_ADDR_PINS[] = { A0, A1, A2, A3 };
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:36:26: error: 'A4' was not declared in this scope
const byte MUX_COM_PIN = A4;
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:53:26: error: 'A5' was not declared in this scope
const byte ACCEL_X_PIN = A5;
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:54:26: error: 'A11' was not declared in this scope
const byte ACCEL_Y_PIN = A11;
^
C:\Program Files (x86)\Arduino\libraries\Esplora\src\Esplora.cpp:55:26: error: 'A6' was not declared in this scope
const byte ACCEL_Z_PIN = A6;...


If I comment out the "#include <Esplora.h>, then Arduino can upload the file.

Appreciate if you can help. Thanks

0
MusaW
MusaW

Reply 9 months ago

what board u choose when compile it? and which of my code using #include <Esplora.h>

0
jy1999
jy1999

Reply 9 months ago

LOLIN(Wemos) D1 R2 & mini was the board chosen, and the code was "QuadrupetV2_310419_fix_connection_issue.ino".

I do not have the WEMOS D1 mini selection for some reasons. Could that be the problems. Thanks

0
jy1999
jy1999

Reply 9 months ago

Thanks. Will try again till what you suggested.

1
sainijiten89
sainijiten89

Question 1 year ago on Step 10

Hi Musa, this is JItendra here from India. First of all, great project and very well written post. I am attempting to build the same 4 leg pod following your instructions and almost there but when i run the code, i see a few issues. Example, when i make the bot sit, front and back leg movements are in reverse. i.e. both front legs move upwards which is expected but the rear legs go down which is exact opposite of the front leg movements (Thigh & Foot portion). Also, i see similar reversal of movement for FWD, BACK, LEFT & RIGHT as well.
Would you be able to point out what i might be doing wrong.
Please let me know if i can provide more details.
Thanks in advance.
Jitendra

0
MusaW
MusaW

Reply 1 year ago

are u sure to put the type A and type B in the right position. if u put it wrong way the result will be reverse...