
Building the IR circuit:
The primary purpose of the infrared (IR) circuit is to detect objects in front of the micromouse
and avoid them (working in tandem with the obstacle avoidance software) by using
modulated infrared light at 40 KHz pulsed at 20Hz. What this means is that the infrared
circuit will send out light with a frequency of 40KHz. However, this process happens 20
times per second rather than being a constant occurrence with no “breaks”. This allows for
a significant reduction in interference such as “noise” from other light and electrical signals
as only signals with a 40KHz and 20Hz pattern will be detected by the sensors. This light is
sent out by an infrared LED and will be reflected off the surface of an obstacle and will be
detected by one of the two TSOP4838 infrared sensors. When the sensors detect something,
it will be visually represented by the lighting of one of the LEDs
The IR circuit was translated from the circuit diagram seen in our handout document and
constructed on a breadboard to test and replace components when needed (especially the
infrared sensors themselves).

Testing the circuit and sensors:
To ensure that the IR circuit was working as intended (i.e to make sure that the correct pulses
were being emitted from the LED), a Rhode and Schwartz oscilloscope was used to check
the waveforms were checked at specific points on the circuit. This also allowed us to locate
a problem easier, for example if the plots for A and B were correct but C wasn’t it is more
than likely that the error occurred between those points.The trace at point A is a 20Hz square wave and acts as an outline for when the other signals
should be starting and terminating. Point B shows a differentiated waveform caused by the
100 nF capacitor and as can be seen is charging and discharging within the time framework
set by the square wave. Waveforms C and D both show a square wave impulse; however, C
shows a full 40KHz impulse where D is a simple on/off (1/0) signal. If the sensor is detecting
an obstacle, it will show a value of 1 if not, a value of 0 will be shown. Finally, point E
represents the voltage threshold for detection.
When testing the sensors, it was noted that there was a large difference in the tolerances
between them. This caused the right sensor to detect an obstacle before the left. Therefore,
we gathered up multiple infrared sensors and measured the distance that they detected an
object and at what point they noticed an obstacle came into view from the side. This method
allowed us to find two infrared sensors that had similar tolerances and wouldn’t interfere
with each other.