I was looking for a fun weekend project with parts I had around the house. In digging through my junk box, I found a track chassis I bought a while back on Amazon just because it looked cool. I figured I'd use it one day. Apparently, this was the day!
I thought an autonomous robot would be fun to build. I've built a few robots in my day with wheels or legs, but never with tracks. So this was my project!
Next I found an Arduino Mega and an old motor shield, so I was off to the races!
I mounted the Mega and the battery holder that came with the chassis using double-sided tape. Then I snapped on the motor shield. The shield can drive 2 DC motors using a handful of digital pins on the Arduino.
Now that I had a drive system, I needed sensors to keep the robot from running into things. Luckily, I had four Sharp IR sensors with 10-80cm range. I needed some way to position them in four directions and mount them to the robot, so I decided to build a sensor shield. I wired the sensors up on a blank shield board and mounted them using Gorilla Glue.
In order to more easily calibrate and troubleshoot my Arduino code on the sensor board, I added an OLED to display sensor readings and the current heading of the robot.
I also decided to add a mini volt meter to the sensor board so I could monitor the battery voltage. That way I'd know when the 18650 lithium batteries were running low. Here's a top view of the completed robot ready for testing.
I played around with the Arduino code to get reasonable response from the sensors and reaction from the motors. I had some problems on different floor surfaces and with one of the motors apparently turning slightly slower than the other. I made quite a few tweaks to my code before I felt pretty good about the results.
It's still not perfect, but does a pretty good job of avoiding collisions while running around the floor. Here's a video of my "kitchen floor test".