







CIRCUIT EXPLANATION:





Overview:

The circuit consists of different building blocks. A proximity sensor is connected to an Op-Amp comparator through a low-pass filter. The op-amp is then connected to a 555 timer monostable. The output from this will go to 2 OR gates, together with the output from two identical IR Emitter/Detector pairs (both going into the OR gate through op-amp comparators). The output from the 2 OR gates goes into ports 1,2EN and 3,4EN of an H-bridge that controls the motors. The output from the 555 timer also goes into 3A (through an inverter) and 4A (directly). Let’s look into every circuit building block into detail, to understand it properly.





IR Proximity sensor, Low pass filter and Op-Amp comparator.

The IR proximity sensor is an analogue transducer that converts an input of proximity into an analogue voltage signal. In our robot, it is used to identify obstacles in front of the robot. Since the IR Proximity sensor uses triangulation to determine the distance of an obstacle, it does not pick up any difference in colour or material: this makes it much more precise and reliable than an IR emitter/detector pair for obstacle detection.

The IR proximity sensor is connected to a Low Pass Filter, which allows activating the consequent building block only when the obstacle has been in front of the robot for more than a specific amount of time, calculated with the following equation:





T=R1∗C1





The low pass filter is in fact composed of a resistor (R1) and a capacitor (C1). When the proximity sensor detects an obstacle, an input voltage is applied to the sub circuit: the capacitor C1 has little resistance at first, and allows maximum current to flow through it, so that there is no current going into the op-amp comparator (hence the robot acts like no obstacle was detected). However, the capacitor now starts to charge up, and once it is fully charged (the time that it takes for this to happen is determined by the equation above) it blocks any current flowing through it (acts as an open circuit). Hence the op-amp comparator gets a high input voltage (robot detects the obstacle and the consequent sub circuit is activated). The op-amp comparator will then turn the analogue signal into digital and, because it is wired up as an inverting op-amp comparator, when receiving the high input voltage it is going to send a low output voltage to the next segment (i.e. the 555 timer receives a low output when an obstacle is detected). The op-amp comparator functions by exploiting the op-amp’s extremely large open-loop gain to produce a digital output. This output depends on the position of the input voltage with respect to a pre-determined threshold set by the potentiometer.





555 Timer Monostable and Inverter.

The 555 timer monostable can be used to get an output of a certain duration in response to a brief input. In our case, the brief input is the detection of the obstacle, and the output will be the change in direction of the right wheel of the robot, to make it spin by 180°.

As explained above, the input to the 555 timer (i.e. the output of the op-amp) will be low when the robot detects an obstacle. This results in grounding Vin, which will activate the trigger, cause Vout to go HIGH and switch off the discharge transistor. C2 now starts to charge up and it will keep doing so until it reaches 2/3 of Vs: the threshold is now activated and output goes LOW. This turns the discharge transistor back on, which leads to C2 starting to discharge. The time for which Vout will stay HIGH is determined by the following equation:





T≈1.1∗R2∗C2





This time is extremely important because it is the time for which the robot will be rotating, and it has to be calibrated so that the robot spins by 180° (see Justification of Component Values).

To allow the right wheel to change direction of rotation based on the 555 timer monostable input, we need to set up an Inverter going into pin 3A of the H Bridge. By doing this, when the 555 timer output is HIGH (obstacle is detected), the input to 4A will be HIGH, but the input to 3A will be LOW. This, because of the internal structure of the H bridge, will cause the wheel to change direction.





IR emitter/detector pairs.

The IR emitter/detector pairs are used to sense the colour of the floor on which the robot is driving. The goal set by the brief is for the robot to follow a white line: this is achieved with two pairs of IR emitter/detectors set on the sides of the robot, facing the floor. The basic behaviour of both sensor is that the motor will keep going when the sensors see black, and it will stop when they see white. This allows the robot to rotate when the white line changes direction.

The IR emitter/detector pair is an analogue component that converts voltage into light (emitter) and light into voltage (detector). The emitter sends IR rays towards the ground, and the detector is able to pick up the different colours based on how much of the IR rays are reflected by the ground (based on the concept that white reflects more light than darker surfaces).

Both pairs are connected to op-amp comparators to turn the analogue output of the sub-circuit into a digital one. Also, the op-amp comparators are wired up to invert the output signal; hence when the floor is dark, the output is going to be HIGH, whereas when the floor is white, output is going to be LOW.





OR GATES.

With the previously explained circuit blocks, we have all the outputs we need to make our circuit work. However, there is one issue that we need to solve. In fact, when the robot detects an obstacle and starts rotating, the IR emitter/detector pairs would stop the robot somewhere during the rotation, because they would detect the white line on the floor. We need to find a way to make sure that, while the robot is rotating, the colour-sensing part of the circuit is deactivated, and we can achieve this with Boolean logic, using two OR Gates.

An OR gate is made out of 2 (or more, depending on the number of inputs) diodes, and a resistor. The diodes have inputs on their anodes, and their cathodes are connected together to drive the output. The resistors are connected from the output to ground to provide bias current for the diodes. This allows the OR gate to work properly, i.e. its output will be HIGH only when either (or both) of the inputs are HIGH. This is shown in the truth table below:

