Вы находитесь на странице: 1из 8

DIY SCANNING TABLET WITH ULTRASONIC SENSORS

rigonz2@netscape.net
R0 July 2014

1.

BACKGROUND AND PURPOSE

This document describes the design and construction of a DIY scanner equipped with
ultrasonic sensors.
This particular scanner, here named as a tablet, is based on a rectangular hollow frame on
whose perimeter there are a number of static ultrasonic (US) range sensors. Items
introduced in the internal area or space defined by the tablet frame are detected by the
sensors, the information gathered is converted into the position of the item, and then into
control signals related to the position of the object.

2.

DESCRIPTION OF THE SCANNING TABLET

The tablet that has been constructed as shown in the attached pictures.

Figure 1: Ultrasonic Scanning Tablet

The dimensions of the tablet are:


Length (internal): 275 mm
Width (internal): 220 mm

Scanning Tablet with US Sensors R0

1/8

Shape factor (width/length): 0.8


The frame is made in wood, with rectangular pieces. The ultrasonic sensors are HC-SR04
and the device is controlled with an Arduino mini Pro.

3.

DESIGN OF THE SCANNING TABLET

3.1. Dimensions and Number/Position of the Sensors


The dimensions of the tablet have been selected with the following main constraints:
a fingers hand can be comfortably used as a pointer;
the US sensors operate within ranges of reasonable measurement accuracy and
precision;
the coverage provided by the sensors is high for the purposes of determination of the
position of the pointer;
The tablet shape (width/length ratio) was predefined as 0.62 for aesthetical reasons, but
later adjusted to an available frame.
A simulation program using the Monte Carlo approach has been developed and run to
assess different shape options as well as to help defining the number, position and
orientation of the sensors.
The targets of the simulation were:
minimize the number of sensors (maximum 6 because of limitations of the Arduino
mini pro used as a controller);
maximize the area covered by the sensors;
minimize the measurement sensitivity.
The code and the results are explained in the following sections.
3.2. Point Detection
The tablet defines a 2-dimensional planar system: the internal area delimited by the tablet
frame. Two coordinates are required to define the position of a point in this area. Basic
coordinates systems which can be used are the Cartesian (x,y) or polar coordinates (,).
If ultrasonic distance sensors are used to measure the distance from the sensor to the
point, the coordinates can be determined with two static separate sensors, or with one
sensor mounted on a servo (which provides the angular position of the distance sensor), as
shown in the following diagrams.

Scanning Tablet with US Sensors R0

2/8

Figure 2: Ultrasonic Scanning Options (Point Detection)

The tablet described in this document is based on static sensors. The code controlling it
uses both Cartesian and polar coordinates depending on the computation requirements.
In order to determine the position of a point, two sensors are needed that overlap their
respective measurement areas: the point has to be within the active area shown in the
following diagram to be detected.

Figure 3: Ultrasonic Position Scanning

It follows that a first requirement of the tablet is that, for a given number of sensors and
given features of these sensors, the area on which point position readings can be done is
maximized. (The area on which point position readings can be done is calculated here as
the fraction of the tablet area on which at least two readings from different sensors can be
collected).
There is an exact solution to this geometrical problem, but it seems analytically complicated
because of the separation of the different domains as well as for the number of variables
involved. As an alternative, a series of statistical (Monte Carlo) simulation programs with
gradient optimization have been developed and run. The code for the main one is included
in Annex 1.

Scanning Tablet with US Sensors R0

3/8

The positions of the sensors that maximize the coverage ratios, as provided by the
simulation program, are summarized in the following diagrams.

Figure 4: Maximum Coverage (Point Detection)

3.3. Effect of Measuring Errors


Ultrasonic sensors have measurement errors which are not negligible, as mentioned in
3.5 below. The following charts show the distribution of the absolute measuring error as
related to the geometry of the distance reading.

Scanning Tablet with US Sensors R0

4/8

Figure 5: Geometrical Distribution of the Absolute Measurement Error (Point Detection; Length
of tablet 60 cm, Width 35 cm; Measuring Error Standard Deviation 10 mm; Left: Average Absolute
Error, cm; Right: Probability of Measurement Calculation Impossibility due to Measurement Error )

