User avatar
paolol61
Posts: 3
Joined: Tue Jun 26, 2018 12:33 pm

Connect a second sensor

Tue Jun 26, 2018 12:46 pm

Hi, I'm new to eletronics, so it my be a stupid question but I will like to add a second sensor to my project .
I have a temperature sensor (AM2303) all works fine, but now I will like to add a second sensor (MQ135) , but don't know where I have to connect the output to the GPIO the other sensor is using pin 7.

Thanks

pcmanbob
Posts: 4094
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Connect a second sensor

Tue Jun 26, 2018 2:32 pm


I have a temperature sensor (AM2303) all works fine, but now I will like to add a second sensor (MQ135) , but don't know where I have to connect the output to the GPIO the other sensor is using pin 7.
Hi.

Looking at the specifications for the MQ135, it looks to have a analogue voltage output that increases with the increase of gas concentration.

As the pi has no analogue ports you will need to add an analogue to digital converter like the MCP3008 to interface the sensor to your pi.

some examples of how to use the MCP3008 on the pi.
https://pimylifeup.com/raspberry-pi-adc/
http://www.instructables.com/id/ADC-MCP ... pberry-Pi/
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

User avatar
The Traveler
Posts: 361
Joined: Sat Oct 21, 2017 3:48 pm

Re: Connect a second sensor

Tue Jun 26, 2018 2:41 pm

Or purchase an Arduino which has built in analog inputs and interface it to a Raspberry Pi. A fairly common, but somewhat more complex solution.

Cheers.
Retired IT professional, C programmer and "beardie weirdie".
RPi interests: Developing an Infinite Improbability Drive
“Thinking outside of the box allows you to get rewards outside of your reach.” Matshona Dhliwayo

User avatar
paolol61
Posts: 3
Joined: Tue Jun 26, 2018 12:33 pm

Re: Connect a second sensor

Wed Jun 27, 2018 7:40 am

Hi thanks for reply , but still the question is where I can connect a second sensor??
I will use the MCP3008 as per the project but can I connect both signal to the pin 7 or I need to use a separate pin ??

Thanks

scotty101
Posts: 2987
Joined: Fri Jun 08, 2012 6:03 pm

Re: Connect a second sensor

Wed Jun 27, 2018 8:34 am

A MCP3008 (or any SPI device) will connect to the SPI pins seen on this link https://pinout.xyz/pinout/spi

No conflict with pin 7.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

pcmanbob
Posts: 4094
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Connect a second sensor

Wed Jun 27, 2018 11:04 am

paolol61 wrote:
Wed Jun 27, 2018 7:40 am
Hi thanks for reply , but still the question is where I can connect a second sensor??
I will use the MCP3008 as per the project but can I connect both signal to the pin 7 or I need to use a separate pin ??

Thanks
So the MCP3008 will connect to the following pins

VDD (Pin 16) wire this to 3.3V
VREF (Pin 15) wire this to 3.3V
AGND (Pin 14) wire this to ground
CLK (Pin 13) wire this to GPIO11 (Pin 23/SCLK)
DOUT (Pin 12) wire this to GPIO9 (Pin 21/MISO)
DIN (Pin 11) wire this to GPIO10 (Pin 19/MOSI)
CS (Pin 10) wire this to GPIO8 (Pin 24/CE0)
DGND (Pin 9) wire this to GROUND

you will then connect the analogue output of the sensor to one of the analouge input pins on the MCP3008, you will need to make sure the output of the sensor is limited to a maximum of 3v, so if the output is 0 to 5v then you will need to use a potential divider to reduce the voltage.
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

User avatar
paolol61
Posts: 3
Joined: Tue Jun 26, 2018 12:33 pm

Re: Connect a second sensor

Fri Jun 29, 2018 7:11 am

Thanks a lot

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests