Saturday, 31 January 2015

#4 Digital Pins of Arduino UNO

This is 4th post on Arduino tutorial.
If you want the list of posts click here.
Digital Pins :-

  • The pins on the Arduino can be configured as either inputs or outputs [Depends on the declaration of the pin in program].
  • Digital pins means all the data that we can transfer will be digital i.e HIGH level or LOW level [e.g. 5V - 1 & 0V - 0]. No intermediate values are detected.
  • We can program and use the analog pins [available on the board] as digital pins too.
  • Digital pins, can be set high or low according to our wish by modifying the programs. Controlling the pins through program is indirectly controlling the input/output devices attached to it.
  • We can take the Digital inputs from different sensors, different devices and then process it. Processed data is again given back to different digital pins on which we have attached the output devices.
  • All the digital pins i.e. in case of UNO [0-13 pins] are configurable as INPUT/OUTPUT and we can set them as HIGH/LOW.
  • There are few of the Digital pins which have '~' this symbol besides its number,this pins can act as PWM [Pulse Width Modulation] pins i.e. can generate PWM.
  • PWM is a method in which we change the time period of the pulse for which it is kept HIGH & LOW, in turn affecting the effect of the pulse. E.g. If a Pulse of time period 2s is used for LED, then the LED will be on for one sec & off for the other. But if now the Time period is reduced to a large extent then even if the LED gets the value of 5V it wont glow because the time for which 5V came was really less. Now if we keep on changing the time period continuously [coding is used] we have an fading effect on LED or a gentle start of motor. This is how PWM pulse acts or is used. [explained in layman's language because this is a vast concept, you can avoid this if you haven't understood].
  •  Often it is useful to steer an input pin to a known state if no input is present. So even if it is a Input pin and nothing is connected then configure it to a High or Low state to avoid the randomization.
  •  Digital Pins can provide a 0V minimum and a 5V maximum with a current of 40mA [Milliamps] to the devices connected across it. This is enough to light a LED (don't forget the series resistor), or run many sensors, for example, but not enough current to run most relays, solenoids, or motors [use a switching mechanism or a driver IC to run such heavy load devices].
  • When we want to drive a output it's recommended to use the Digital pins as GND  and connect the other end of device at source, so that Arduino sinks current and not provides it. [Usually people make o/p pins high and connect the other end of device to ground, which makes Arduino a source and the device is not sourced with proper current. Instead use a different source and make arduino board as sink. This is useful when we have many current drawing devices, since Arduino can provide less amount of current].
  • Short circuits on Arduino pins, or attempting to run high current devices from them, can damage or destroy the output transistors in the pin, or damage the entire Atmega chip. Often this will result in a "dead" pin in the microcontroller but the remaining chip will still function adequately. For this reason it is a good idea to connect OUTPUT pins to other devices with 470Ω or 1k resistors, unless maximum current draw from the pins is required for a particular application.
This is about Digital Pins on Arduino, we will be dealing with this a lot when we begin with the actual programming of Arduino Board.

Visit the next post on 'Analog Pins of Arduino Uno'.
click here.

Follow the blog, 
Hit like on the Facebook page and stay tuned :)
Comments are welcomed :)
Thank You.