Sensors detect an input event and control an output event. The output often requires different timing than that of the input event. Sometimes several inputs must jointly produce an output event. In other words, logic alters the raw sensor signal so that it is directly useful for controlling local action in response to sensed events (Ouzounov et al., 2006). A sensor is an interactive application; it expresses interest in an event by defining a sensitive ‘region' and an event type. For example, if a sensor wishes to receive events directed to a geographical object, it can define its region to coincide with the area covered by the graphic object. Alternatively, a sensor could define a different region, for example, one which covers only the corner of the bounding box for the graphic region.
There are different types of sensors such as visual and infrared sensors, thermal and seismic. These sensors check several of conditions which include humidity, temperature and the object characteristics and their motion. These various types of sensors are used in some applications such as fire or smoke detectors, flood discovery, including temperature, humidity in the air, vehicular velocity, soil makeup, pressure, noise levels or mechanical stress levels (Saraf et al., 2008). It can further be used in chemical processing, health, military, and disaster mitigation scenarios. Many home appliances such as refrigerators or vacuum cleaners also include sensors.
The aim of this paper is to integrate these sensors with different circuits and code them on an Arduino, which will be attached to PC using USB. The experiments are supposed to be of success after coding. Sensor technologies are rapidly discussed in production design and science, embracing development in electronic, mechanism, photonics, chemistry and biology. The presence is widespread in everyday life; they sense sound, movement, optical or magnetic signals. The demand for portable and lightweight sensors is relentless, filling various needs in consumer electronics, biomedical engineering or military applications.
ULTRASONIC AND INFRARED SENSOR
Distance sensors are important sensors. It is often regarded as an "eye" for the functioning apparatus. Distance sensors are useful as we can make systems that react based on how close we are to them or based on various obstacles. There are two common technologies used in mature distance sensing. An infrared sensor such as classic sharp IR and ultrasound sensors usually called sonars (Sahetapy-Engel et al., 2008).
An Arduino board connected to a computer via USB
One LED
A Sharp infrared proximity sensor such as the GP2Y0A21YK
Connecting a sharp IR has three pins. One is the power input which is connected to 5V. Another is the ground that is connected to one GND pin. Lastly, here is the analog input pin that needs to be connected to an analog input. Here A0 is used.
Small illegal connections are then imitated in the A0. Then direct connections are made with the Arduino without any resistor. For low power LEDs, there is a problem, and neither the Arduino nor the LED will be affected. Pin 11 will be used after plugging the negative terminal to GND and the other terminal to one of the pins close by. Among the possible implementations when using pin A0 as the analog input and pin 11 as the LED output.
Figure 1: Arduino IDE setup(Ouzounov et al., 2006)
Figure 2: Arduino IDE (Johns & Martin, 2008)
The following code will read the value of the sensor, print it on the serial connection and vary the LED intensity using PWM to match the distance
int sesnorPin=A0; // Declare the used sensor pin
int LED= 11; // Declare the connected LED
void setup( ){
Serial.begin (9600); // Start the Serial Connection
}
void loop( ){
//Read the analog value of the sensor
int val =analogRead(A0);
//Print the value to the LED using PMW
analogWrite(LED, val/4);
//wait for a little for the data to print
Delay(100);
}
Sharp IR Sensor will measure distance using an infrared beat that reflects the object before it. The infrared beam is projected at a small angle (Johns & Martin, 2008). When it hits an object, it is reflected at a different angle, depending on the distance to the object. The sensor detects thing angle and outputs the distance. The two variable for in-built LED and for the used analog part that connects the sharp IR sensor are presented in
int sensorPin=A0;
int LED =11;
In the setup ( ) function, the serial connection is initiated. There is no need of declaring the LED pin as output because it used an analogWrite( ) function which does not require a deliration
CIRCUIT INFRARED SENSORS BY JUMPER WIRE ON BOARD
Figure 1: Circuit layout of one LED and the recovery module on an infrared sensor(Warren & Molle, 2011)
In the Figure, when the Left-LED Enable signal is High, the low side of the IR LED is pulled to ground. This forces a voltage drop across the LED at the frequency of the 5v to ground oscillating signal. In other words, the LED produces IR lit pulses at 38KHz. Using a 38Khz signal helps reduce no use for other ambient light sources.
Since the IR detector has internal and passes filter centered at 38KHz, the detector is most sensitive to the transmitted oscillating light. The 5v pull-up resistor allows the IR Detector's open collector output to pull up the SOUT signal to High when no IR output is sensed. To detect right and left differences the right and left LEDs are alternately switched so that the detected signals are not ambiguous. If both the left and right LEDs detect an objective at the same time, the object is in front of the sensor.
If the IR sensor built from parts, a hardware timer implemented on the UP 1 board could be used to supply the 38-40 kHz signal (Warren & Molle, 2011). Assuming UP1-bots are equipped with IR sensor modules, it is also possible to use that module as a serial communication link between robots. Transmission using IR LED occur and other receivers using IR sensor. To prevent interface, the IR LEDs are turned off on the bot as a receiver. Just like an IR TV remote, the IR LED and sensor must be facing each other. The 38Khz modulation limits bandwidth on the IR signal and the filters inside the IR detector.
Arduino IDE on Circuit Infrared sensors
Figure 2: Arduino IDE illustration (Banzi & Shiloh, 2014)
As indicate in Figure 2, and printed on the interfaced board, there are 14 pins on 1 side of the board labeled Digital that is numbered from 0 to 13. Of these, two are used for serial communications through USB for programming and other forms of communication. These pins are numbered 0 and 1 and are marked RX and TX respectively. Anything connected to these pins may affect or be affect by serial communication (Banzi & Shiloh, 2014). Pin 13 has a resistor and LED correlated to it on board so that it can be used for testing, diagnostic and other forms of blinking. Six of the digital pins can also act as analog outputs using pulse width modulation. Pins 3, 5, 6, 9, 10 and 11 are on the Arduino IDE and are marked on the interface board with the tiled symbol (~). On the other a different side of the board is six additional I/O pins labeled as Analog In, numbering AA0 through A5. These pins are connected to the microcontroller's analog to digital converter ADC for interpreting incoming analog signals, although they can additionally be utilized as additional digital inputs and outputs.
Each I/O pin operates in a range of 0 to +5 VDC or volts direct current. A range of 0 to +2V is said to be off or Low while anything over +3V is said to be on or high. A circuit connects to the Arduino I/O pins needs to have a high or positive side connected to power +5VDC, some forms of lead and a low or negative side connected to ground. How a circuit is physically connected to the Arduino IDE or in which direction determines how the I/O pins can be used and which side of the circuit is connected to the Arduino IDE. Each pin can either source or provide a positive biased current, or sink, to provide a negatively biased current, up to 40 milliamps each. Typically, most Arduino IDE circuits are designed so that they source current, even though these are times where the sinking current is necessary.
Figure 3: An example of Sourcing Current (Banzi & Shiloh, 2014)
Figure 4: An example of sinking current (Banzi & Shiloh, 2014)
It is important to recall that every time our circuit has a connection to ground that this must be common to the Arduino and every connected device will behave very erratically. What this implies is that the ground pins of the circuit must somehow connect to the ground pin son the microcontroller. Likewise, anytime we use a pin for an input that is not connected to anything, it is identified as a floating pin, and it can provide seemingly randomized results as the pin picks up electrical interfaces and noise from surrounding environment
Inside the parenthesis of the function are two values separated by a comma. The first value is the number of the pin that is being set up. This could be some variables with the value mapping from 0 to 13 or A0 to A5 when using the Analog in Pins for digital I/O, corresponding to the pin number printed on the interface board. The second value is the state that is needed for the print to function with the circuit and can include either of two predefined constants: Input or Output. Using INPUT in a pinMode ( ) function will place the pin in a load on the overall circuit. This is good for reading to receive sensitive inputs without affecting the sensor in any way.
A digital input pin is only sensitive to tow variables HIGH and LOW. By using OUTPUT, the digital pin is placed in a state of low impedance and can, therefore, source or sink a respectable current, considering the size of such a little chip, of 40 milliamps to other circuits. This is enough current to light up an LED brightly while providing little resistance to the rest of the circuit.
The first line sets the speaker pin to an OUTPUT state so that it is possible to connect power an external device. The second line establishes the sensor pin as an INPUT, making it ready to recover signals from a low power sensor or other input. For every digital I/O pin that is necessary for use, there has to be an established mode once in the program, usually done in the setup ( ) function. This can get a bit tedious in case we choose to use all 14 digital pins as outputs. Instead, we use a for loop to set up each pin as an output for example
For (int i=o; i<14; i++) pinMode( i, OUTPUT);
This line is a simple for statement used to repeat a line of code a total of 14 times, placing each digital pin into an OUTPUT mode. This could come in handy and save some typing if one is catching up with 14 LEDs to a single Arduino IDE.
After establishing an OUTPUT, it is then possible to turn the pin on or off using digitalWriter( ) function in the syntax
digitalWrite(pin, state)
There are two statements that are used with this function that include pin number and state. Just pinMode( ), this could be a number or variable with the value ranging from 0 to 13 or A0 to A5. The second statement is the state of the output pin that corresponds to the two predefined constants: HIGH and LOW.
HIGH is the state of sourcing current and provides a connection to +5 VDC, LOW and the default of any output pin, in the state of sinking current, providing a connection to ground. If the circuit is configured to source current for a circuit, setting the pin HIGH is turning the circuit on, while setting the pin LOW turns it off (Benet et al., 2002). This will be reversed if the circuit is more of an output pin needs to sink current to tune on the circuit. Just like it was done with pinMode ( ) function, it is possible to turn on or off all the pins using an FOR loop using the following code
For (int i=o; i<14; i++) digitalWriter(i HIGH);
Delay (1000);
For (int i=o; i<14; i++) digitalWrite(I LOW);
Delay (1000);
For (int i=o; i<14; i++) {
digitalWriter(i, HIGH);
delay(1000);
}
For (int i=13; i>=o; i--) {
digitalWrite(i, LOW);
delay(1000);
}
The first loop will turn on each of the 14 pins individually, pausing for 1 second between each one, starting with pin 0 and ending with pin 13, until all of the pins are on. The next loop with pin 13 and ends with pin 0, turning off each pin individually with a 1 second pause in between each one until none of the pins are on.
In conclusion, because there are simply two conditions possible when reading or writing digital inputs and outputs, --high and low, the state of change can predictably be identified, where a pin changes from high to low or low to high or even to count these changes. To detect the state of change on the digital input, there is no need of knowing the precise state that the pin is in. Rather, there is a necessity of acknowledging a pin has changed from one state to the other. For this to take place, there is the necessity of comparing the pins current state with the state of the on the last time it was read. Incase checking is done on the input and its high, but the last one check was low, then the button has been pressed. On the other hand, in case the inputs are checked and its low by the last time it was checked it was high. Then the button is no longer being pressed. By looking for this change consideration of what is taking place is known as edge detection because all that is observed is hen the state changes from one condition to another.
References
Ouzounov, D., Bryant, N., Logan, T., Pulinets, S., & Taylor, P. (2006). Satellite thermal IR phenomena associated with some of the major earthquakes in 1999–2003. Physics and Chemistry of the Earth, Parts A/B/C, 31(4), 154-163.
Saraf, A. K., Rawat, V., Banerjee, P., Choudhury, S., Panda, S. K., Dasgupta, S., & Das, J. D. (2008). Satellite detection of earthquake thermal infrared precursors in Iran. Natural Hazards, 47(1), 119-135.
Sahetapy-Engel, S. T., Harris, A. J., & Marchetti, E. (2008). Thermal, seismic and infrasound observations of persistent explosive activity and conduit dynamics at Santiaguito lava dome, Guatemala. Journal of Volcanology and Geothermal Research, 173(1), 1-14.
Warren, J. D., Adams, J., & Molle, H. (2011). Arduino for robotics (pp. 51-82). Apress.
Banzi, M., & Shiloh, M. (2014). Getting Started with Arduino: The Open Source Electronics Prototyping Platform. Maker Media, Inc..
Benet, G., Blanes, F., Simó, J. E., & Pérez, P. (2002). Using infrared sensors for distance measurement in mobile robots. Robotics and autonomous systems, 40(4), 255-266.
Johns, D. A., & Martin, K. (2008). Analog integrated circuit design. John Wiley & Sons.