## Sensors

### Pages

It is likely, or indeed desired for your mouse to have lots of sensors. There are different types of sensors people have used in their mice over the years. I will only go into detail in the type of sensors we used for our mouse and only briefly mention other sensors.

### Odometry

If you aren't using stepper motors you will need a method for measuring your motor position. This is your most important sensor. Don't get this right and your mouse will start running into walls, running squares short, or just burn out. Be sure to get two read outs from your odometry; number of ticks the wheel has ticked, and the direction the wheel rotated in.

There are IC packages which give you a pulse and direction every tick your odometry makes, I will mention more on this later.

I will say this in bold type, connect your odometry tick pulse signal up to interrupts on your microcontroller. This will help to ensure you count every single tick pulse and not miss any. Depending on your mechanical period, missing even one can put your mouse way off course.
Your odometry gives you your displacement, and you will need to differentiate it to get your velocity. Directly differentiating a signal like this will be noisy and be not much use to you, the higher the sampling rate, the worse this will be. One way to get around this is to use an IIR filter on your velocity. An IIR filter will give you zero steady state error and will cost you a small phase delay. Be careful with an IIR filter as they can be unstable! (see filtering velocity).

Another way around is to simply count the time between odometry pulses. This will give you a steady state error when returning to zero velocity! Remember velocity is $\frac{dx}{dt}$ so you will need to remember that time is usually your independent variable, and you have just made it your dependent. This means a larger period is a slower velocity, and a shorter period is a faster velocity, i.e. take the inverse of $dt$ (be careful in doing this on a microcontroller).

You may also elect to not use velocity at all, this may be because your sensors are really bad. If this is the case, go back to square one and get better sensors, because without them you still aren't going to be able to achieve position control. You will want precision of 6 mm or better. With wheels of radius 30 mm, this is only 3.5 degrees, something more than achievable.

A readily available IC package which performs odometry with a decent mechanical period is the Honeywell HLC2705 Encoder Detector. Just a note of caution, these sensors don't like reflective metering off a white/black piece of paper. They do however like sensing through an overhead transparency or through holes drilled into the wheel. Many groups had problems with holes drilled into wheels, whereas we found transparencies to be reliable when kept within the mechanical period of the sensor.

### Wall Sensing

There are different type of wall sensors, the simplest are just top-down IR sensors. Other types include side looking sensors (don't use unless your maze is reliable), and some have even used fancy sensors such as sonar, and vision. If you want something that is going to work, go with top down sensors.

#### Top Down Sensors

You will probably have seen from other mice that the way to do this is to put a couple on each side, and one or more out the front. However it isn't that simple, there are a number of design constraints and decisions that need to be made. Your walls are 12 mm thick so you will want to be able to always see at least one (if it is there to be seen).

The other is that your mouse has a width constrained to 250 mm, use every mm that you can get away with, this should give you between 6 and 10 sensors on each side, looking down. The more the better, and the more reliable your mouse will be. Your mouse is no use unless it knows exactly where it is in a cell, if it looses sight of any walls that are there, it could spell disaster for your mouse.

If you are planning on taking on diagonal movement, then you will need the full 250 mm width of mouse to get sensors right on the tip to properly sense your diagonal movements.