When using sensor data, most of the times, the numbers that are visible in the Arduino IDE serial monitor look erratic. To smooth the data, several approaches can be taken:

Filtering can be done in the analog domain, but also in the digital (implies software). In software, tweaks can be programmed on the fly. In hardware, no processing power is used, so the Arduino still responds snappy.

Setting a threshold (output is low below threshold, and high above threshold)
Analog: comparator circuit
Digital: if statement

Clipping off data (input data level limitation)
Analog: zener diode, comparator circuit, decrease of supply voltage or crowbar circuit
Digital: if statement

Low pass filtering
Filters out high frequency spikes.
Analog: resistor-capacitor combination
Digital: barrel shifter with IIR filter (use Filter from the playground)

High pass filtering
Filters out low frequency content, and even DC.
Analog: resistor-capacitor combination
Digital: barrel shifter with IIR filter (use Filter from the playground)

Moving average filtering
Uses a set of consecutive values and calculates the average of these values.

 

Combinations of the above