Page 1 of 1
3 sensors and a 4 channel relay
Posted: Sat Sep 16, 2017 2:04 pm
by hojgaard
Hi everyone
I have an idea for a Raspberry Pi project:
I want to control ventilation in 3 rooms in my house based on the humidity. The BME280 sensor is able to read the humidity and the Songle relay should be able to control when the ventilation must be active.
My first concern: is it even possible to attach 3 sensors and a relay to a single Raspberry Pi?
I'm new to all this, so I thought that it would be a good idea to hear your input before I start.
Any input is much appreciated
Thanks,
Carsten
The hardware for the project:
1x Raspberry Pi 2
1 x Songle SRD-05VDC-SL-C
3 x Adafruit BME280
Re: 3 sensors and a 4 channel relay
Posted: Sat Sep 16, 2017 5:35 pm
by QMESAR
Hi
I am no expert with RPI however the BME280 has SPI communication ,SPI you can conect more that one sensor on the same SPI lines and control them each by a GPIO connected to the CS line of the sensor(Chip select) in this way you select the sensor from which you want to get the data and deselect it after words and select the next sensor in my guess is then you need 1x SPI PORT(MISO,MOSI and SCKL) and 3 x CS lines which the RPI should have and 1 GPIO pin for the relay driver .(7 pins )
Hope this helps

Re: 3 sensors and a 4 channel relay
Posted: Sat Sep 16, 2017 10:15 pm
by davidcoton
The Pi has plenty of I/O capacity for your requirements.
You may be able to find a humidity sensor that will work on three different i2c addresses, or on the 1-wire bus. Either will be easier than using BME280 on SPI (on i2c, it appears to have only two selectable addresses).
The relay you link is single channel, and has a 5V coil. You will need additional electronics to drive it. Better to find a relay board (How many channels do you need?) designed to interface to the Pi. Relay coils operating at 5V or more should preferably be opto-isolated from the Pi GPIO. If you are controlling mains, you need to make sure that the board is designed for that. Finally, you must ensure that any mains wiring you undertake is in accordance with local regulations and is safe. Mains voltage can destroy your Pi, your house (fire), or can cause severe injury.
Re: 3 sensors and a 4 channel relay
Posted: Sun Sep 17, 2017 9:50 am
by hojgaard
@QMESAR
Thank you! I have only tried the I2C protocol and didn’t even think about trying SPI.
In the BME280 specification is states that only (I2C) 2 addresses are available. That is why I was concerned if RPi could handle 3 sensors. Next step is to google SPI
@davidcoton
Thank you for all your input! I don't understand what you mean by “controlling mains”? Do you mean the ventilation the relay should control? I already talked to my electrician about the project. He does not know anything about RPi but he will install the ventilation and connect the wires to the relay. So that part is safe
Do you have any suggestions for a better relay board designed for the Pi?
I need to control 3 ventilations, so I guess I only need 3 channels.
I added the following to my to-learn-list:
- How to use the SPI protocol.
- Read about “opto-isolated”.
- Find a relay board designed to interface to the Pi.
Re: 3 sensors and a 4 channel relay
Posted: Sun Sep 17, 2017 10:56 am
by hojgaard
@davidcoton
I have found the specification for the Songle relay. It has a built-in optocoupler:
5V Four 4 Channel Relay Module With optocoupler For PIC AVR DSP ARM and Arduino.
Specification:
5V Relay Module 4-Channel
This is a 5V 4-Channel Relay interface board.
Be able to control various appliances, and other equipments with large current.
It can be controlled directly by Micro-controller (Arduino , 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic) .
5V 4-Channel Relay interface board, and each one needs 50-60mA Driver Current.
Equiped with high-current relay, AC250V 10A ; DC30V 10A.
Indication LED’s for Relay output status.
Application:
Supports all MCU control.
The industrial field.
PLC control.
Smart home control.
Re: 3 sensors and a 4 channel relay
Posted: Sun Sep 17, 2017 11:27 am
by davidcoton
It's a bit difficult to comment: this board is not a "Songle relay", although it may use Siongle relays. Compare the spec of the relay you specified earlier with the board you are quoting now.
The board is not specified for Pi: Pi GPIO outputs are 3V3 and may (or may not) work with a relay board designed for 5V Arduino. This is a different consideration to the relay coil voltage, where 5V is not a problem for the Pi.
The link is for Denmark only, not accessible from UK.
Re: 3 sensors and a 4 channel relay
Posted: Sun Sep 17, 2017 11:31 am
by DougieLawson
You can get over the 3V3 vs 5V0 problem by using a MCP23008 or MCP23017 with Vcc @ 5V0 as an interface between your RPi and your relay board.
http://www.hobbytronics.co.uk/mcp23017- ... nder-board
or
https://www.abelectronics.co.uk/p/54/IO-Pi-Plus
Gives you those.