🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Unit3-Interfacing input output.pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

IoT using Arduino Topic: : Interfacing Arduino Uno with I/O devices Unit 3: Interfacing Arduino Uno with I/O devices Input/output devices Interfacing LED with Arduino Interfacing push button with Arduino Interfacing buzzer with Arduino Interfacing LC...

IoT using Arduino Topic: : Interfacing Arduino Uno with I/O devices Unit 3: Interfacing Arduino Uno with I/O devices Input/output devices Interfacing LED with Arduino Interfacing push button with Arduino Interfacing buzzer with Arduino Interfacing LCD with Arduino Arduino built-in LED The Arduino has an on-board surface mount LED that’s hard wired to digital pin 13. It’s the one with an “L” next to it: Arduino built-in LED // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } 4 Arduino built-in LED on TinkerCad Light Emitting Diode (LED) A LED is a semiconductor p-n junction device which emits light when forward biased. 6 LED Structure LED Types To attach external LED to Arduino Code for Fading LED  First for loop Initialization (brightness = 0): The loop starts by initializing the variable brightness to 0. Condition (brightness = 0 is true. Decrement (brightness -= 5): After each iteration of the loop, the value of brightness is decreased by 5 Push Button Switch A push button switch is a mechanical device used to control an electrical circuit in which the operator manually presses a button to actuate an internal switching mechanism. Push button switches can be classified as being normally open (NO) or normally closed (NC). Normally open (“OFF” position) switches complete the circuit when actuated, while normally closed (“ON” position) switches break the circuit when actuated. A push button SPST (single pole single throw) switch has just two terminals, so it can only open and close a single circuit. Push Button Switch Interfacing Push Button to Arduino Code to Interface Push Button to Arduino Interfacing Push Button to Arduino Buzzer An audio signaling device buzzer may be electromechanical or piezoelectric or mechanical type. The main function of this is to convert the signal from audio to sound. It is powered through DC voltage and used in timers, alarm devices etc. Buzzer Specifications Color is black The frequency range is 3,300Hz Operating Temperature ranges from – 20° C to +60°C Operating voltage ranges from 3V to 24V DC The supply current is below 15mA Buzzer Different types of Buzzer: Piezoelectric It uses the piezoelectric ceramic’s piezoelectric effect & pulse current to make the metal plate vibrate & generate sound. Electromagnetic It is made with a magnet, solenoid coil, oscillator, housing, vibration diaphragm, and magnet. Once the power supply is given, the oscillator which produces the audio signal current will supply throughout the solenoid coil to generate a magnetic field. Magnetic Magnetic buzzers utilize an electric charge instead of depending on piezo materials to generate a magnetic field, after that it permits another element of the buzzer to vibrate & generate sound. Interfacing Buzzer to Arduino Code to interface Buzzer to Arduino LCD (Liquid Crystal display) LCDs use liquid crystals sandwiched between two layers of glass or plastic, which can be manipulated by electric currents to produce images. Liquid crystals do not emit light directly. Instead, they use a backlight or reflector to produce images. LCD displays with I2C LCD adapters are 16×2 character LCD displays. I2C LCD Adapter At the center of this adapter, there is an 8-bit I/O expander chip – PCF8574. It takes the I2C data from the Arduino and converts it into serial data required for an LCD display. On one side the I2C LCD adapter has four pins that can be connected to Arduino. On another side, it has 16 pins that are connected to the LCD display. LCD-I2C Pins These four pins are – Ground, VCC, SDA, and SCL. LCD connections Connect the LCD’s VCC pin to the Arduino 5v pin Ground pin to the Arduino Ground pin. connect the SCL pin to the Arduino SCL (A5) pin SDA to the Arduino SDA (A4) pin. Install required libraries Go to Tools> Manage Libraries> search for liquidcrystal i2c library by Frank de Brabander and install it. Code to interface LCD to Arduino LCD Interfacing with Arduino on TinkerCAD Code to Interface LCD to Arduino on Tinker CAD

Use Quizgecko on...
Browser
Browser