Wednesday, March 15, 2017

R2C2 - Raspberry Pi + ROS Robot for Coursera Robotics Course (Part 1 - Assembly)

As part of carrier oriented personal goals for 2016/17 I have being taking the Robotics Specialization course at Coursera offered by Penn university. In this 6 course specialization you have to complete a capstone project related to robotics. There are two tracks you can select for this. Either a MATLAB based simulation project or if you are more adventurous, you can choose to build a real autonomous robot from basic hobbyist robot components you can easily source from online vendors.
Well even though you only need to complete either of the tracks to pass the course, since doing the simulation track is more straightforward and less exotic why not doing both? So here I go ahead with doing both tracks. Nerd smile
First step was to acquire the required components. As a guideline course moderators have provided a wish list at Adafruit for sourcing the components. But I have choose to do a little bit of my own research and use alternative components that I can easily find either locally or for a lower price from ebay.
So here is the components I used.
  • Raspberry Pi 3 Model B – ebay (US $36.96) 
  • Raspberry Pi Camera Board v2 – ebay (US $20.99)
  • 3-wheel Smart Robot Car Chassis with Speed encoder and Battery Box – Local Shop (LKR 1100.00 - Approx. US $7.25)
  • I2C TB6612 Stepper Motor PCA9685 Servo Driver Shield V2 Fr Arduino – ebay (US $5.91)
  • 10DOF LSM303D + L3GD20 + BMP180 Pressure Field + Gyroscope Module Sensors – ebay (US $6.97) 
  • Adjustable Pi Camera Mount – ebay (US $1.89)
When the chassis is observed, even though it had some holes to mount components, none were aligning with the Raspberry Pi. So I got some holes drilled up on to mount the Raspberry Pi before assembling the chassis.
CAM00430 (1280x961)
I also flashed the Raspberry Pi image provided at course webpage and configured for remote access since the way I have chosen to place the Raspberry Pi prevents easy access to the HDMI port once the Motor shield is mounted.
After assembling the chassis I had mounted the Raspberry Pi using some plastic mounts and screws. I also mounted the Camera mount base and the IMU using a single screw.
CAM00432 (1280x962)
Then I screwed the Raspberry Pi camera to the camera mount and attached it to the camera mount base. And attached the camera cable to Raspberry Pi.
CAM00436 (1280x960)
Since I purchased a Arduino version of the Motor shield instead of Raspberry Pi version (purely to save some bucks since Arduino version was much cheaper)  I had to mount it separately instead mounting directly on top of the Raspberry Pi. Then connected the wires from motors to the motor hat.
CAM00439 (1280x960)
Then I used a Level converted and some jumper wires to connect Raspberry Pi, Motor Hat and the IMU. Here both IMU and Motor Hat runs in 5V logic levels while Raspberry Pi is Running at 3.3V logic levels.
Untitled Sketch_bb
Note: Actual components used are slightly different than in the above diagram.
CAM00440 (1280x960)
Unlike the Adafruit chassis kit, the one I used did not have a top shelf. So I got an ad-hock platform 3D printed. Unfortunately sitting in my car under scorching sun,Sun it got bent down in the middle.
CAM00442 (1280x960)
But nevertheless it serves the purpose for mounting the battery packs. I used double sided tapes to secure the battery packs on top of the platform.
CAM00443 (1280x962)
Once all done and modifying the controller template to issue a 0.3m/s forward and 0.5rad/s angular velocity as instructed in the course, I could verify that all were connected in order.

I conveniently named the robot as R2C2 which stands for Raspberry Pi ROS (Robot) for Coursera (Robotics) Course. It is also partly inspired from R2D2 (even though former is a droid unlike this which is a differential drive robot)
[Published with Open Live Writer on Windows 10]