Saturday, November 29, 2014

Playing with the MiniQ v2

I recently bought a DFRobot MiniQ v2 to evaluate as a possible pre-built robot to use in the robotics class I'm teaching.

Features

The MiniQ is small, but comes in a nice plastic case with a USB cable. (It also comes with another ribbon cable – I think it is used for add-ons, but not yet sure.) It has an intriguing mix of features:
  • Built-in wheel encoders
  • IR proximity sensors in front
  • Left and right ambient light sensors
  • An RGB LED (very bright!)
  • Five line-following sensors underneath
  • Three built-in pushbutton switches
  • An HMC5883 compass module
  • IR remote control unit (can be read through the IR proximity sensor)
There is no documentation in the box, but a Wiki and tutorial are available on the DFRobot web site, as well as other store sites that sell the robot.

Friday, October 31, 2014

More About Sonar Sensors

Unfortunately, further tests with multiple sonars show that the sonars have a lot of errors, mostly when not pointed directly at a flat surface. That is, if the angle of the sensor to a wall is close to the normal, the sensors are quite accurate. As the angle from normal increases, the incidence of spurious large distances also increases.

As well, there appear to be false echoes off the ground – since my robot has little ground clearance – when the actual distances increase. You can see that from this graph, which shows sonar distances while the robot is moving. The robot path is shown as the blue plot. The sonar positions are left-side (about 80° to the left of straight ahead), left-front (about 10° to the left), right-front (10° to the right), and right-side (80° to the right).



Friday, October 17, 2014

Sonar Measurements While Moving

I've been worried about two things regarding the sonar sensors, HC–SR04 units:
  • The sonars may have a lot of variance in their measurements, according to reports on the web.
  • Measurements from the sonars may be affected by movement, or by noise from the motors.
So I wrote a program to capture one sonar distance as the robot moved, and captured the robot position and sonar distance periodically. The result was surprisingly accurate:


The wall distance before about 3 seconds was from an intermediate obstacle to the left. Robot distance traveled is based on the wheel encoders, which have 30 segments per revolution, about 7mm per tick. The wall distance was measured by an HC–SR04 sensor pointing forward.

I was expecting a lot more variation in the sonar sensors (distance to wall). The actual values are accurate enough that little smoothing or filtering may be necessary. There are more wiggles in the speeds, because I calculated those based on measurements in the interval, 1/4 second.

Further Questions

Do the sonar sensor readings have more variance if the wall is at an angle?

Do the sonar sensors interfere with each other if they are fired close together?

Is there electrical noise from firing the sonars that interferes with the measurements?

Friday, October 10, 2014

More About Odometry

A few weeks after I had the odometry working, I found that the robot started veering off course, and it wouldn't follow waypoints as accurately. I was adding sonar sensors at the time and was worried I was getting noise from all the additional wiring. So I researched a little more and experimented with a pull-up resistor instead of a pull-down.

The old wiring:


With the pull-down resistor, the analog reading on pin A0 ranged from about 30 (black stripe) to about 150 (white stripe), enough to distinguish, but not high enough to use a digital input.


Sunday, September 28, 2014

Odometry

I wanted my robot to be able to do dead reckoning, so I needed wheel encoders. There are some encoders on the market that can work with the Dagu yellow motors, as in the Magician chassis, or with the Solarbotics gear motors. And Pololu makes an encoder for their micro metal gear motors that detects wheel motion and direction by detecting white reflective tabs built-in to the wheels.

But I had already decided to use continuous rotation servos, which don't have a second shaft on the non-drive side to mount an encoder disk. Instead, I decided to mount a paper ring of encoder stripes on the inside of a Solarbotics servo wheel. I needed some way to detect the changes between black and white as the wheel rotated.

I found a set of components from Optek on mouser.com that seemed promising. They were a combination of an LED and a phototransistor, packaged together in a trapezoidal case with a screw hole.



Mobile Robot Project

I'm creating a small, mobile robot that will be featured in a robotics class I'm going to teach at my son's Middle School. Since I don't have much background in robotics, this class will be a way to expand my knowledge as well.

The prototype robot:

Robot Components

The robot has several components:
  • Arduino Uno R3 microcontroller
  • Continuous rotation servos to drive the wheels
  • Swivel caster at the back
  • Optek OPB742WZ for wheel encoders – IR LED + phototransistor
  • HC–SR04 ultrasonic distance sensors
  • Starboard HDPE plastic one-level base (7"x7"), and for HC–SR04 mounts (2"x1" each)
  • 9V battery to power the Arduino, plus 4xAA to power the servos; both battery holders have a cover an switch, so that there are separate switches for Arduino and motor power

Construction

Construction of the robot is intentionally low-tech. The servos and the ultrasonic mounts are affixed to the base with Scotch Extreme Mounting Tape. The ultrasonic sensors are pressed into two 5/8" holes in the mounts. The battery holders are attached to the base with velcro tape. The Arduino is screwed directly into the base with #4x1/2" machine screws and 1/4" standoffs. The HDPE base is soft enough that pilot holes aren't needed. The phototransistors are also screwed in with #4x1/2" screws and 1/8" standoffs. And the breadboard is attached using its adhesive back.

The robots used in the class will differ from this prototype only in the placement of the ultrasonic sensors. Testing with the prototype shows that it's easier to follow walls with a side-looking sensor closer to the front. So the final robots will likely use four sensors instead of five. I'll discuss this further in later posts, as well as summarize lessons learned while teaching the class.