After my unsuccessful attempt at making my very own wall avoiding robot using spare parts lying around my desk, I decided to give it another try.

This time I bought a complete chassis from robotshop. It’s a two-wheeled robot, each wheel being independently powered by its own motor. An omnidirectional wheel completes the design.

IMG_20140930_185633

While one end of the motor’s shaft is directly connected to the wheel, the other one holds a speed encoder used for the PID control loop mechanism. It might be worth mentioning that the chassis only comes with the encoder wheels, not the actual sensors that I bought separately.

IMG_20141015_220520
IMG_20141015_220558
IMG_20141015_220640__1415038238_208.71.184.41
IMG_20141015_221425

A Polulo dual DC motor driver is used to control the motor. It occupies 6 pins on the arduino : 2 PWM pins to control the speed, 4 digital pins to control the direction.

IMG_20141101_141555__1415038277_208.71.184.41

The parts :

  • 1 arduino uno
  • 1 LinkerBot Robot Platform
  • 1 Polulo Dual DC motor driver
  • 2 photoelectric speed measuring modules
  • 1 ultrasonic ranging detector
  • 4 AAA batteries
  • jumper wires

The code :

This time I went C++ instead of the C-derived Arduino language. I needed classes in order to encapsulate the different modules composing the robot. Without it I just got lost between all the control functions. It is my first try in C++ so please don’t hesitate to point me in the right direction if my syntax is a bit off ! Repository here.

PS: here is a video of the robot getting stuck in the hallway if you’re into that kind of things 😉