Follower Companion Robot

This robot was created as the final project in my programming class. It uses an arduino mega 2560 and a raspberry pi 4b combined to create a robot that is capable of tracking a person's face, and also follow them. My goal for this was to create a 'companion' robot like in the Star Wars universe that could follow you around and look at you, and I think it turned out pretty well. However limitations with the face tracking program could send it flying towards a tree which necessitated the use of a transmitter to be able to switch it back to manual control.
Supplies

this project required: a raspberry pi 4b, a picam v2 with longer camera cables, a micro HDMI to HDMI adapter, a 5v 5a buck converter, an arduino mega 2560, four bts7960 motor drivers, at least 2kg of PLA filament, and some 85a shore hardness TPU filament. to power it I used two 2500mah 3s lipo batteries, a 1200mah 2s lipo battery, and a 2000mah power bank to power the arduino. It also uses a flysky fs1i6x transmitter and receiver combo to control the robot and allow it to switch to control from the raspberry pi.
Design

The first step was to design the robot. Due to the robot's goal, it needed to be very maneuverable, so I designed it around four geared dc motors with omni wheels. I designed every part using fusion 360 and I wanted to make as many of the parts as possible to be 3d printable to keep the costs down. This included the omni wheels that I used. Based on the prices I saw for small omni wheels, I felt they were too expensive so I designed my own fully 3d printable ones that only require 6 m3 screws each.
Printing

the first step was printing out all of the parts, there are quite a few of them, and it took over a week of printing parts to get it finished. luckily I modified my ender 3 to have a 400mm build plate so I did not have to split up any parts into smaller pieces.
Assembly




this part was tricky because one of the most difficult parts of a project is figuring out the order things need to be assembled. I found that the base frame needed to be assembled first, then the motor driver plate needs to be mounted. Then the motors need to wired to the motor drivers, then the arduino needs to be mounted to its mount which then gets mounted above the motor driver plate. from there it just involved lots of wiring. I then assembled the head and unfortunately, the head weighed over a pound and the design required that the servo spin its entire weight. this caused me to have to counterweigh it to prevent the servo from burning out.
Coding


coding was definitely the hardest part of the project due to having to code both an arduino and a raspberry pi, as well as having the raspberry pi talk to the arduino. It required the arduino to take inputs from both an rc receiver and from a raspberry pi. The way the project works is the raspberry pi finds a face in front of the camera, it finds the coordinates of the person in terms of pixels in x or y, and based on those coordinates, it sends PWM signals to the arduino to keep the person's face centered in the camera. It also has a feature where based on the size of the rectangle around the person's head it can determine how far away they are and keep a specific distance from them. This allows it to be a cute follower robot like a droid from Star Wars.
Finished


I am really happy how this thing turned out. It was a bit odd the way it worked in the end, but I am really happy with it. It is a bit sluggish because the motors I chose are way too powerful (whoops). However, it does allow for future upgrades and improvements to the motion system, especially since the entire robot is completely modular. the way it follows you is really cute and its slightly erratic movements give it a personality of its own.
Future Plans

In the future I would like to make the robot balance on top of a basket ball, as this would eliminate a lot of the issues I was having. Due to using four motors and omni wheels, the robot tended to only ride on two of the wheels at a time due to inconsistencies in the surface it drove on. This new design will have the four motors drive the basketball instead and allow the robot to balance on top. However this design requires complex coding and use of a gyroscope to work properly so this is going to take a while.