1 / 50

Uni t - 5

Uni t - 5. EMBEDDED DEVICES. Co n t e n ts Embedded Computing Basics Microcontrollers System-on-Chips Choosing your platform Arduino Developing on the Arduino Some notes on the hardware openness. Contents. What is a Prototype? Electronics Breadboard Sensors Actuators GPIO

stevenn
Download Presentation

Uni t - 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unit-5 EMBEDDEDDEVICES

  2. Contents • Embedded ComputingBasics • Microcontrollers • System-on-Chips • Choosing yourplatform • Arduino • Developing on the Arduino • Some notes on the hardware • openness

  3. Contents • What is aPrototype? • Electronics • Breadboard • Sensors • Actuators • GPIO • ADC • Scaling up theElectronics • Embedded ComputingBasics • Microcontrollers • System-on-Chips • Choosing yourplatform • Arduino • Developing on theArduino • Some notes on thehardware • openness

  4. What is aPrototype? • A prototype is an early sample, model, or release of a product built to test a concept orprocess. • An instance of a category or a concept that combines its most representative attributes. • A demo of creating a newsystem.

  5. Electronics • Breadboard • – Most of the prototyping can be done on what are called solder less breadboards. They enable you to build components together into a circuit with just a push-fit connection, which means you can work with different options quickly andeasily. • A breadboard is a construction base forprototypingofelectronics. • its reusable because its solder less a.k.a. plugboard. • these breadboards are called solder less breadboards because they do not require soldering to make connections. Soldering (pronounced SAW-der-ing) is a method where electronic components are joined together by melting a special type of metal calledsolder. • Thelayoutofatypicalsolderlessbreadboardismadeupfromtwotypesofareas,called • strips. Strips consist of interconnected electricalterminals. • TerminalStrip • Busstrip

  6. Electronics • Breadboards ( conti…) Terminal strips • The main areas, to hold most of the electronic components. In the middle of a terminal strip of a breadboard, one typically finds a notch running in parallel to the longside. • The notch is to mark the centerline of the terminalstrip • The five rows on the left of the notch are often marked as A, B, C, D, and E, while the ones on the right are marked F, G, H, I andJ • Busstrips • To provide power to the electroniccomponents. • A bus strip usually contains two rows: one for ground and one for a supplyvoltage.

  7. Electronics • Electronics are actually classified into two maincategories • Sensors, are the ways of getting information into yourdevice. • Actuators, are the outputs for thedevice. • Sensors: • Push buttons and switches are the simplest sensors which allow some userinputs. • Potentiometer and rotary encoders are used to measuremovement. • microphones are used to monitor sounds andaudio • Piezo elements can also be used to respond to vibration or knock likebuzzer. • Distancesensingmoduleswhichwork bybouncingeitheraninfrared or ultrasonic signaloff • objects. • Sensing the environment is anotherresponsibility • Light dependent resistors allow measurement of ambient lightlevels. • Thermistor allows you to know how warm itis. • Humidity sensors are used to measure moisture levels andhumidity. • •

  8. Elec tronics • Actuators: • One of the simplest and most useful actuators islight. • Light emitting diodes comes in red, green, white and yellow • RGB LED’s have a more complicated setup but allow you to mix the levels of red, green, blue to make whatever the color of light youwant. • LCD screens can be used to display text or simplegraphics. • Piezo buzzer(elements) can be used to create simplesound. • Often you need to use components that move things in the realworld • Solenoidal can be used to create a single, sharp pushingmotion. • Steppers motors can be moved to steps usually a fixed number of steps perform a fullrotation. • DC motor simply move at a given speed when toldto. • If you want a motor that will turn to a given angle you would need a servo(180 degree or fewer degrees will be the rotation) whereas stepper motor and DC motor will rotateindefinitely. • Gears are to be used to alter the range of motion or convert circular movement to linear andsoon.

  9. Electronics These electronic components can talk to the computer in a number of ways. The simplestis through digitalI/O Which has only twostates on off ie., a button can either be pressed or not or an LED can be on or off. These states are usually connected via GPIO pins and map digital 0 in the processor to 0 volts in the circuit and the digital 1 to a set voltage, usually the voltage that the processor is using to run(5v/3.3v)

  10. Scaling up theElectronics:

  11. Embedded ComputingBasics: • Here we will be discussingabout • Microcontrollers • System-On-Chips • Choosing yourplatform • First question is what is a Microcontrollers(Arduino)? • “A microcontroller (or MCU for microcontroller unit) is a small computeron a single integrated circuit. In modern terminology, it is similar to, but less sophisticated than, a system on a chipor SoC.” A microcontroller contains one or more CPUs(processor cores) along with memoryand programmable input/outputperipherals. “It is a highly integrated chip that contains all the components comprising a controller. This includes a CPU, RAM, some form of ROM, I/O ports andtimers.” • A microcontroller is designed for a very specific task-to control a particularsystem. • What is System-On-Chip(Raspberry Pi)? • An SoC may include a microcontroller as one of itscomponents. • “in between the low-end microcontroller and a full blown PC sits the System-On-Chip, like the microcontroller these SoC’s combine a processor and a number of peripherals onto a single chip but usually have more capabilities.” • What is the difference betweenthem? • In SoC, the processor usually ranges fromfew megahertz to gigahertzfor top endsolutions • RAM will be measured inmegabytes

  12. Embedded ComputingBasics: • Storage for the SoC Module will not to be included on the chip so the solution is SDcards. • To marshal their resources SoC requires an OperatingSystem.

  13. Embedded ComputingBasics: • Choosing Your Platform: • Factors that we need to consider while building your prototype/ we will be discussing about how tochoose • right platform for your IoTDevice. • ProcessorSpeed • RAM • Networking • USB • PowerConsumption • Interfacing with Sensors and otherCircuitry • Physical size and formfactors

  14. Embedded ComputingBasics: ProcessorSpeed: • The processor speed / clockspeed ofyourprocessortellsyouhowfastitcanprocesstheindividual • instructions in the machine code for the program itsrunning. • Naturally fast processor means that it can execute instructions morequickly. • Some processor may lack hardware support for floating point calculations then, slow processor with hardware floating point support could be faster than a slightly higher performance processor withoutit. • Microcontrollers tends to be clocked at a speed in the tens of MHz whereas SoCs run at hundreds of MHz or possibly lowGHz. • If your project requires basic sensing then go for microcontrollers or if your project requires some heavy weight processing like processing video in real time then go for SoCPlatform.

  15. Embedded ComputingBasics: • RAM: • RAM provides the working memory for thesystem. • More RAM means you can do more things or have more flexibility over your choice of coding algorithms. • Its difficult to give guidelines to the amount of RAM you will need because it may vary from project to project. • Microcontrollers will come with less memory which range from 1KB-8KB • Where as SoC will come with at least 256MB of RAM which is minimum requirement to run Operating System(Linux).

  16. Embedded ComputingBasics: • NETWORKING: • Here we need to discuss how devices connect to the rest of theworld: • Options • WiredEthernet • Wi-Fi • Zigbee • Bluetooth • Mobile phonenetworks • SoCs like raspberry pi will be having inbuilt options for wired Ethernet, Wi-Fi, Bluetooth and for zigbee we need to have xbee module and for mobile phone network access we need to have GSMmodule. • Microcontrollers need to have interfacing modules to access any of the aboveoptions. • ForBluetoothHC05(HC-05moduleisaneasytouseBluetoothSPP(SerialPortProtocol)module,designedfor • transparent wireless serial connection setup.) is to beused • Zigbee Xbee module isused • Wi-Fi ESP8266 MODULE isused • GSM module is used to use mobile phonenetworks • For wired Ethernet arduino Ethernet interface module needs to beused(ENC28J60)

  17. Embedded ComputingBasics: • USB: • To connect phones, additional storage capacity or WiFi dongles we needUSB • Some Microcontrollers come up with support for USB. • SoC come up with inbuilt support forUSB • PowerConsumption: • Fast processors are need more power than the slowprocessors • For devices which might be portable or rely on an unconventional power supply(batteries) depending on where they are installed power consumption may be anissue. • Processorsmayhaveaminimalpowerconsumptionsleepmodethismodeallowyoutouseafast • processor to quickly perform the task and return to low-powersleep. • Therefore a fast processor may not be a disadvantage even in low power embeddeddevices.

  18. Embedded ComputingBasics: • Interfacing with sensors and othercircuitry: • InadditiontotalkingtotheInternet,yourdeviceneedstointeractwithsomethingelse—eithersensors • to gather data about itsenvironment; • or with motors, LEDs, screens, and so on, to provideoutput. • You could connect to the circuitry through some sort of peripheral bus—SPI and I2C being common ones—or through ADC or DAC modules to read or write varying voltages; or through generic GPIO pins, which provide digital on/off inputs or outputs. Different microcontrollers or SoC solutions offer different mixtures of these interfaces in differingnumbers.

  19. Embedded ComputingBasics: Physical size and Formfactor: Arduino uno size 2.95"*2.10" Raspberry pi3.37"*2.125"

  20. Embedded ComputingBasics: • For applications minimizing size we recommend theArduino • For applications that connect to the internet we recommend the Beagle Bone or RaspberryPi. • For applications that interface to external sensors we recommend the Arduino and the BeagleBone • For battery powered applications, we recommend theArduino. • For applications that use a graphical user interface, we recommend the RaspberryPi. • Summary: • The Arduino is a flexible platform with great ability to interface to most anything. It is a great platform to learn first and perfect for many smallerprojects. • The Raspberry Pi is good for projects that require a display or network connectivity. It has incredible price/performancecapabilities. • The Beagle Bone is a great combination of some of the interfacing flexibility of the Arduino withthe • fast processor and full Linux environment of the RaspberryPi

  21. ARDUINO • Developing on theArduino • Some notes on thehardware • openness

  22. ARDUINO Introduction: • ARDUINO Uno features an ATmega 328 microcontroller and a USB socket for connection to acomputer. • It has 32KB of storage and 2KB ofRAM. • Uno also provides 14GPIO pins among which 6 can provide PWM-pulse with modulation(an analog value (PWM wave) to a pin) output and 6 10-bit resolution ADCpins. • TheATmega’sserialportismadeavailablethroughboththeIOpinsandviaanadditionalchiptheUSB • connector. • If you need more space or a greater number of inputs or output then look at the Arduino Mega2560. • It marries a more powerful ATmega microcontroller to the same environment, providing 256KB of flash storage, 8KB of RAM three more serial ports, a massive 54GPIO pins among which 14 of those are capable of PWM and16ADC’s. • Arduino Due has a 32KB core microcontroller and it has RAM of96KB.

  23. ARDUINO • Developing on theARDUINO: • Integrated DevelopmentEnvironment • PushingCode • Operating System • Language • Debugging

  24. ARDUINO Using a single USB cable you can not only power the board but also push the code onto the board and if needed you can communicate with it(for ex: for debugging or to use the computer to store data retrieved by the sensors connected to theArduino). Integrated DevelopmentEnvironment: IDE, is used to develop against the Arduino provided by http://arduino.cc, its very easy to use. Most of the arduino projects consists of a single file of code, so you can think of the IDE mostly as a simple file editor. The controls that you use the most are those to check the code(by compiling it)or to push code to theboard.

  25. ARDUINO • PushingCode: • Connecting to the board should be relatively straightforward via USBcable. • Sometimes you might have issues with the drivers or with permissions on the USB port(my computer-> device manager->usb->enable or disable theusb • After this you need to choose the correct serial port (tools->port->choose from the options in theIDE) • After this you need to choose the correct board type(tools->board->choose from the options in the IDE) When your setup is correct the process of pushing code is generallysimple: • First the code is checked and compiled with any compilation errors reported toyou • If the code compiles successfully, it gets transferred to the Arduino and stored in its flash memory. At this point the Arduino reboots and starts running the newcode.

  26. ARDUINO Operating System: Arduinodoesn’t,bydefault,runanOS,suchasonlythebootloader,whichsimplifiesthecodepushing process. When you switch on the board it simply runs the code that you have compiled until the board is switched offagain. Its however possible to upload an OS to the arduino, usually a lightweight real time operating system(RTOS).

  27. ARDUINO • Language: • ThelanguageusuallyusedforArduinoisaslightlymodifieddialectofC++derivedfromthewiring • platform: • It includes some libraries used to read and write data from the I/O pins provided on the arduino and to do some basic handling forinterrupts. • This variant of C++ tries to be forgiving about the ordering of code (for ex it allows you to call functions before they are defined). • Code only provides tworoutines: • Setup()-this routine is run once when the board first boots. You could use it to set the modes of I/O pins to input or output or to prepare a data structure which will be used throughout theprogram. • Loop()- this routine is run repeatedly in a tight loop while the Arduino is switched on. Typicallyyou • might check some input do some calculations on it and perhaps do some output inresponse.

  28. ARDUINO Example: //Pin 13 has an LED connected on most Arduinoboards //give it a name int led=13; //the setup routine runs once when you press reset voidsetup() { //initialize the digital pin as an output pinMode(led,OUTPUT); } voidloop() { digitalWrite(led,HIGH); delay(1000); digitalWrite(led,LOW); delay(1000); } //turn the LEDon //wait for a second //turn the LEDoff //wait for asecond

  29. ARDUINO Readingthroughthiscode,setupfunctionisjustsetsupthatpinnumber13istheonewearegoingto control. Then in loop() the LED is turned on and then off, with a delay of a second between each flick of theswitch

  30. ARDUINO • Debugging: • Because C++ is a compiled language, a fair number of errors such as bad syntax orfailure to declare • variables are caught at compilationtime • Ex • Blink.cpp: in function ‘void loop()’:Blink:21: • Error: ‘digitalWritee’ was not declared in thisscope • From this example we can see that on line 21 in the function loop() we deliberately misspelled the call to digitalWrite. • When the code is pushed to the Arduino the rules of the game change, however Arduino is not generally not connected to a screen it is hard for it to tell you when something goes wrong. Even if the code compiled successfully, certain errors stillhappen. • Ex: division by zero • trying to access the tenth element of a 9 elementlist. • or your program leaks memory and eventually just stopsworking. • A programming error might make the code continue to work dutifully but give entirely the wrongresults.

  31. ARDUINO • Debugging(cont…) • Thismeansthatyouneedtocheckyourdatabeforeusingit:ifanumbermightconceivablybezero,check • that before trying to divide by it. • Test that your indexes are within bounds. Avoid memory leaks • In the absence of screen the Arduino allows you to write information over the USB cable using Serial.Write(). Although you can use the facility to communicate all kinds of data, debugging information can be particularlyuseful. • The arduino IDE provides a serial monitor which echoes the data that the arduino has sent over the USB cable. This couldinclude • any textual information such as logginginformation, • comments • and details about the data that the arduino is receiving andprocessing.

  32. ARDUINO • Some Notes on theHardware: • ArduinoexposesanumberofGPIOpinsandisusuallysuppliedwithheaders(plasticstripsthatsitonthe • pinholes) • Each pin is clearly labelled on the controllerboard. • In general you have power outputs such as 5 volts or 3.3 volts(labelled 5V and 3V3, or perhaps just3V) • One or more electric groundconnections(GND), • Number digital pins and numbered analogue pins prefixed with anA. • You can power the arduino using a USB connection from yourcomputer. • The arduino also has a socket for an external power supply which you might be more likely to use if you distribute theproject. • Eitherwayshouldbecapableofpoweringthemicrocontrollerandtheusualelectronicsthatyoumight • attach toit. • In the case of larger items, such as motors, you may have to attach external power and make that available selectively to the component usingtransistors.

  33. ARDUINO • Some Notes on theHardware(cont..): • ArduinoEthernethasanon-boardEthernetchipandtradestheUSBsocketforanEthernetonemaking • it easier to hook up to theinternet. • In the arduino world the add-on boards are called shields, because they cover the actual board as if protecting it. • Some shields provide networking capabilities-Ethernet, wifi or zigbeewireless • Motor shields make it simple to connect motors and servos there are shields to hookup mobile phone, LCD screens others to provide capacitivesensing • Others to play MP3 files or WAV(Waveform Audio File Format.) files- (is an uncompressed file that broadcasts a good quality of music CD files.) from an SD card and manner of otherpossibilities.

  34. ARDUINO Openness: The arduino project is completely openhardware. In addition to the code being available to download freely the circuit board schematics and even the PCB design files are easily found on the arduinowebsite.

  35. ArduinoIDE

  36. Select Serial Port andBoard

  37. MainMenu SAVE OPEN NEW UPLOAD VERIFY

  38. Parts of theSketch

  39. My First Program(LEDBlink) int led = 13; void setup(){ pinMode(led,OUTPUT); } void loop() { digitalWrite(led,HIGH); delay(50); digitalWrite(led, LOW); delay(500); }

  40. Hardware connection for LEDblink

  41. (5 LEDBlink) void setup(){ for(int i = 2; i < 7; i++){ pinMode(i,OUTPUT); } } void loop(){ for(int i = 2; i < 7; i++){ digitalWrite(i, HIGH); delay(25); digitalWrite(i,LOW); } for(int i = 5; i > 2; i--){ digitalWrite(i, HIGH); delay(20); digitalWrite(i,LOW); } }

More Related