Interfacing with Sensors
Embedded systems are utilizing sensors
in designs with increasing frequency, from
adding accelerometers in mobile phones to
adding water vapor sensors in microwaves.
System designers that previously worked only
in the digital domain now have to interface with
analog sensors. A sensor’s analog signal needs
to be digitized to be used by the system, and the
signal path has go to through several stages:
amplification, filtering and digitization (shown
in Figure 1). Each of these stages is normally
accomplished by several external components,
but using the PSoC mixed signal array offers all of
these features in a single-chip solution.

Figure 1. Basic sensor signal path
Each sensor has a different output signal and
range. The output signal can be voltage, current,
resistive, capacitive or frequency based. Since
a majority of sensors output a low level voltage
based signal, this article will assume a voltage
signal is being used.
The output of a sensor can be as small as several
mV and as large as several volts. In order for the
signal to be properly digitized, it needs to be large
enough for the ADC to effectively read the signal,
so most sensor signals will need amplification.
As an example, a typical type K thermocouple
outputs 41µV/°C, which needs to be greatly
amplified if the user would like to read 1°C
granularity. Selection of an amplifier is mainly
based on the amount of gain needed. When
selecting an amplifier, the designer must take
the ADC resolution into account to ensure
that signal is amplified enough to obtain the
desired granularity.
The gain of a basic operational amplifier is set by a
network of resistors. The gain of a Programmable-Gain
Amplifier (PGA) is set digitally. PSoC offers
several types of integrated PGAs which can be
used individually to amplify the signal or cascaded
together for increased amplification.
Noise can come from a number of sources including
board layout, radios, thermal noise and even
the sensor itself. Signal noise not only causes
inaccurate and unstable ADC readings, but amplified
noise also exaggerates the error in the signal.
Signal noise can be quantified as low frequency,
high frequency or a specific known frequency. Most
often the noise is high frequency. To remove noise,
the signal is filtered using low-pass or band-pass
filters. Normally, these filters are implemented
using passives on board. However, if any possible
sources of noise on the board are not taken into
account, a board re-spin may be required. PSoC
integrates programmable filters on board. PSoC’s
low-pass and band-pass filters are 2-pole filters
with configurable corner frequencies. The filters
can even be cascaded to create a filter with up to
8 poles, which is useful for designs that have strict
cut-off needs.

Figure 2. PSoC architecture overview
In order to utilize the sensor’s
filtered signal within the
system, it is necessary
to quantify the analog
signal into the digital domain
using an ADC. Selection
of an ADC mainly revolves
around the system’s requirements
for sampling
speed and resolution. The
sampling speed required
for the system is related to
the sensor’s bandwidth or
how often the system needs
to be updated. The resolution required for the
system is dependent on the granularity needed by
the system to react to the sensor’s information.
The system’s usage model defines this speed and
resolution requirement. For example, an accelerometer
used on a phone to change the screen’s
orientation might only need a 10-bit ADC that
updates several times a second, whereas a load
cell used in a production line might require a 16-bit
ADC updating several thousand times a second.
When selecting an ADC the user has the choice of
using an external ADC or a microcontroller with an
integrated ADC. External ADCs tend to be higher
performance compared to integrated ADCs, but
the majority of sensor applications' requirements
can be met with microcontroller ADCs. Generally,
microcontroller vendors only offer one type of
ADC with their microcontroller that only has the
ability to change speed and resolution. The PSoC
offers several types of ADCs. These have variable
speed and resolution, and can be selected and
programmed on the fly.
Once the signal has been digitized, the user can
integrate the signal with a control system in the
microcontroller or they can pass the data to a
host processor via a communication protocol. The
signal path for a sensor may seem simple, but the
implementation can be convoluted. Cypress’ PSoC
reduces the complexity of quantifying the sensor’s
signal path by integrating the amplifier, filters and
ADC into a single device.