IoT Hacks for IoT geeks. http://iot-hacks.com

Digital Pins of Arduino

7:09 AM Posted by Gopal Kildoliya No comments
The digital pins on the Arduino can be configured as either inputs or outputs. These pins works on HIGH(5V) and LOW(0V) states but some of them also works as PWM pins (We will talk about PWM in upcoming posts). There are 20K pullup resistors built into the Atmega chip that can be accessed from software. We will discuss
here about configuration of digital pins as input and output also with pullup resisters.

Properties of Pins Configured as INPUT
Arduino pins works as input by default and this is called high-impedance state. It takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing a capacitive touch sensor, reading an LED as a photodiode, or reading an analog sensor with a scheme such as RCTime. The pin can be configured as input by " pinMode(pin, INPUT) ". If such a pin is left open or connected to a wire which is not connected to another circuit then it will cause random changes in pin state due to electrical noise. 
Often it is useful to steer an input pin to a known state if no input is present. This can be done by adding a pullup resistor (to +5V), or a pulldown resistor (resistor to ground) on the input. A 10K resistor is a good value for a pullup or pulldown resistor.

Properties of Pins Configured as OUTPUT
Pins configured as OUTPUT with pinMode(pin, OUTPUT) are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This is enough current to brightly light up an LED (don't forget the series resistor), or run many sensors, for example, but not enough current to run most relays, solenoids, or motors. So we have to use external pullup resister to +5V for current source.

0 comments:

Post a Comment