For Project 3, my main area of focus was on the hardware component of the robot. The primary objective was to enhance the robot’s obstacle avoidance capabilities by incorporating three ultrasonic sensors onto the lower base. These sensors were intended to detect lower areas that the Lidar did not detect. To achieve this, I imported the wiringpi library from the Sparkfun website to the Raspberry Pi via the command line. I performed a blink test using one of the examples from the wiring library to ensure that the library and my pins were functioning correctly. Next, I modified one of the starter codes from the ultrasounds C++ file to match several pins on the robot that wouldn’t cause any issues. I initialized the three sensors by adding four more defines (two for each sensor) and assigned them to available wiring pins on the robot. After the setup, I obtained the GetCM function from additional links provided to us, which were from an article about the sensors [2]. I duplicated the GetCM function three times for each sensor and modified them to print out the measured distance for me to see.
The second milestone of this project involved adding sensors to the robot. To accomplish this, I designed two types of mounts for the sensors using the Autodesk Inventor program. I had to create separate mount designs because the robot base did not have a consistent design on all sides. Specifically, the front end, where the camera is located, did not have holes on the front for easily attaching the mount. To overcome this, I designed the front mount with long arms that could reach out to the only two possible holes in the center of the lower base.
Fitting the model to the sensors was not very challenging as I found the dimensions of all the parts online, which sped up my design process [1]. However, it is worth mentioning that the model did not turn out perfectly due to my mistakes in scaling the model on Flashforge, the platform that verifies models to work with 3D printers. As a result, there were instances when the models were unsuitable for the robot but I managed to make it work on the end. Attached are some pictures of my model in Inventor. The material used for the printing was an ABS filament, I found that it made precise texture on the model compared to a PLA filament.
My biggest challenge on this project was ensuring that the robot could still drive. There was a night when the robot was able to drive, but afterwards, it completely stopped. Professor Wu suggested that I change the Pico in case there were motor issues. However, when the issue persisted, we investigated whether there was a problem with the Raspberry Pi. As a result, I had to replace both parts to see if it would restore the robot’s ability to drive.
This process involved several steps, including adding a new Raspberry Pi which changed the robot’s IP address, ensuring that the GPIO pins I used didn’t damage the Pi, and ultimately discovering that the cable connecting the Raspberry Pi to the Pico was broken, which turned out to be the main issue.
I did not get to take pictures of the breadboard attached to the Raspberry Pi, but the photo below shows which GPIO Pins I used.
[1] “Amazon.com: WWZMDiB 2Pcs HC-SR04 Ultrasonic Sensor Module for Arduino R3 MEGA Mega2560 Duemilanove Nano Robot XBee ZigBee (2Pcs HC-SR04 with housing),” www.amazon.com. https://www.amazon.com/WWZMDiB-HC-SR04-Ultrasonic-Distance-Measuring/dp/B0B1MJJLJP?th=1 (accessed Dec. 07, 2023).
[2} “RPi: HC-SR04 Ultrasonic Sensor mini-project,” try { work(); } finally { code(); }, Jul. 16, 2013. https://ninedof.wordpress.com/2013/07/16/rpi-hc-sr04-ultrasonic-sensor-mini-project/ (accessed Dec. 07, 2023).