Introduction: Green Robot Ant
I have black horse ants (Camponotus ligniperda, up to 14mm) on my terrace, they are harmless and they can be easily observed at work. Fascinating!
Imitation is a form of respect, so I would like to build a robotic ant. I started the groundwork for this a year ago.
Ants are not very demanding, so I want to use as few servos and power consumers as possible. To enable adequate movement, two servos per leg are necessary (=12) with the help of a little mechanic. Other makers use 18 servos.
The goal of the project:
- use as little material as possible
- reduce the number of servos/power consumers as much as possible
The project is similar to my Blue Ant, but has been in development for a long time. The look is more authentic and the walking is more flexible, saving 6 servos.
Why a green ant?
Well, green was the first filament I bought for my 3d printer. Isn't that a nice color?
Supplies
12 servos SG90 (+1)
Esp32-S3 XIAO with camera (or ESP32-Cam) - optional with fisheye lense
(ESP32 or ESP32C3 / ESP32 / ESP8266 without cam also possible!)
3D printer
6x ball bearings
7.4V LiPo battery or 2x 18650 LiPo with holder
Buck converter + switch
Step 1: Print the Parts
I use an Anycubic 3D printer with PLA filament. You may have to add supports yourself. I tried to use as little material as possible.
Print out one part each:
- head bottom/top
- tail bottom/top
- torso bottom/top
Print three parts each:
- servobox left/right
- leg2 left/right
Print six parts:
- leg1
- rod
Attachments
Step 2: Servos and Leg Parts
Print all 3D parts in a color of your joice (step 1)
There are three left and three right legs.
Remove the tabs of all servos with pliers/saw and file.
Two servos for tilting and lifting the leg are placed as close together as possible in a servo box. This is something like a hip joint. A small mechanical rod helps us to improve the lifting and stability of the leg and save one servo. The joints are formed by screws whose nuts are secured to the joint with superglue.
- First place the screw through the bottom of the servobox and fasten it.
- Assemble the leg marts and servo box as seen on picture
- Then insert the servos and fix them later with hot glue or superglue.
Step 3: Center the Servos
The servo values range from 0 to 180, 90 is therefor the center. You should center all servos before installing the servo arms.
Connect each servo to GND, 5V and e.g. D4 of a Arduino Nano/ESP32/ESP8266 and run the script.
Attachments
Step 4: The Torso
The ant body has no case, the six servo boxes are just attached between the two torso plates.
It would be a good idea to set all servos to the centre position first (see step 2).
The ball bearing is placed in the hollow of the lower torso plate and the servo box is inserted through it with the screw first. The servo arm is attached to the servo gear wheel and secured with the screw.
When all servo pairs have been placed click on the black or white servo arms, lock them with screws and attach the servo arms to the plastic. You need to pre-drill with a fine drill bit first.
Step 5: Head and Gripper (optional)
The gripper is not really necessary, but it is a nice extra. (I don‘t have it in my pictures here)
Insert the servo without arm into the frame. First set the servo to 90 ("centerlegs.ino" in Step 2). Put the matching gripper part on the gear wheel and fix it with the servo screw. Then put the second part on the axis.
Glue the gripper upside down into the top of the head with hot glue. You will need an extension cable to connect this servo to the PCA9685 board in the tail.
Step 6: Wiring
The wiring is simple:
The buck converter supplies both the servo board (PCA9685) and the ESP32 with 5V. The +/- connectors on the PCA9685 can also be used for the ESP32 power supply.
Step 7: ESP32-S3 Sense XIAO With Camera
The ESP32-S3 XIAO is a tiny microcontroller with OV2640 camera.
Better you first make all soldering and programming before you fix the lense with hot glue
Step 8: PCA9685 Control Board
With the PCA9685 control board it is possible to handle up to 16 servos. Adafruit has a library for this, but I prefer "hcpca9685.h". It is much easier to use.
To use this library, open the Library Manager in the Arduino IDE and install it from there.
Step 9: Test Software
This test software is running via WiFi. Don't forget to enter your access data here:
// Replace with your network credentials
const char* ssid = "****";
const char* password = "****";
Step 10: Moving
It is time to test the software with a simple walking program.
Step 11: RC 1: WebServer With Cam
The remote comtrol is already included in the code (see marked code lines). The Green Ant has it‘s own WiFi, it is an AccessPoint. Start Green Ant by switch, wait a while, search for the WiFi „GreenAnt“ and log in (no password).
Type the address 192.168.1.100 in your browser and the remote control appears. Now you can see everything from the ant‘s view and control it.
I got the remote control from randomnerdtutorials.com. Sara and Rui doing excellent work!
Step 12: RC 2: Remote XY Alternative
If you do not have an ESP32-S3 or ESP32-Cam, but only an ESP32 or ESP8266, you can also use RemoteXY as a freely configurable remote control.
At https://remotexy.com/ you could create your own interface for the smartphone remote control and insert it into the programme "Blue_Ant-RemoteXY.ino". You can find more information in this tutorial:
https://www.instructables.com/RemoteXY-Editor-How-to-Control-DC-Motor-With-Smart/
The app for the smartphone is available here:
https://play.google.com/store/apps/details?id=com.shevauto.remotexy.free
https://apps.apple.com/us/app/remotexy/id1168130280
Install the app on your smartphone, activate Bluetooth, open "RemoteXY", search for and pair with
"Green Ant".
Step 13: Autonomous Run
Optionally, the ant could also function autonomously, with an ultrasonic sensor (e.g. HC-SR04) or an VL53L1X Laser sensor as "eyes" and an additional servo for head movement. But that's your decision now.
Step 14: Addition: the Shell
A cover is not really necessary, but it gives the right ant look. The head also houses the ESP32 and the camera, while the back contains the power supply and the servo board. A 3D printer would be useful here, but I have also experimented with covers made from scotch tape and wire.
[My project: Floating Tape Tea Pot ]