analog pins and resistors

my question is very simple, Do I need to connect resistors to any electronic component connected that outputs analog signals? and why?, and what happens when I don't do that?


Too general to answer. What components?

like for example viewing some examples of books, piezo sounders connected to analog pins I see that uses resistors, flex sensors, ultrasonic rangefinders, LDR (another resistor than itself) too... but in accelerometers I don't see that uses resistors.

Those sensors are using the resistor either as part of a voltage divider (because the sensor's resistance changes) or as pull-ups because the output is open-collector. In the case of the accelerometer it make just be outputting a voltage.

Thanks for the info, the open collectors clarify the questions about resistors in IC, but Do I need to suppose open collectors are used in all IC that outputs analog signals, or like the ICs, depend on the manufacturer?, second as I said before it clarify the question only for the ICs, seeing this circuit for example

to me, It's like is a pull resistor, then my next question is.... components based on variable resistors can generate an open circuit, or that image uses the resistor as a divider?, and how do you identified that was a pull resistor/divider (because to me It's a pull resistors because provides a path to 5v or GND)


Its a load resistor for the piezo element to set the sensitivity. Piezo elements push charge around as they flex, without the
resistor the votage could be very high (the input protection diodes in the 328 would come into play in fact), and the waveform
would look fairly square. With the resistor the charge flows through the resistor generating a more modest voltage that can
be measured. As it stands the waveform is centred about 0V so you'll only get half cycles.

Basically anything you want to measure with the ADC inputs has to be converted to a voltage (if not already). Sometimes
there needs to be components to effect this (be it a resistor as here, an amplifier for small voltages, or a buffer for
high impedance signals).

Digital inputs also need a voltage (but it should be either HIGH or LOW).

pull-ups for a open-collector sensor are really a special case of a buffer for a high impedance signal (an open-collector output
is sometimes low impedance and sometimes high impedance, the pull-up limits the maximum impedance to that of the pull-up.
Well its one way to think about it. You can also think of it as the load resistor for the open-collector output.

the open collectors clarify the questions about resistors in IC, but Do I need to suppose open collectors are used in all IC

You are trying to generalize way too much into a single statement. How things are designed depends on the intended application.

A very simple thought is that IF you are unsure and it's an output use a 220R resistor which will limit the current to 22 mA out/input to an output which will prevent most common output issues except tying the outputs voltages greater than to Vcc or Gnd and 1 K resistors on the inputs in case the measured voltage is 12 V to about 20V which will limit protection diode current to 20 mA max and while that night not be enough margin or any kind of long term usage. It will work for troubleshooting and it will not cause fires. With some very careful layout and circuit inspection limit the scope of the possible damage.. Somewhat. It is also the way we learn best...
from our mistakes..
Pain IS the Best Teacher...
Just think... If Tea and Cookies worked, the inquisition would have been a much 'nicer' piece of history.
Quartermaster overheard to Atilla...
We are just simply out of those butterscotch yer honor, can I substitute a whip and club until we restock..?