1

I'm a new user of raspberry pi 2. I'm preparing a school project and I wonder how many sensors I can plug in to my raspberry pi.

I would like to connect 3 sensors:

  • PIR sensor
  • DHT22
  • DS18B20

Will it work on the one breadbord? I don't want to damage any sensor or my raspberry pi and I hope somebody more advanced in electronics can give me some tips or take a look on my photos :)

enter image description here

enter image description here

  • 1
    You should not have a problem with what you listed above, you may need to modify the pins used. The bigger question is why do you think there will be a problem and what have you tried, why are you using two different temp sensors? As for damaging a sensor - it will happen eventually and is part of the learning curve. – Steve Robillard Sep 8 '15 at 11:07
  • :D I would like to avoid damaging anything :P Why do I need to modify pins? Could you please help me :) – Anna K Sep 8 '15 at 11:24
  • It looks like you have already tried the sensors and code (based on the pictures) I am assuming you followed some tutorials. If for instance 2 of your sensors want to use the same signal pin (not VCC and ground) you will have a conflict, and need to reassign one of the sensors to use a different pin – Steve Robillard Sep 8 '15 at 11:29
  • Thank you :) I understand this point. Is it ok on the breadbord, I'm not sure if I understand how it works :( One sensor can not be connected in the one line as we see on the second image? Or if I avoid connecting sensors close to each other it will be ok – Anna K Sep 8 '15 at 11:50
  • 2
    If you are unsure how a breadboard works check this out learn.sparkfun.com/tutorials/how-to-use-a-breadboard. it should answer your question. – Steve Robillard Sep 8 '15 at 11:58
2

In direct answer to your question, it depends on the size of your breadboard! Looking at what you've got, there is more than enough room for the three sensors you are proposing, although it'd difficult to identify what's connected to what from the photies. A Fritzing diagram might help?

There are (if I remember correctly) about 26 GPIO pins on the RPi 2, so you can get 26 sensors at least. However, remember that the Dallas one-wire sensors such as the DS18B20 allow several of the same device to be connected to the same pin. They use an in-built serial number to distinguish devices.

My approach is to connect one sensor at a time. Build your knowledge and code progressively. Then you get to a point where you realise that your code is really ugly and you should re-write it (more efficiently and elegantly). But then you can re-write it with the knowledge you've gained in the process. Evolution not revolution.

One final point. The RPi and linux community are really supportive and will always help when you need it (if you're polite). There are loads of tutorials out there - use them, change them, learn from them. Then ask questions to build on your understanding. It's good to see you are concerned about frying your pi (been there, done that) so it shows you have a good basic understanding.

Final, final point. Enjoy the RPi. It's a brilliant device that will teach you so much.

1

3 sensors, no problem! (In general).

Its really more a question of what interfaces you are connecting the sensors to. The Pi has 4 main interfaces that are easily accessible from the 40 pin header: I2C, SPI, UART, and GPIO.

Each sensor must be hooked up to an interface that it is compatible with, and often sensors can be hooked up to more than one interface. For example, a quick search shows the DHT22 would be hooked up to a single GPIO pin (of which the Pi has 26 readily available).

Each one of the interfaces has its own limits, but they all can be expanded upon as well. For example, if you needed more GPIO pins, you can add a chip called a GPIO expander.

  • Thank you :) and can I use one 3,3V pin to deliver tension to DHT22 and DS18B20. I mean 1 cable: Pin 1 Raspberry pi to breadbord "+ red splint" and then I take tension from red splint: 1 cable to DHT22 and 1 cable to DS18B20 ?? Is it correct? – Anna K Sep 8 '15 at 18:50
  • @user3904216 Yes, you only need to connect one ground to the breadboard ground rails (conventionally labelled blue - on your breadboard). Note that the two power rails are not connected to each other (neither are the ground rails). That means you could connect 5V to one power rail and 3V3 to the other if you had some sensors which needed 5V and some which needed 3V3. – joan Sep 8 '15 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.