Infra-red
Background
Infra-red emission is beyond the human capabilities of sight as it lies on the electromagnetic spectrum at 950nm. However, we can utilise this in the aspect of the micromouse’s “vision”, with the angular range sitting at 50 degrees the group’s decision was to load the micromouse with 4 infra-red sensors to gift the micromouse with enough vision to detect objects in the front and back of the mouse.
PCB MK I
Analysing the PCB it is clear that we began using 4 IR sensors (2 in the front and 2 in the back) this will gave us vision in both the front and the back of the micromouse. The base layer is made out of copper meaning the layer is grounded, this was beneficial since this made connecting things to ground was a lot easier.
Mr Moody’s schematic had to be slightly altered to allow the addition of more IR sensors, this was not difficult as the team decided it was just a matter of duplicating the necessary components in order to add 2 more sensors. The forward sensors had to be placed on the underside of the PCB because the pins were aligned so that if the receiver was placed on the top then it would be facing inwards. This was not an issue for the reverse sensors, on the other hand.
Testing the range of the IR sensors.
Identifying the range for the sensors was interesting, we discovered that some sensors could detect an object up to 600mm away. This would be helpful as we can utilise different range values for different modes. In combat mode it would be an advantage to detect an opponent further away to anticipate engagement, however detecting an object more than 400mm away is slightly overkill when the task is to avoid obstacles.
PCB MK II
Analysing the first PCB and how the micromouse worked, it was decided by the team that the rear sensors were not beneficial and did not warrant the current that they were using, this led us to the conclusion that they should be dropped from the mouse completely. This has allowed the back half of the PCB to be freed so that the LCD screen can be placed in this region. Using the schematic that Mr Moody gave us, building the PCB without the use of a global ground was relatively easy. The global ground only proved to be tedious and problematic when soldering so choosing to get rid of it will show a much neater and cleaner looking PCB.
The following image shows the second and final PCB, the team was very happy with the simple and neat outcome. Testing these sensors revealed that the left sensor was detecting objects at a further distance than its right-hand side counterpart. Overcoming this issue was fairly simple, using black electrical tape and fine tuning the code, we were able to equate the detecting distances of both the sensors.
The next image shows the solder side of our micromouse, at first glance it is easy to see that we removed 2 of the 4 sensors from the initial PCB, this required slight work as it was just a case of removing the second half of the circuit and making small alterations to the ground connections in order for the final IR circuit to be formed.
IR Receiver Data Sheet - http://www.vishay.com/docs/82459/tsop48.pdf
IR Emitter Data Sheet - https://www.vishay.com/docs/81011/tsal6400.pdf
Touch-bars
These sensors are responsible for detecting contact with an obstacle/opposition micromouse. When the touch bar does make contact the spring-loaded switch is pressed and the once logic 1 turns briefly to logic 0 and then returns, this informs the micromouse of contact and the mouse can act accordingly.
The connections to the switches and the polarity of the ports influences whether the micromouse changes from a logic 1 to a logic 0 upon contact or vice versa. The connections to the touch bars are as follows:
The following schematic shows an electrical circuit in which the switch operates, this clearly displays the way in which logic 0 is achieved when the touch bar hits an object.
D is the output at which the signal is sent upon contact. The next image shows the touch bars mounted onto the micromouse, these are connected to ports D2 and D3. These are then used in the code as described previously.
These sensors are used exclusively in the Combat and Obstacle Avoidance code. When the mouse is in Combat mode and the touch bars are engaged this means the micromouse has hit the opponent and then the mouse will reverse and accelerate into the opponent, triggering the touch bars again. However, in the Obstacle Avoidance code, the touchbars inform the mouse that it has come into contact with an obstacle and the mouse proceeds to manoeuvre into an obstacle free direction.
White Line Following
This was one of the main objectives of the micromouse, to be able to follow a white line that was 50mm thick. The advised circuit to use for this was an LDR and an LED. Since the base of the micromouse would shadow the surface that the mouse would be driving over, we can compensate for this by using an LED to shine light on the surface. If the sensor happened to be over a white line, the white light would be detected by the LDR and the mouse would act accordingly, on the other hand, if the LDR detects black then the mouse would act in a different manner.
The above diagram, courtesy of Dr Davies hand-out, shows exactly how the LED shines light which is then reflected by the varying surface and into the LDR. The software and hardware were arranged in such a way where the black light gave a low voltage and the white light gave a higher voltage. This would prove to be useful as the microprocessor can now distinguish between a black and white surface. We found this by testing the 4 different circuits at each corner.
B0 - B3 represent the different circuits at each corner by relative bits. As shown in the image the voltage difference is considerable. It was then appropriate to assume that coding this part would be straight forward, we set an instruction for each scenario that the mouse could be in. For example, if the mouse detected a white surface on a single or set of bits, then the mouse would turn in a direction where all bits would be at a low voltage. This translates to the mouse having adjusted to a change in the white line i.e a corner or where the mouse needs to recenter along the track.
The following images show the white line following in its active and non-active state. The placement of these circuits amongst the mouse was crucial however and they needed to be symmetrical. If the placement was unsymmetrical then detection on one side would be delayed or ahead of the other side and lead the mouse being unable to make sufficient changes upon detection of change in the white line.
When reviewing the captures found in the white line following part of the gallery, it can be seen that the first test proved that the mouse struggled to go around corners. Upon further inspection, it was down to the stiffness on one of the wheels, the placement on one of the LDR's and not enough detail in the code. To fix the issues was fairly simple, we loosened a nut on one of the wheels and replaced the LDR so all of the LDR was revealed to the reflected light. As far as the code was concerned, it required many more adjustments, alterations and additions to the basic scenarios to make the mouse more sensitive and reactive to a change in the line. This was demonstrated in the second capture on the white line following section in the gallery.