Difference between analog and digital

Thread Starter

samsonovi

Joined Nov 21, 2017
10
Hello.

Could anybody please assist me in my understanding in the difference between analog and digital signals, electronics. What is the difference in analog and digital pins on my Arduino?
Thank you.
 

dendad

Joined Feb 20, 2016
4,451
Basically, Digital has only 2 states. For example, +5V (logic high) and 0V (logic low).
(The voltages used can be other defined values, not just 5V. Some use 3.3V or more values still.)
For example, a digital sensor can tell you if it is light or dark, but only that.
On the other hand, Analog is a varying voltage. It could be any value between maybe 0V and 5V.
For example as above, the analog sensor can tell you how much light there is.

On an Arduino, there are digital inputs that can read if a switch is on or off.
And the analog inputs can read a variable voltage.
The digital outputs can turn an LED on or off, but the analog outputs can fade it up and down.
There is a trick to the Arduino analog out. It is infact digital outputs switching on and off rapidly and the on to off ratio gives the appearance of analog. Also, this PWM (Pulse Width Modulation) signal can be filtered to produce a real analog out.
I hope that helps.
 

MrChips

Joined Oct 2, 2009
30,706
In reality, all digital signals are analog.

A digital signal may transition from 0V to 5V and from 5V to 0V. The signal cannot magically go from one value to another without traversing all the infinite voltage levels between 0V and 5V.

The difference between analog and digital is in the interpretation of the signal and what one intends to do with the signal.

In MCU architecture and applications, an input/output pin may be classified as analog or digital and sometimes both analog/digital. A digital output pin has driver circuitry designed to drive the voltage levels to two extreme values, low and high. This would negate any attempt to use the pin as an analog input or output pin. When this analog functionality is required, the digital circuitry is disabled to allow the pin to assume all intermediate values between the two extreme cases.
 

crutschow

Joined Mar 14, 2008
34,280
It's also possible to convert an analog signal into a digital signal with an analog to digital converter (ADC), such as in an Arduino or with a stand-along IC.
This converts the continuous analog voltages into discrete voltage levels which are converted to a digital word that represents the voltage in binary.
The number of bits determines the resolution of the ADC. Thus an 8-bit ADC would divide the input voltage range of the ADC into 255 equal voltage steps.
 
Top