Absolute errors are then minimized, on average, if the largest of the measurement angles
(from the segment joining both sensors) exceeds ~20.
3.4. Object Detection
The actual elements to be detected by the sensors are not points: positioning errors will
then happen if the system described in 3.3 is used with real objects, as shown in this
diagram:

Figure 6: Ultrasonic Scanning Errors

There is no complete solution for this problem, but several relatively easy alternative
approximations are available:
assume that the object has a given shape and dimension (f.eg. a circular shape of
given radius) and determine the center of the circle from two distance measurements;
use three sensors and assimilate the real object to the circle that fits into the three
distance readings;

Scanning Tablet with US Sensors R0

5/8

use three or more sensors and determine the position of the object from the position
of the pairs of adjacent distance measurements.

Figure 7: Ultrasonic Scanning Options (Object Detection)

The tablet described in this document makes use of the three options, depending on the
availability of distance measurements.
3.5. Hardware and Software of the Scanning Tablet
3.5.1. Harwdware
The ultrasonic sensors are HC-SR04, of unknown brand, and the device is run with an
Arduino mini pro.
As per the tests conducted,1 the operational specifications of the sensors are:
FOV (full cone): horizontal ~20, vertical ~13.
Spatial resolution (full cone): ~0.6-1.4.
Range: tested from 5 to 200 cm.
Accuracy: relative error ~0-5%; absolute error ~-0.5/-1.5 cm.
Precision: standard deviation ~0.1-0.5 cm.
3.5.2. Software
The tablet is operated under Arduino. The sketch running it is included in Annex 2.
The code is based around the following main functional blocks:
Geometry and Sensor Properties.
The dimensions of the tablet, and the number, position and orientation of the sensors
are defined, together with the physical properties of the sensors relevant for the
measurements.
The ambient temperature is also provided here.
Readings
All the sensors are read in sequence, and then the calculations proceed for the group
of results.
Data Filtering
1

Refer to https://app.box.com/s/4nafz9scusuk4kq1628u for details.

Scanning Tablet with US Sensors R0

6/8

In order to control measuring errors each sensor is requested to make 10


consecutive readings. These results are then filtered for outliers and inconsistencies
(median).
Calculation of Intersection Points
A routine calculates the intersection points for all pairs of sensors for which readings
have been received. For each pair of readings there can be no intersection, one or
two intersection points.
Check for Inconsistencies
The results are filtered for the following:
measurements outside the scanning frame of the tablet;
intersections outside the scanning tablet of the tablet;
incompatible results
Output
Output is provided in two forms:
serial monitor coordinates x, y and object size,
RGB LED, where the coordinates (x,y) control the position in the color map, and
the light intensity is related to the object dimension,
3.6. Operation
Once the device is switched on and an object is placed within its vision field, it provides the
location of the object within the tablet frame plus the object size. This triplet (x, y, D) is
transferred to the serial monitor and are also converted and transferred to an RGB led
whose color is controlled by the triplet.
The positional information collected can be immediately put into other uses (f.eg. control of
lights, servos, etc.).
3.7. Actual Results
Despite the measures taken to smooth the distance readings, they are still variable. This is
compounded with the trigonometric equations, which are rather sensitive in a large portion
of the scanning domain. This could arguably be better controlled with a more careful
(clever) interpretation of the readings, especially when the pointer is within detecting range
of more than two sensors.
3.8. Next Steps
The following are potential development lines:
installation of sensors on servo motors this would allow the use of less sensors
while providing a continuous scan of the object;
use of sensors which have the emitters and the receivers separated (meaning that
they can be placed in different positions) and that allow the reception of the echo sent
from one emitter in several receivers this would allow higher accuracy and
resolution (at the expense of more calculations);
improvement of the object detection rules which is, arguably, the weakest point in
the sketch.

Scanning Tablet with US Sensors R0

7/8

4.

ANNEXES

4.1. Annex 1: Design Code


The code in C of the program used for the optimization of the design of the tablet (position
and orientation of the sensors) can be found in:
https://app.box.com/s/erhwf7f3r03zu68f33kp

4.2. Annex 2: Operating Code


The Arduino sketch and libraries used for the operation of the tablet are uploaded in:
https://app.box.com/s/y5mv062wvw6uzmirzdmm

Scanning Tablet with US Sensors R0

8/8

Вам также может понравиться