How to Build a Raspberry Pi Robot
by _avrdude_ in Circuits > Raspberry Pi
866 Views, 11 Favorites, 0 Comments
How to Build a Raspberry Pi Robot
So a couple of years ago I decided to build a robot. After a bit of research, I decided I would use the Raspberry Pi 4, and a motor controller. Thus the era of errors was started in my life. In my defense, I was a beginner, and I was working with some faulty hardware at first. Eventually, I finished it, complete with Bluetooth controllability, live webcam feed, and underpowered motors that didn't even turn on hardwood floors. But to the point, the robot. I have had my eye on this robot for a while, being so cheap and all. You can find it on amazon here and check it out for yourself. The build went surprisingly well, and the end product was well worth the 90$ I payed for it. It is controlled by wifi, has a pi camera for live feed, and even has a gripper claw. So let's get started, and please like and vote for this instructable as I am entering the First Time Author Contest. Enjoy!
Supplies
- Adeept Rasptank Wifi Wireless Smart Robot Kit
- Raspberry Pi (either a 3 or 4 works)
- Micro sd card (I recommend at least 32 GB)
- 18650 Battery charger
- 20oz Red Bull (not essential)
Unboxing
Unboxing the robot was exciting. The components came neatly and separately packaged and nothing was damaged. I had read in the reviews that it didn't come with batteries so I picked up some Victagen batteries and a charger. It was a pleasant surprise to find out that it did actually come with two18650 batteries. Let's get started!
Read Through the Tutorials(Optional)
Adeept has helpfully provided a short tutorial introducing us to the raspberry pi and the motor hat. You can read through it to gain a very basic understanding of how the robot will work. Click here.
Installing and Configuring Raspberry Pi System
Before we actually assemble the robot, it is necessary to set up the software for the Rasptank. This is because the ports on the Raspberry Pi are notoriously hard to access when the robot is assembled. Following the instructions here, you can do this. First of all, you will need to install Raspberry Pi OS. Following the instructions on the link should give you precise details on how to do this, so I will not list it out here. NOTE: Adeept recommends using an old version of Raspberry Pi OS for correct compatibility. "Due to compatibility issues with the latest Raspberry Pi official image file (2021-10-30) and the camera. It may cause an error when the Raspberry Pi runs the program. We recommend downloading the official older version of the Raspberry Pi image."
Raspberry Pi old version image file (2021-5-07) download address: https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2021-05-28/
Like is said, just follow the instructions closely and you'll probably be fine.
After this, you will configure the SSH and set up wifi. Make sure you change the "ssid" to whatever your wifi name is, and the "psk" to whatever your wifi password is. Example:
ssid="Put your wifi name here"
psk="Put your wifi password here"
Once this is done, you can save everything and put the sd card into your raspberry pi. After this, it tells you several ways to connect via ssh. I haven't tried all the ways, but downloading SSH PuTTY seems to be the easiest option. You can download that securely here. Remember, the default username on your Raspberry Pi is "pi" and the password is "raspberry"
Just make sure SSH, 12C, and Camera are enabled on your pi before you get too deep. Also while you are on there: write down your IP address for later. You can find that by running hostname -I in the terminal. Now open PuTTY and type in the IP address, and it will open a terminal and ask you for your username and password on the pi.
Now, that you have your pi disconnected from the monitor and are accessing it via SSH, you need to install the actual program. Open the terminal and type
sudo git clone https://github.com/adeept/adeept_rasptank.git
in the terminal. You may have to wait a while for this to download, so just hang and wait, or take a break.
l If you use "Manually download the image file we provide" to write the image file to the SD card, the dependency library of the robot product has been installed, you can directly boot the Raspberry Pi to start using the robot.
The next bit can be a bit confusing, but basically, if you downloaded the image file they provided you, you do not need to install the dependency libraries. Otherwise, follow the instructions carefully.
To test whether the dependent libraries have been successfully installed, you can connect the camera and motor hat to the pi and run the program. Before you do that make sure there are no running programs. Type
sudo killall python3
in the terminal. Now, to run the program, type
sudo python3 adeept_rasptank/server/webServer.py
in the terminal. To open the web control interface, simply type the IP address of your pi in a browser, preferably Chrome to avoid possible browser compatibility issues, and through port 5000. Example- 192.168.3.44:5000
Just change the first part to whatever your pi's IP address is.
You can also create a wifi hotspot on the Raspberry Pi. Follow the directions on the website.
At the very bottom of the page, there are Q&A for if you had any errors.
How It Works
The next 10 lessons on the website teach you how everything works, and they lead you through the code and have you connect servos and the motors, etc, to see how the code controls them. I kind of skipped through them in my haste to get the robot built 😬. But you should probably read them through, just to be safe.
Assembly!!
Now the most exciting part, assembly! Follow the assembly precautions here before you get too deep into the hardware though. Now we begin to assemble the robot. This starts here. I am not going to paraphrase the entire assembly instructions, as that would be time-consuming and kind of pointless. My instructions are to just pay close attention and follow everything exactly. As you will notice, the body of the robot is beautiful clear and dark acrylic. It is papered so you need to peel that off before assembly.
About right away you may run into a problem. I believe this will only happen to pi 4 users. When you put the piece of acrylic between the pi and the motor hat, you need to screw some copper standoffs on the top. For me they did not screw on, the lower standoffs were simply too short. My solution was to drill the plastic piece down with a bigger diameter drill bit. This opened it up so the lower standoff could fit deeper. According to other amazon buyers, they sanded it down with a file. Whatever the case it is fairly easy to alter it to fit.
Make sure you follow the directions to debug the servo.
All I can say from here on is that just be careful. There were a few times when I had to push pretty hard to make a bolt go far enough to screw onto the nut, but I managed. Also, I wasn't quite sure about the gripper assembly at one point. As you can see in the diagram above, the black plastic tube is supposed to go on. However, it seemed mine was too long. If I put it on, it would loosen the assembly and look kind of weird, because one side is longer than the other. Eventually, I just put it on.
The other problem I had and still have is the tracks. On one side the wheel does not match up very well to the track. I loosened both sides and that helps the track rotate freely. But now when I'm driving for a while it will loosen way up and almost come off. Maybe I could design and 3d print one and see if that would work better. That's about all the problems I've had, and it turned out pretty nice.
Driving the Robot
Now, if everything is connected up, you should be able to flip the power switch on the motor hat and boot it up. The red light on the pi will turn on first, but after it's booted up the LEDs that came with the kit will turn on. You can access the Adeept Web Controller by typing your IP address at port 5000(192.168.3.44:5000) and if everything is correct it will load and show a live feed from the pi camera as well as the control buttons. At first, the camera was all flickery, but later when I tried it wasn't so much. There was also a few seconds lag, but I anticipated this as our wifi is quite slow. After driving it for a few minutes you may notice the servos on the arm and claw slow down drastically. I assume this is the batteries running out. Because I have another set, I can slide those in and keep on for a while.
Debugging
If anything isn't working correctly, you can debug it now. Unfortunately, you basically have to take apart the whole robot, to access the micro sd card and the motor hat. So if you have any problems, check out the Q&A on the website.
GUI Control
Another method of controlling the robot is by GUI. This is only the compatible with the Windows operating system. You can find the instructions here. You will need to install some libraries first.
Final Thoughts
I am really impressed with this robot. It has worked very well and the pi camera is fairly good quality. I did notice a crack in one of the plastic arms, and the other side did break(see the pictures above). Thankfully there was a replacement and I could swap it out fairly quickly. I guess the lesson there is to not overtighten the pieces. Anyways, this robot has been a fun build and has taught me a little more about Python and robotics. Thanks for reading!