ESP8266 WIFI AP Controlled Quadruped Robot

8,592

98

33

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

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

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

    • PCB Contest

      PCB Contest
    • Big and Small Contest

      Big and Small Contest
    • Toys Contest

      Toys Contest

    33 Discussions

    0
    None
    binhb5

    1 day 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

    0
    None
    Wickedweed

    17 days 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?

    0
    None
    Jona55

    Question 5 weeks 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

    3 more answers
    0
    None
    Jona55MusaW

    Reply 4 weeks ago

    Hello MusaW,

    The other IP does not open the app, but I found the solution. I just have to disconnect the wifi connection with the spiderobo and start all over again. This means;
    1) Power up the spider
    2) connect via Wifi with spiderrobo and wait for connection (works always instantly, so the wemos is OK)
    3) fill in the pasword (12345678)
    4) start up http:/192.168.4.1
    5) confirm that there is no internet connection
    The app starts then immediatly without further problems.
    Still a very nice project that you made and thanks for the reply
    Best regards,
    Johan

    IMG_20181110_101813[1].jpgIMG_20181109_105831[1].jpgIMG_20181110_101619[1].jpg
    0
    None
    MusaWJona55

    Reply 4 weeks ago

    sure, u re welcome

    0
    None
    NicoG21

    Question 6 weeks ago

    a beautiful project but I do not know why it is very unbalanced and does not walk well, when it greets falls forward

    1 more answer
    0
    None
    MusaWNicoG21

    Reply 5 weeks ago

    open the servo horn and try to do initial pose again... until all the movement is OK

    0
    None
    skuld1

    7 weeks ago

    Hello,

    I've just build this robot, but the feet keep sliding on floor. It seems you used some socks to fix this behavior, but I can't guess what did you use. It looks like some shrinkable tube, but I'm not sure.

    Thanks for your tips :)

    2 replies
    0
    None
    skuld1MusaW

    Reply 7 weeks ago

    Thanks for your answer :)

    0
    None
    WestWindsDemon

    Question 2 months ago

    I'm interested in building this... after I get a 3D printer. Is there a way to change the controller from WiFi to Bluetooth so that you can control it with a PS3 controller, map the buttions and such?

    1 more answer
    0
    None
    Gadisha

    2 months ago

    Very cool, it moves very smoothly and looks good!

    1 reply
    0
    None
    MusaWGadisha

    Reply 7 weeks ago

    have a nice project

    0
    None
    theprojectmaker

    Question 2 months ago

    Was anything (anything not in the documentation, I mean) done to get the results shown in the video? The movement looks stunning but also looks faster than I'd expect from SG90 servos at 6V.

    Here's a similar robot using similar servos and the movement is good but not as quick as your video shows for sure: https://youtu.be/5hAmD499sJs?t=9

    1 more answer
    0
    None
    LucS24

    Question 2 months ago

    Really nice and well documented projet, I love it! I also have a question. Why are you using an Arduino (Nano or similar) AND a Wemos (ES8266 or similar)? Can't you do everything with just a Wemos? It has Wifi, and, I think, enough pins for everything no?

    Thanks for your help.

    2 more answers
    0
    None
    MusaWLucS24

    Reply 7 weeks ago

    basically it can, but in this project we need two task working parallel, one is AP as web server and second is actuator controller.
    if u merge it as one usually there is some issue raise, either your AP have an issue or actuator controller have an issue...

    0
    None
    kjellbLucS24

    Answer 2 months ago

    I guess because the Flexitimer2.h won't compile in a esp8266 chip. Swap the flexitimer2 with something else and it should work.

    I will try making this using a esp32 only.