Wednesday 22 February 2017

Week 3

Summary of week three's activities:
The week was mainly focused on adding the object sensor function to the temperature-speed function that can detect the distance from the obstacle/object. Initially, our first attempt was to use an IR emitter and sensor pair to transduce the distance signal as this link (Arduino IR sensor tutorial) and another link show. The IR emitter will emit the IR light which will be further detected by the receiver. Once the light path is blocked, the voltage will be set high immediately. The fundamental circuit we used for IR distance detecting and converting is shown in figure 1 and figure 2 shows the corresponding actual circuit we built. However after test, the IR receiver that we ordered can only detect a discrete IR impulse as an IR remote does. In the end, it seems that this application cannot achieve the function as we expected initially. 

Figure 1: Arduino UNO connection for fundamental IR sensor with obstacle detecting


Figure 2: Actual connection circuit for IR obstacle detecting circuit


An alternative distance detecting is to use a Ultrasonic device which can automatically send out an Ultrasonic wave. The Ultrasonic wave will be reflected back to the kit so that the distance can be calculated through reflecting time. The Arduino schematic is shown in figure 3. It is a trick when programming the code for Ultrasonic detecting, however it would be much easier if a NewPin function/header file was installed firstly into the Arduino library. Figure 4 shows the working detail of this Ultrasonic distance detector by using Serial display function in Arduino code assembly. Consequently, our second  method which uses the Ultrasonic emitter and receiver pairs was proven to be working as intended with high accuracy on distance measurement.


Figure 3: Fundamental Arduino UNO schematic for Ultrasonic distance detector circuit



Figure 4: Working test for Ultrasonic distance sensor

After testing the Ultrasonic kit properly, we then added the device on the temperature-speed control circuit coherently and merged the code for distance detector within the primary code. In order to harmonise these two functions, here, we summarised the relationship involved for distance detecting. We assume that roughly, when the object (for example, cake) is transmitted approaching to the one end of the belt, a buzzer should be triggered to alert the costumers. The frequency of buzzer should be set to be inversely proportional to the distance which means that the narrower the distance is remaining, the shriller the sound will become. The frequency of the buzzer will be controlled automatically by the distance $x$ between 0 to 30$cm$:
$$f(Hz) = \left\{ \begin{array}{rcl}\frac{1}{2\times (x^2 + 25)}& \mbox{for}& 5 \leq x \leq 30 \\ 0 & \mbox{for} & x < 5\end{array}\right.$$
The second equation of the buzzer frequency indicates that if the distance between the obstacle and the margin is smaller than 5$cm$, the buzzer will be triggered until the distance being resettled. Besides, the motor speed under this circumstance should also be 0.


In order to control the frequency of the buzzer in this circuit, two delay functions are invoked as:
digitalWrite(13,HIGH);
      delay(buzzervalue*buzzervalue+25);  // adjust this value for your convenience
      digitalWrite(13,LOW);
      delay(buzzervalue*buzzervalue+25);  // adjust this value for your convenience
Since the period of buzzer is set to be $2 \times (x^2 + 25)$, so the high pulse and low pulse of the sound should be maintained by  $(x^2 + 25)$ seconds. Here, 13 represents for the Arduino Pin which connected to the positive Pin of the positive buzzer.
The whole circuit is shown in figure 5 below:


Figure 5: Actual Arduino connection circuit for temperature-speed function 
with the application of temperature sensing, 
speed control and distance control


Objectives for the upcoming week:
  • Finish implementing the ultra sonic sensor along with its code.
  • Start building the physical conveyor belt for demonstrating purposes.
  • designing the poster and what materials should be included in it.


No comments:

Post a Comment