Midterm Reviewer In Robotics II PDF
Document Details
Uploaded by LyricalPanda
Tags
Summary
This document is a midterm review covering digital and analog signals, along with different types of sensors and actuators. Practical examples of program code and sensor functionality are included.
Full Transcript
MIDTERM REVIEWER IN ACTUAL Gas Sensor Pins ROBOTICS II 1ST PIN: Analog Out 2ND PIN: Digital Out 3RD PI...
MIDTERM REVIEWER IN ACTUAL Gas Sensor Pins ROBOTICS II 1ST PIN: Analog Out 2ND PIN: Digital Out 3RD PIN: Negative of the breadboard (GND) LESSON 1: DIGITAL & ANALOG SIGNAL 4TH PIN: Positive of the breadboard (VCC/5v) Digital Signal Serial.begin() - a type of signal that uses clear, separate - line of code is used to establish communication values like 0 and 1. between an Arduino board and a computer, enabling - are effective at avoiding noise-related data transfer and serial communication. errors. - Default Baud Rate: 9600 - it ensures clear on/off commands. Program Code of Gas Sensor: Analog Signal const int gasSensor = A0; - type of signals are used in devices that need to measure or represent continuously varying signals. void setup() { Serial.begin(9600); LESSON 2: VOLTAGE-OUTPUT SENSOR pinMode(gasSensorPin, INPUT); } Sensor - devices that can sense or identify and void loop() { react to certain types of electrical or optical int gasSensorValue = analogRead(gasSensor); signals. Serial.print("Gas Value: "); Serial.println(gasSensorValue); Actuators delay(1000); - devices which perform an “Output” } function and are used to control some external device, for example movement or sound. LESSON 3: TEMPERATURE SENSOR Voltage-Output Sensor Temperature Sensor - type of sensor that measures a specific - is an electronic device that measures the physical property, like temperature, light, or temperature of its environment and gas concentration, and converts that measurement into a corresponding converts the input data into electronic data. voltage signal. Types of Temperature Sensors Accelerometer Sensor 1. TMP36 - is a device that measures acceleration - making it useful for both indoor and forces such as gravity, motion, and outdoor temperature measurements. It’s vibration. often used in environmental monitoring and Gyroscope Sensor HVAC systems. - is a device that measures the rate of 2. DS18B20 rotation or angular velocity around one or - Great for digital projects needing multiple more axes. sensors. 3. NTC Thermistor Gas Sensor - Ideal for detecting temperature changes. - a device that detects the presence or concentration of specific gases in the air. Commonly used in wearable health devices and digital thermometers to measure body temperature. 4. DHT11/DHT22 Program Code of LM35 - Provide both temperature and humidity data. void setup() { analogReference(INTERNAL); - They’re used in weather stations, Serial.begin(57600); greenhouse monitoring, and other projects } where you need to monitor environmental conditions. void loop() { 5. PT100 float temp = analogRead(0); - High accuracy for industrial use. temp = temp*0.1074; - Monitoring the temperature of Serial.print("Temp Value: "); machineries of industrial factories to avoid Serial.println(temp); overheating. delay(1000); 6. Thermocouples } - Measure extreme temperatures in tough environments. analogReference() - this function sets the reference voltage for LM35 Temperature Sensor the analog-to-digital converter (ADC), which - Simple, easy-to-use sensors for basic is responsible for converting the analog temperature measurements. Also it voltage (from the LM35 sensor) to a digital measures and detects the temperature value. around it. - LM stands for "Linear Monolithic". Baud Rate for LM35 Temperature Sensor: 57600 o Linear - means that the relationship between the input (temperature) and Code to convert ADC to Degree Celcius output (voltage) is direct and - temp = temp * 0.1074; proportional, making it easy to predict and calculate. o Monolithic - it contains all the LESSON 4: RGB LED necessary components to measure RGB LED temperature and produce an output voltage, all in one small chip. You - it consists of three tiny light-emitting diodes— don’t need to connect it to lots of other red, green, and blue—housed together. parts to make it work. - It can be used to measure temperature Placement of the 3 Diodes anywhere between -55°C to 150°C. - the close placement of the diodes/LEDs allow them to mix seamlessly, appearing as a single color to our eyes. LM35 PINS 1ST PIN: Positive of the breadboard (VCC/5v) Pulse-Width Modulation (PWM) 2ND PIN: Analog Out - is an Arduino technique / component that 3RD PIN: Negative of the breadboard (GND) controls the brightness of the red, green, and blue diodes. Use of the function analogWrite() in RGB LED - analogWrite() allows you to output a range of values in PWM which corresponds to different levels of brightness. You can mix different intensities of red, green, and blue to produce a wide range of colors. - We do not use digitalWrite() in RGB LED LESSON 6: POTENTIOMETER because if you use this function, it can only turn a LED fully ON (HIGH) or OFF (LOW). Potentiometer This means you cannot control the - is a physically adjustable variable resistor brightness, as the LED is either lit or not. with three terminals. - The two end terminals are connected to the LESSON 5: PHOTORESISTOR ends of a fixed resistor. The left end terminal is the NEGATIVE terminal, while Photoresistor the right end terminal is the POSSITIVE - also known as a photocell or light- terminal. dependent resistor (LDR), is a resistor that - While the middle terminal, also known as allows one to interact with the external the wiper, moves over the resistive element environment using light intensity. or terminals. - The placement of the wiper determines the How does a Photoresistor work? output voltage of the potentiometer. It - INTENSE Light == HIGH Electric Current == mainly functions as a variable voltage LOW Resistance. (when the environment divider. gets lighter, its resistance decreases) Voltage Divider - a circuit which makes a large voltage into a - LESS INTENSE Light == LOW Electric smaller one by using a pair of resistors. Current == HIGH Resistance. (when the - Adjusting the wiper of a potentiometer environment gets dark, its resistance affect the output voltage, because it increases) adjusts the ratio of resistance across the terminals. Two Types of Resistor 1. Intrinsic Resistor How does a Potentiometer work? - this type can absorb, detect, and most - It works by varying the position of the sensitive to regular light we see every day wiper. (like sunlight or a light bulb, light that is - If you turn the wiper the left, the visible to our naked eye). current/voltage decreases as the resistance increases. 2. Extrinsic Resistor - If you turn the wiper the right, the - With this type, the gate only opens when a current/voltage increases as the different type of light, called infrared (which resistance decreases. is invisible to the naked eye but can be felt as heat), shines on them. - This makes them useful for things like night- vision cameras or remote controls that use infrared light. Use of the function analogRead() in Photoresistor - If the analogRead() returns a low value, it means the photoresistor is exposed to darkness, leading to a higher resistance and a lower analog reading. - If the analogRead() returns a high value, it means the photoresistor is exposed to intense light, leading to a lower resistance and a higher analog reading. LESSON 7: LIQUID CRYSTAL DISPLAY (LCD) I2C 16X2 LCD PROGRAM Electronic Visual Display 16 COLUMNS - also known as a screen, is a display device that displays images, texts, or videos that are being transmitted electronically to create a permanent record. 2 ROWS Types of Display 1. Electroluminescent Display - a type of flat panel display that uses electroluminescent materials to emit light when subjected to an electric current. Use of lcd.setCursor 2. LED Display - a type of display that uses tiny light-emitting The lcd.setCursor(column, row) function in diodes (LEDs) to produce images, text, or Arduino is used to position the cursor on an LCD video. Each LED in the display acts as a display. It sets the location where the next text or pixel. character will appear. - LED display is best if you need a display for a high-visibility OUTDOOR installation, LCD SAMPLE PROGRAM: considering factors like brightness and durability. #include 3. LCD Display #include - It consumes very little power, making it ideal for use in all kinds of electronic devices LiquidCrystal_I2C lcd(0x27, 16, 2); that rely on batteries for power. - The display is still good even for a brighter void setup() { INDOOR ambiance. lcd.init(); 4. Quantum Dot Display lcd.backlight(); - The light is provided earlier in this type of display, resulting in more effective displays, improve color accuracy and lcd.setCursor(0, 0); brightness. lcd.print("GOODLUCK ON YOUR"); 5. Flexible Display - This type of display is to create foldable lcd.setCursor(0, 1); phones, e-readers, curved televisions, and lcd.print("EXAM, NAKSHOES!"); other products. delay(1000); } I2C 16X2 LCD PINS 1. GND - Ground pin to be connected to the ground void loop() of the Arduino. { } 2. VCC - Power supply pin to be connected to the 5V of the Arduino. 3. SDA - The Serial Data pin that is used to transmit and receive data. I 4. SCL - The Serial Clock pin that is used as a timing signal. OUTPUT OF THE PROGRAM lcd.setCursor(0, 0); // 1st column, 1st row lcd.print("GOODLUCK ON YOUR"); lcd.setCursor(0, 1); 1st column, 2nd row lcd.print("EXAM, NAKSHOES!"); delay(1000); Wishing you all the best on your midterm examination, my dear nakshoes! Remember that you are capable of more than you know. Trust yourself and your abilities. You will shine! Papasa with flying colors! Yes na yes for you! - Meme Klyde LET’S TRY TO CHANGE THE SECOND NUMBER TO CHANGE THE ROWS lcd.setCursor(0, 1); // 1st column, 2nd row lcd.print("GOODLUCK ON YOUR"); lcd.setCursor(0, 0); // 1st column, 1st row lcd.print("EXAM, NAKSHOES!"); delay(1000);