Lawrence Technological University
College of Arts and Science
Department of Mathematics and Computer Science

## Notes for a custom NXT sensor with an Arduino

### by John M. Miller M.D.

Last year we considered how to make an NXT sensor that would be an alternative to the ultrasonic sensor that comes with the NXT kit. This year we will try to build another custom sensor. This time the sensor will sense the area of a circle by examining just a piece of the circumference. The NXT will roll up to the edge of the circle and then the custom sensor's robot arm with a light sensor at the end will sweep out and measure the degrees of arm rotation, φ, between where the arm finds the edge on the left and where the arm finds the edge on the right. The area is π × r2 where r is found comparing the similar triangles abc and ade.

The same algorithm could be followed with just the NXT, another motor and another light sensor. However, this is an experiment where, instead of adapting existing sensors to our purpose, we will make our own sensor with hardware and software that is optimized to solve our particular problem.

Next we need a practice area. You can just feed the following Postscript to any Unix or CUPS printer. If you have only Windows then just print this practicearea.pdf version instead. This is a lot of black ink. If you don't have access to a laser printer and only have an ink jet printer, you might consider Kinko's.

```%!PS
% practicearea.ps
/inch {72 mul} def
newpath
7 inch 5.5 inch 6 inch 0 360 arc
closepath
fill
showpage
```
The expected answer can be calculated using interactive Ruby:
```\$ irb
1.9.3p327 :001 > # Area of a 12 inch diameter circle in square millimeters.
1.9.3p327 :002 >   (Math::PI * (6 * 25.4) ** 2).round
=> 72966
```

Revised March 2, 2013