Electronics notes/Signal modulation: Difference between revisions

From Helpful
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#addbodyclass:tag_tech}}
{{Electronics notes}}
{{Electronics notes}}


Line 273: Line 274:




'''PDM in the context of DACs and ADCs'''
Note that [[Electronics_notes_/_Inputs_and_outputs#PDM_in_the_context_of_DACs_and_ADCs|PDM as an audio transfer protocol]] is a specific implementation of the general PDM concept.
 
One reason for a multiples-faster 1-bit DAC over e.g. sample-speed 16-bit DAC is that ''even though'' it needs to run a whole bunch faster, the linearity of the output signal is easier to control. It turns out that it's easier way to make it more precise, and/or cheaper to implement for the same linearity.
 
Roughly speaking, that linearity comes from the regularity of the timing, rather than the precision of the way you combine the levels (typically a precision-engineered resistor ladder, which becomes harder to do with every bit).
 
A 1-bit DAC was made by Philips around 1989, called Bit Streamer[https://www.stereophile.com/content/pdm-pwm-delta-sigma-1-bit-dacs-john-atkinson], and they work pretty well.
AFAICT, today 1-bit DACs aren't really made anymore, because a mix of the two approaches (the broader category of delta-sigma DACs) makes more sense{{verify}}.
 
A delta-sigma DAC has more noise around its internal speed{{verify}}, but since that's typically at order of a MHz, that's e.g. easy to filter out of audio signals.
 
The "output when the error accumulates too much" implementation is sequential, so can be implemented in simple FPGA logic[https://www.koheron.com/blog/2016/09/27/pulse-density-modulation], and also code (e.g. mircocontrollers[https://github.com/edgar-bonet/avr-dac]).
 
 
 
'''PDM input'''
 
A practical application you may have heard of is MEMS microphones.
Let's ignore ''how'' they oversample the acoustic signal,
and recognize that their output is a ~MHz-rate binary PDM signal,
and that the bit density over a longer term represents the amplitude of the (much lower rate) audio signal,
and consider how you might consume that.
 
 
'''Analog:''' Interestingly, you have the option of consuming it as analog, which you might do if the next step wants it as analog anyway.
 
You are one lowpass away from turning fast switching into its average - i.e. the represented signal at kHz range.
Noise induced onto the wire that carried the PDM signal will be inseparable also be part of this analog output, though.
 
 
'''Digital''': The point of consuming the same digitally is since this is binary,
the voltage swing is pretty unambiguously either one or the other.
In theory, any noise that is not strong enough to flip bits will be ignored.
And note that Receiving PDM in theory mostly comes down to counting - again, very quickly, but with the right peripheral that is not much of an issue.
 
 
 
 
 
 
 
 
 
https://en.wikipedia.org/wiki/Pulse-density_modulation
 
https://www.ap.com/technical-library/more-about-pdm/
 
-->


==Pulse Width Modulation (PWM)==
==Pulse Width Modulation (PWM)==
Line 1,111: Line 1,065:




=Frequency-shift keying=
=Modulating data to send: ASK, FSK, PSK=
 
<!--
'''Frequency-shift keying''' (FSK) uses distinct frequencies.
 
The simplest form of FSK is binary FSK (BFSK, 2FSK),
 
-->
 
https://en.wikipedia.org/wiki/Amplitude-shift_keying
 
https://en.wikipedia.org/wiki/Frequency-shift_keying
 
https://en.wikipedia.org/wiki/Phase-shift_keying

Latest revision as of 16:27, 26 April 2024

⚠ This is for beginners and very much by a beginner / hobbyist

It's intended to get an intuitive overview for hobbyist needs. It may get you started, but to be able to do anything remotely clever, follow a proper course or read a good book.


Some basics and reference: Volts, amps, energy, power · batteries · resistors · transistors · fuses · diodes · capacitors · inductors and transformers · ground

Slightly less basic: amplifier notes · varistors · changing voltage · baluns · frequency generation · Transmission lines · skin effect


And some more applied stuff:

IO: Input and output pins · wired local IO · wired local-ish IO · ·  Various wireless · 802.11 (WiFi) · cell phone

Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Noise stuff: Stray signals and noise · sound-related noise names · electronic non-coupled noise names · electronic coupled noise · ground loop · strategies to avoid coupled noise · Sampling, reproduction, and transmission distortions

Audio notes: See avnotes


Platform specific

Arduino and AVR notes · (Ethernet)
Microcontroller and computer platforms ··· ESP series notes · STM32 series notes


Less sorted: Ground · device voltage and impedance (+ audio-specific) · electricity and humans · power supply considerations · Common terms, useful basics, soldering · landline phones · pulse modulation · signal reflection · Project boxes · resource metering · SDR · PLL · vacuum tubes · Multimeter notes Unsorted stuff

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · JY-MCU · DMX · Thermal printer ·

See also Category:Electronics.

Most broadly, pulse modulation refers to modulating or communicating or approximating a signal in a way involving pulse trains.

Note also that PAM resembles AM, PPM resembles PM, and PWM (moderately) resembles FM.

(Also, some of these parts run into analog and digital (passband) modulation, and for decent handling of said topics you're much better off on serious sites for those.)


Purposes and best uses are varied.


Side note: Pulse Code Modulation

Pulse-code modulation refers more widely to the idea of samples at at regular (uniform) intervals, and storing them as distinct values.

It that we're quantizing in time and amplitude, roughly how to store, and what it represents.

...and is not a reproduction technique, like most of this page. (reproduction was a separate thing even in the earliest development of these concepts)


Variants include:

Unqualified PCM usually means

quantization levels are linearly uniform (so ratiometric) with amplitude
...physical amplitude, so not with perceived loudness
used for sound, it means most of the bits are used on really quiet stuff (because human perception is logarithmic).
which is actually quite useful (for human consumption of audio)
also why 8-bit PCM is audibly not enough, and 16-bit is (for most things)
probably easiest raw format to deal with (particularly when storage/bandwidth are not an issue)
Directly used in Audio CDs (Red Book), in WAV files, and quite a few others.
Also used in some way or other in a number sound- or music-related electronics, although note that mu-law and a-law are seen in some older hardware


logarithmic PCM

Because of the nonlinear way we hear loudness, and given a fixed, limited bandwidth, people at different volume levels get similar signal-to-quantizing noise ratio - than linear PCM(verify)
since the original input and eventual reproduction is often LPCM (it's a choice most hardware makes), this is often used to effectively compand signal while in transmission/storage
implementations include μ-law (mu-law) and A-law
which historically implied 8-bit and often 8000Hz implementations, as used in early digital phone transmissions (see e.g. ITU-T G.711)
if storage is not a hard constraint (and harder than CPU use), then linear PCM is easier and log PCM is probably more work than it's worth
u-law and a-law are quoted as roughly comparable to the quality of 12-bit linear PCM (in what regard?(verify))
(even though technically 16-bit logarithmic still give better detail than linear 16-bit(verify), you generally don't need it)


Differential PCM

says that instead of storing the absolute values, we store the difference from the last, or to a (deterministically) predicted next value.
If the prediction is reasonable, we need to send fewer bits.
This is generally a smaller number, so allows a slight reduction in storage, but not much



ADPCM is Adaptive Differential PCM.

It takes the differential PCM output, and varies the amount of quantization of it over time.

This is a lossy format that allows you to tweak bandwidth/SNR on noisy / low bandwidth channels.

often 5-, 4-, or 3-bit


SB-ADPCM: ADPCM, but applied to distinct frequency sub-bands.

For example, G.722
splits into two bands (roughly 0Hz to 4kHz, and 4kHz to 8kHz), then applies ADPCM to each
This mainly so that you can spend bits differently, e.g. 48 of the 64 kbit/s on the lower sub-band that includes most voice energy, and 16 kbit/s on the rest. (G.722 actually has a few different target bitrates)



Even when storage/transmission is mu-law/A-law or ADPCM or some other codec, processing on endpoints is often LPCM, mostly because it's easier and faster to work with.


For context on companding: linear PCM is not clever about spreading quantization to where our (approximately logarithmic) perception hears it best. Companding basically rescales (in a reversible way) to reduce that issue.

The companding step is lossy, but since the signal to noise ratio is better than linear PCM in the same amount of bits, it provides quality improvements - and rather useful whenever you are bandwidth-limited.


Both μ-law and A-law are used in analog and digital telecommunication (in analog it was mostly for quality, in digital tranfer it was also handy for compression), in different countries.

The .au sound format uses μ-law.



See also:



See also:

-->

Continuous wave modulation

Amplitude Modulation (AM)

Frequency Modulation (FM)

Phase Modulation (PM)

Related: Dimming practicalities

Pulse modulation

Pulse Amplitude Modulation (PAM)

Pulse Skip Modulation (PSM)

Pulse Position Modulation (PPM)

Pulse Density Modulation (PDM), Delta-Sigma modulation (ΔΣM)

Practical notes

PWM Types

PWM for average energy

Hardware PWM, software PWM, and inbetween

PWM or PDM as a simple DAC

Sound PWM

On PWM resolution

On PWM distortion

On PWM oversampling

Unsorted

On PWM filtering

PWM IC notes

TLC5940

PCA9685

Comparing PDM and PWM

Combining PWM or PDM outputs for bit depth

Modulating data to send: ASK, FSK, PSK

https://en.wikipedia.org/wiki/Amplitude-shift_keying

https://en.wikipedia.org/wiki/Frequency-shift_keying

https://en.wikipedia.org/wiki/Phase-shift_keying