I'm doing my first Raspberry Pi project, in which I want to get input from several sensors at the same time. I bought a DS18B20 temperature sensor, which is 1wire, and am able to get input with the code from Adafruit's tutorial. But when I wired another sensor, namely a regular photocell which uses GPIO protocol, the temperature sensor stops working. Here I am also using the Adafruit code. It just sends the same value (22 degrees Celsius) over and over again. I have been googling around but not finding any direct information about this. That is why I turn to you people.

Is Raspberry Pi only able to get input from one kind of sensor at a time from all pins? E.g. when the GPIO is turned on, the 1wire is turned off? And how can I go round it if this is the case?

The goal with the project is to use the sensor inputs to do an animation in Processing. I have already been able to set up a Server-client relationship between my temperature sensor code in Python and my code in Processing and that works if the photocell Python code isn't running.

Edit: I'm using BCM pin4 for the temperature sensor and pin18 for my photocell.

  • have you tried the temp sensor by itself? what's the result of using just that one sensor? – stevieb Nov 21 '16 at 15:16
  • Yes, see OP: "and am able to get input with the code from Adafruit's tutorial" – Fantilein1990 Nov 21 '16 at 15:16
  • If you want help please 1) post a photo of the connections between the Pi and the sensors and 2) also describe in words the connections between the Pi and the sensors. – joan Nov 21 '16 at 15:21
  • unless things have changed; 1wire has been hardcoded in the linux kernel to only use BCM pin 4 (physical pin 7), so unless you use that one the 1wire won't work. – linuxgnuru Nov 22 '16 at 23:23
  • @linuxgnuru I have now edited my question with information about which pins I use as input for the two sensors. However, I feel like the question is slightly misinterpreted by all of you, certainly because this is my first question here so I'm not sure how to formulate it. I've tried to understand how 1wire respectively GPIO works, and whether you can use them both at the same time. I haven't found an explicit answer to that. So that's what I wanted to know, IF they can work simultaneously or if there has to be an interruption in 1wire readings to be able to read GPIO and vice versa. – Hanna Tå Dec 5 '16 at 13:41

Your Answer

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

Browse other questions tagged or ask your own question.