Signals
Signals generally fall into two categories: analog or digital. Analog signals vary in voltage between the source and ground. Digital signals are either source voltage or ground.
Analog signals are read using analog input pins and return a value between 0 and 1024. The voltage can be determined by the value returned multiplied by the voltage source (5v) and then divide by 1024.
Voltage = ( analogRead() * 5 ) / 1024
Digital signals are used in most communications. A digital signal will either be high (1) or low (0). The threshold for digital signals can vary but it is normally about half the source voltage. The AVR in the Arduino has a threshold of 2.4V on the way up and 2V on the way down. This allows many 3.3V digital signals to be read by the 5V device.
Characteristics of a Signal
Amplitude is the maximum value that the wave will reach relative to its center point, so if a wave oscillates between 5V and -5V it would have an amplitude of 5V. If a wave oscillates between 10V and 2V it would have an amplitude of 4V.
Period is how long it takes a signal to repeat (complete one full cycle). The inverse of a waves period is known as the frequency, measured in Hertz (Hz). Their equations relating to each other are:
where f is frequency and T is period. So a 1kHz sine wave would have a period of
Phase, otherwise known as offset or is where in the cycle the wave is at when t = 0. A sine wave that starts at its maximum amplitude would have an offset of pi/2 radians or 90 degrees, otherwise known as a cosine wave.
Rise and fall times are just how long it takes the signal to settle at the peak or valley voltage respectively.
Duty cycle is an important characteristic for some digital signals, such as PWM (Pusle Width Modulation), which is used when driving motors. Duty cycle is the time high over the time low.
Duty cycle = time high / time of signal
Sine Wave Equation
In its most basic form, a sine wave is a function of time (t) written as:
Where A is the amplitude in Volts, f is the frequency in Hz, and phi (φ) is the phase.