Interfacing with sensors
Sensors are being incorporated into an increasing number of
embedded systems, from adding accelerometers in mobile
phones to adding water-vapour sensors in microwaves.
System designers that previously worked only in the digital domain
now have to interface with analogue sensors. A sensor’s analogue
signal needs to be digitised to be used by the system, and the signal
path has to go through several stages: amplification, filtering, and
digitisation (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.

Fig. 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. However, 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 digitised 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. Amplifier selection 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 sufficiently
to obtain the desired granularity.
The gain of a basic operational amplifier is set by a network of
resistors, whereas 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 on-board passives, if possible sources of noise on
the board are not taken into account, a board re-spin may be required.
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.
In order to use the sensor’s filtered signal within the system, it is
necessary to quantify the analogue 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 to react to the sensor information. The system’s usage model
defines this speed and resolution requirement. For example, an
accelerometer used on a phone to change the screen 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 application 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 ADC.
These have variable speed and resolution, and can be selected and
programmed on the fly.
Once the signal has been digitised, 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’ s PSoC reduces the complexity of quantifying
the sensor’s signal path by integrating the amplifier, filters, and ADC
into a single device.

Fig. 2: PSoC architecture overview