Xpress board: Obstacle avoiding robot with XC8 code

0
Some of the links on this blog are affiliated links. READ MORE

All the projects I made until now using the Microchip Xpress Demo board were stationary projects. Those were projects in which the Xpress board was connected to the PC via USB cable, with one MikroElektronika click board performing various functions. But it doesn’t have to be this way. One can use the Xpress Evaluation board in more creative ways…

Today I will show you how to use the Xpress board to make an obstacle avoiding robot, using one breadboard as robot chassis, and components that are available worldwide. As such, it should be easy for anybody to replicate this project.

The hardware

This robot uses a more exotic approach: a WB-104-3 breadboard is used as chassis, with motors, trailing ball, batteries and a click board socket being fixed right on the breadboard base. The breadboard itself is 220 x 120 x 31 mm, with a 1.2 mm aluminum plate base and it weighs about 0.4 kg. Breadboard area comprises one distribution strip with 100 distribution holes and two terminal strips, with a total of 1280 terminal holes.

As the breadboard is quite heavy, I needed some motors that are able to develop enough torque to set the whole thing in motion. My choice went to Pololu micro-motors, for their small footprint and the ease of fixing them to the breadboard. Having a matching trailing ball in my parts inventory also contributed to this choice.

Pololu micromotors

Pololu manufactures a huge range of micro-motors, all with the same size of 10 × 12 x 26 mm. The wheel shaft adds an extra 9 mm to the 26 mm length. There is also a version with a longer 14mm shaft, which allows the use of an encoder.

Several motors are available:

  • 12V HPCB (High Power Carbon Brushes), with a stall current of 600mA
  • 6V HP (High Power) with 1600mA stall current
  • 6V HPCB  with 1600mA stall current
  • 6V MP (Medium power), with 700mA stall current
  • 6V LP (Low power), with 360mA stall current

Stalling the motors should be avoided as this can damage both the motor and the gearbox. Pololu’s general recommendation for brushed DC motor operation is 25% or less of the stall current.

Each of the above motors can be matched with one of the eleven gearboxes, with gear ratios ranging from 1:5 to 1:1000. A low gear ratio means higher speed, but lower torque. Higher gear ratios sacrifice speed to gain higher torque values.

The breadboard I used in this project is quite heavy, and I also had to consider the weight of added components, batteries and stuff. As such I have chosen one 6V HP motor with a 1:250 gearbox. The item number from Pololu is 995. The maximum stall current of this motor is 1600mA, the no-load speed is 120 RPM, and the stall torque is approximately 0.4Nm.

The motors were fixed to the breadboard using a pair of Pololu Micro Metal Gearmotor Brackets in black color, having the Pololu item# 989. Wheels are also from Pololu, they are 32×7 mm in size, with item# 1087 for the black version. To run the cables I drilled two 5mm holes, in which I’ve put FIX-GR-15 rubber grommets.

Considering the max RPM and the wheel size we can compute the maximum speed in cm/s:

The wheel circumference is: 

In a minute the robot can go for a distance: 

This corresponds to a theoretical no-load speed of about 20 cm/s. In practice, due to the weight robot, it will move much slower, I think somewhere less than half of this. I also noticed that due to the high gear ratio the motor is unlikely to stall. On most surfaces the wheels will lose traction and will begin to spin freely rather than having the motors stop.

Motor drivers

Now that we have the motors, we have to choose the motor driver. The motor driver should meet a number of constraints:

  • it has to handle the stall current of the motors, so it won’t get damaged if motor stalls
  • it has to work with 6V power, as I will use four AAA batteries to power my robot
  • as the PIC16F18855 has only two PWM pins, the motor driver must be able to work with those
  • it must fit onto the breadboard

My driver of choice is DVR8835 from Texas Instruments, a motor drivers containing two full-bridges, with a maximum peak current of 1.5A. It also embeds a lot of protection circuits, so it’s extremely hard to damage. As for the voltage, it can work between 2 and 11V, more than enough for my robot implementation. This particular motor driver has two user selectable working modes, one of the working modes requiring one PWM line and one direction pin per bridge – so it matches the PIC16F18855 capabilities. To fit on the breadboard I used a Pololu 2135 dual motor driver carrier, which is a breadboard-compatible breakout board for the DRV8835.

Pololu 2135 - DRV8835 Dual Motor Driver Carrier

Pololu 2135 – DRV8835 Dual Motor Driver Carrier

The Vcc pin must be connected to the logic voltage, in our case this being 3.3V provided by the regulator onboard the DM164140 Xpress board. Vin is connected to the battery voltage. To run this motor with only two PWM lines the MODE pin must be held high, connected to Vcc.

The left motor is connected to channel A (pins O2 and O1). To drive this motor PWM should be applied to pin (A) IN2-EN, direction being set by pin (A) IN1-PH.

The right motor is connected to channel B (pins O2 and O1). To drive this motor PWM should be applied to pin (B) IN2-EN, direction being set by pin (B) IN1-PH.

Trailing wheel

The robot runs in a trailing wheel configuration, with motors being fixed on about 1/3 of the whole length, and a ball caster in the rear. The ball caster is Pololu item# 953.

This is a decent compromise between maneuverability and the number of parts used in the driving train. Obviously, different motor  configurations can be used, and it’s fun to observe how motor placement affects the overall performance.

The breadboard robot: trailing end ball caster

The breadboard robot: trailing end ball caster

1 2 3
Share.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.