Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore CU-BCA-Sem VI-IOT Based Applications

CU-BCA-Sem VI-IOT Based Applications

Published by Teamlease Edtech Ltd (Amita Chitroda), 2022-11-12 07:10:45

Description: CU-BCA-Sem VI-IOT Based Applications

Search

Read the Text Version

["Fig 11.4 Ultrasonic Sensor HC-SR04 Arduino UNO (c) Initially, it displays the 0 as no activity in the process. Fig 11.4 Ultrasonic Sensor HC-SR04 Arduino UNO (d) Now, connect your Ultrasonic HC-SR04 module and Arduino device. Input the power source to Arduino device using Arduino USB cable or 220v AC adapter. Place an object in front of the Ultrasonic HC-SR04 module and show the distance of that object in Processing IDE display. 251 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 11.5 Ultrasonic HC-SR04 module and Arduino device 252 CU IDOL SELF LEARNING MATERIAL (SLM)","11.3 INTERFACING DC MOTORS DC motor converts electrical energy in the form of Direct Current into mechanical energy in the form of rotational motion of the motor shaft. The DC motor speed can be controlled by applying varying DC voltage; whereas the direction of rotation of the motor can be changed by reversing the direction of current through it. For applying varying voltage, we can make use of PWM technique. For reversing the current, we can make use of H-Bridge circuit or motor driver ICs that employ the H-Bridge technique. For more information about DC motors and how to use them, H-Bridge circuit configurations, and PWM technique, refer the topic DC Motors in the sensors and modules section. Interfacing Diagram Fig 11.6 Interfacing DC Motor with Arduino UNO Example 253 CU IDOL SELF LEARNING MATERIAL (SLM)","Here, we are going to control the speed and rotational direction of DC motor using Arduino Uno. Here, a potentiometer is used as a means for speed control and an input from a tactile switch is used to change the direction of the motor. L293D motor driver IC is used for controlling the direction of the motor. PWM wave generated on the Arduino UNO is used to provide a variable voltage to the motor through L293D. In Arduino, analogWrite function is used to generate PWM wave. Sketch for Direction and Speed Control of DC Motor const int POT_input = A1; \/* assign ADC Channel *\/ bool d1 = HIGH; bool d2 = LOW; void setup() { pinMode(4, OUTPUT); \/* Motor control pin 1 *\/ pinMode(7, OUTPUT); \/* Motor control pin 2 *\/ pinMode(3, OUTPUT); \/* PWM pin for Speed Control *\/ pinMode(2, INPUT_PULLUP); \/* Interrupt pin for direction control *\/ attachInterrupt(digitalPinToInterrupt(2), motor, FALLING); \/* Interrupt on falling edge on pin 2 *\/ } void loop() { int pwm_adc; pwm_adc = analogRead(POT_input); \/* Input from Potentiometer for speed control *\/ digitalWrite(4,d1); digitalWrite(7,d2); analogWrite(3, pwm_adc \/ 4); } 254 CU IDOL SELF LEARNING MATERIAL (SLM)","void motor(){ d1 = !d1; d2 = !d2; _delay_ms(200); } Functions Used 1. digitalPinToInterrupt(pin) \uf0b7 This function is used to declare the digital pin as an interrupt pin. \uf0b7 Example,digitalPinToInterrupt(2) is used to declare digital pin 2 as an interrupt pin. \uf0b7 On UNO board, only pins 2 and 3 can be configured as interrupt pins. Hence, argument to this function can only be pin 2 or pin 3. 2. attachInterrupt(digitalPinToInterrupt(pin), ISR, mode) \uf0b7 This function is used to configure the mode of interrupt event and declare the ISR for that interrupt. The interrupt event and ISR is for the interrupt pin declared by the function digitalPinToInterrupt(pin). \uf0b7 ISR in this function is the name of the ISR that will be used for this interrupt. \uf0b7 mode defines when the interrupt will be triggered. There are four modes available to choose from : - LOW : trigger the interrupt whenever the pin is low. - CHANGE : trigger the interrupt whenever the pin changes value. - RISING : trigger when the pin goes from low to high. - FALLING : trigger when the pin goes from high to low. \uf0b7 Example, attachInterrupt(digitalPinToInterrupt(2), motor, FALLING) configures digital pin 2 as an interrupt pin with ISR named motor and which generates interrupt for every falling edge event on pin 2. 3. analogWrite(pin,value) \uf0b7 This function is used for generating PWM on PWM digital pins(pins 3,5,6,9,10,11 for Arduino UNO). \uf0b7 value can be any number between 0 to 255. 0 being 0% duty cycle and 255 being 100% duty cycle. 255 CU IDOL SELF LEARNING MATERIAL (SLM)","11.4 SUMMARY \uf0b7 An embedded system is one kind of a computer system mainly designed to perform several tasks like to access, process, store and also control the data in various electronics-based systems. \uf0b7 Embedded systems are a combination of hardware and software where software is usually known as firmware that is embedded into the hardware. One of its most important characteristics of these systems is, it gives the o\/p within the time limits. \uf0b7 Embedded systems support to make the work more perfect and convenient. So, we frequently use embedded systems in simple and complex devices too. \uf0b7 The applications of embedded systems mainly involve in our real life for several devices like microwave, calculators, TV remote control, home security and neighborhood traffic control systems, etc. 11.5 KEYWORDS \uf0b7 Microprocessor. A piece of silicon containing a general-purpose cpu. \uf0b7 Non-functional requirements. A feature or characteristic that affects an item\u2019s quality. \uf0b7 Power supply. It is the power supply of the product (battery, stack or external source). \uf0b7 Processor. A processor is the logic circuitry that responds to and processes the basic \uf0b7 Instructions that drive a computer. \uf0b7 Quality attributes. It is a function performed by an agent (customer, engineer, and others). \uf0b7 Sensors. A sensor is any system providing up-to-date information about the context where the system is running. Serial. In computing, a serial port is a serial communication interface through which information transfers in or out one bit at a time (in contrast to a parallel port). \uf0b7 Software. Computer programs, procedures, and possibly associated documentation and data pertaining to the operation of a computer system. \uf0b7 Software behaviour. It is a function performed by software. \uf0b7 Software interface. It is a software responsible to connect one or more softwares 256 CU IDOL SELF LEARNING MATERIAL (SLM)","11.6 LEARNING ACTIVITY 1. Explain the ultrasonic sensor to calculate distance 2. Make a Ultrasonic Map-Maker using an Arduino Yun 11.7 UNIT END QUESTIONS A.Descriptive questions Short Questions 1. What is Ultrasonic sensor 2. What is DC Motors 3. What are the two essential units of a processor on an embedded system? 4. Differentiate between timers and counters. 5. Explain the electrical specifications of RS232 Long Questions 1. Give the characteristics of embedded system 2. Explain the design concept of an Elevator control mechanism using a sequential model. 3. Write the steps involved in describing a system\u2019s behavior as a state Machine. 4. Write a brief note on concurrent process model and communication among the process. 5. Explain the HCFSM model in a elevator control system. 6. Explain the Synchronization among process with examples. 7. Explain in brief about the following. a) FSM b) FSMD c) HCFSM and state charts A. Multiple Choice Questions 1. How many pins does 8087 have? a) 40 pin DIP b) 20 pin DIP c) 40 pins d) 20 pins Answer: a 2. What is the clock frequency of 8087? 257 CU IDOL SELF LEARNING MATERIAL (SLM)","a) 10 MHz 258 b) 5 MHz c) 6 MHz d) 4 MHz 3. How are negative numbers stored in a coprocessor? a) 1\u2019s complement b) 2\u2019s complement c) decimal d) gray Answer: b 4. How many bits are used for storing signed integers? a) 2 b) 4 c) 8 d) 16 Answer: d 5. Which of the processor has an internal coprocessor? a) 8087 b) 80287 c) 80387 d) 80486DX Answer: d 6. What are the two major sections in a coprocessor? a) control unit and numeric control unit b) integer unit and control unit c) floating point unit and coprocessor unit d) coprocessor unit and numeric control unit Answer 1- a, 2- 3-b, 4-d, 5-d, 6 -a CU IDOL SELF LEARNING MATERIAL (SLM)","11.8 REFERENCES Text Books: - 1. Internet of Things (A Hands on Approach), By ArshdeepBahga (Author),VijayMadisetti(Author). Edition: Second Edition, Illustrated, Reprint (2014) Publisher: VPT, 2017 2. \u201cBeginning Arduino\u201d by Michael McRobetrs(Author). Publisher:Technology in Action Reference Books: - 1. Tim Cox, Dr. Steven Lawrence Fernandes, Sai Yamanoor, Srihari Yamanoor, Prof. DiwakarVaish,\u201d Getting Started with Python for the Internet of Things: Leverage the full potential of Python to prototype and build IoT projects using the RaspberryPiEdition: First EditionPublisher:Packt Publisher-2019 259 CU IDOL SELF LEARNING MATERIAL (SLM)"]


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook