How do I wire up a sensor with an Arduino?

Hello,

sorry for this newbie question, but I am not sure where to go exactly.

I received some sensor components, and the easiest to get started is a temperature sensor. But the sensor has 3 pins, while the AD converter of Arduino Uno has 7 pins. How would I wire up the sensor to read some value on the host laptop?

In general, for other sensors, what are the important mappings to connect a multi-pin sensor to the Arduino board.

Thanks for some guidance!

You should say what temperature sensor it is. If it's an LM35 for example, which does have 3 wires, 2 of them are power and one is the analog ouput. You can read that analog value on any one of the Arduino analog inputs, with an analogRead() which reads one pin and provides your program with a value of 0 (0V) to 1023 (5V).

http://arduino.cc/en/Reference/AnalogRead

Best thing to do is look at the sensor's datasheet.

Hmm.. just realize that sensor is a bit more complicated than a normal T sensor - apparently it sends a digital signal: http://www.micro4you.com/files/sensor/DHT11.pdf

Hi farsi

This may help:

http://playground.arduino.cc/main/DHT11Lib

Regards

Ray

Thanks Ray for the pointer! I got it working - nice. The PWM pin can be used as input too. I would have looked at the TX pin for serial communication.

Is this 2-way communication on a PWM pin common? When I read the data sheet for the sensor there is:

"When MCU sends a start signal, DHT11 changes from the low-power-consumption mode to the running-mode, waiting for MCU completing the start signal. Once it is completed, DHT11 sends a response signal of 40-bit data that include the relative humidity and temperature information to MCU. Users can choose to collect (read) some data. Without the start signal from MCU, DHT11 will not give the response signal to MCU."

Why would the PWM pin be better than the TX pin for serial communication?

TX pin is designed for UART signalling to another uart device.

It will not communicate easily with devices that use different signally such as I2c or SPI.

You seem to be deeply confused about almost everything. I suggest you start by reading some of the many online basic tutorials or find an introductory book.

Thanks for the clarification, and sorry about asking the stupid questions.

I'll try to summarize my first round of learning in some blog post soon. And I'll try to get some books/look for the book authors then.

PPS the 3 modes of communication with sensors are then SPI, Uart and I2C ?

PPS the 3 modes of communication with sensors are then SPI, Uart and I2C ?

Plus vanilla digital and analog... a switch is a sensor after all, and it's either on or off with a digitalRead(). An LDR is a sensor, and that's analog, so is an LM35 temperature sensor, with a simple analogRead().