Gerymake
Posts: 50
Joined: Sun Jan 06, 2019 11:38 pm

Electronics for an indoor plant automation system

Fri Jan 03, 2020 3:24 pm

Hello,

I am planning on building an indoor plant automation system but I have certain questions regarding the electronics, more precisely, the lamp and water pump circuit. My top priority is saftey, I am not used to dealing with high currents since I am a hobbyist so if there is something dangerous that may go wrong, please let me know.

This being said. I believe that the circuit diagram that shows what I have in mind should run flawlessly. Nevertheless, I am not so sure about which specs the power supply should have. I share the links to the exact products I intend to buy.
Water pump: https://www.amazon.es/dp/B07KJK6S4H/?co ... _lig_dp_it [In a picture, they recommend using a 12V, 1A power supply]
Power supply: https://www.amazon.es/dp/B071S77653/?co ... _lig_dp_it [Up to 12V, Power=24W]
Fluorescent light: https://www.amazon.es/dp/B013BEYGI8/?co ... lig_dp_it [V=12V, Power=4.5W]
Relay: https://www.amazon.es/dp/B00E0NTPP4/?co ... _lig_dp_it
PI: Raspberry Pi Zero WH

Is the power supply suitable for this purpose? Should I use two separate power supplies for the water pump and the fluorescent light? If you look carefully, there is a button to switch the light on and off, if I connect it to the relay and switch the button to ON, I should be able to control the light from the PI, shouldn't I? Could it be dangerous?

NOTE: I would run this under my supervision at first but I intend to make it permanent.

Thanks,
Attachments
CIRC_bb.png
CIRC_bb.png (162.34 KiB) Viewed 989 times

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Electronics for an indoor plant automation system

Fri Jan 03, 2020 6:08 pm

Pump: 12v, 1a = 12W
Light: 12v, 4.5W
Relay and rpi : not a lot of consumption, do not care

Total 16.5w
Supply can deliver up to 24w => OK!

The wiring seems good.

You can power the rpi with the 12v supply adding a regulator.

Small voltage and low power, isolated from the main suply, no specific need nor possible danger.

Just wire and have fun!

Gerymake
Posts: 50
Joined: Sun Jan 06, 2019 11:38 pm

Re: Electronics for an indoor plant automation system

Sat Jan 04, 2020 9:50 am

nomdediot wrote:
Fri Jan 03, 2020 6:08 pm
Pump: 12v, 1a = 12W
Light: 12v, 4.5W
Relay and rpi : not a lot of consumption, do not care

Total 16.5w
Supply can deliver up to 24w => OK!

The wiring seems good.

You can power the rpi with the 12v supply adding a regulator.

Small voltage and low power, isolated from the main suply, no specific need nor possible danger.

Just wire and have fun!
Do you mean powering the Pi via the same power supply through the 5V pin? I have read it somewhere but it might not be the best idea since you remove the protection of the board.
And what about the button of the fluorescent light. Can it affect the wiring? I mean I guess that if I switch it to ON then I could drive it from the Raspberry Pi and if I wanted to manually turn it off I could switch the button.

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

Re: Electronics for an indoor plant automation system

Sat Jan 04, 2020 12:53 pm

The first thing to check would be that you pi is actually able to drive the relay board as many of them are designed to work with the 5V of the Arduino not the 3.3V gpio.

See my post on this thread https://www.raspberrypi.org/forums/view ... 3&t=261056
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Electronics for an indoor plant automation system

Sat Jan 04, 2020 2:24 pm

About the power supply, don't worry, you can supply with the same one. Just need a regulator to convert 12V to 5V to supply the Pi. Do not apply 12V to the Pi directly, you will destroy it.

About the switch, I'm not sure what you want to do but I think you can simply add it in parallel to the contact of the relay which is driving the light. Switch closed = light ON, switch open = light controlled by the Pi.

Gerymake
Posts: 50
Joined: Sun Jan 06, 2019 11:38 pm

Re: Electronics for an indoor plant automation system

Sat Jan 04, 2020 6:34 pm

pcmanbob wrote:
Sat Jan 04, 2020 12:53 pm
The first thing to check would be that you pi is actually able to drive the relay board as many of them are designed to work with the 5V of the Arduino not the 3.3V gpio.

See my post on this thread https://www.raspberrypi.org/forums/view ... 3&t=261056
Alright, I have been doing some research and I believe I get what you mean. I have seen several videos which claim that you can connect VCC to 5V and use the 3.3V GPIO without turning on the switch or you can use 3.3V for the VCC as well and it should work (https://www.youtube.com/watch?v=b6ZagKRnRdM&t=1s, MIN - 7:40). Nevertheless, instead of using an array of transistors (like you mention in the post you shared) to get the GPIO voltage to 5V, wouldn't it be better to use a nMOSFET directly?

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

Re: Electronics for an indoor plant automation system

Sat Jan 04, 2020 8:02 pm

Some relay boards will work like that , but many have the opto isolator LED in series with the indicator LED and a resistor which means the 3.3V gpio is not able to power the circuit as insufficient current will flow to turn the LEDs on.

The 2N2222 transistors or the ULN2803A are switching the ground to the IN pin on the relay board, assuming your relay board is active low, most are.

I guess you could use 4 x MOSFETs, but how would the cost compare to 4 X 2N2222 and 4 X 1K resistors or a single ULN2803A chip.

It's your project so you can build the interface circuit with what ever you like as long as it does the required job.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Gerymake
Posts: 50
Joined: Sun Jan 06, 2019 11:38 pm

Re: Electronics for an indoor plant automation system

Sun Jan 05, 2020 4:53 pm

I have been doing some research and I am starting to get how the circuits works (there were many concepts such as opto-isolators that I did not understand). Anyway, the link you shared (https://www.raspberrypi.org/forums/view ... hp?t=84337) shows many circuits. There is a discussion about which one is better (at this moment I would probably say number 3, because if you have common grounds the isolation stops working), could you clarify it? Furthermore, I know that it is not necessary to use a separate power supply for VCC and JD-VCC, why should I? (I guess the power consumption of the relay is too high for the GPIO pins).

I am slightly confused about the power supplies as well. I need to power the PI, the light, the water pump and the relay. I was thinking about using a separate power supply for the Pi (which will be connected to a few sensors), then the same power supply for light (12V), water pump (12V) and the relay (5V, with a 7805 voltage regulator).

Thanks,
Gerard

NOTE: Circuit of the exact relay I will be using
2cha2.jpg
2cha2.jpg (182.55 KiB) Viewed 738 times

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

Re: Electronics for an indoor plant automation system

Sun Jan 05, 2020 9:10 pm

Looking at the diagram of you relay board , your best option ( in my opinion ) would be to connect the jumper on J5 VCC - RY-VCC and just connect 5v to VCC and ground to ground, using your 7805 ( you would be better using a DC-DC buck converter , more efficient less heat output. )

Then use a driver circuit like this to connect you relay board to the pi 3.3v gpio.

Image

there are 2 reasons for doing it this way ,
1. if you try powering VCC from the 3.3v pin on the pi its unlikely to work because you have 2 x LED's and a 1K resistor in series.

2. powering VCC from 5V means you are using the gpio output to ground a 5v circuit not good for your pi.

by using the transistors you are grounding the 5v circuit via the transistor which is being switch on using the gpio 3.3v output.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

OmnIoT
Posts: 43
Joined: Mon Aug 13, 2018 8:29 am
Contact: Website YouTube

Re: Electronics for an indoor plant automation system

Tue Jan 07, 2020 8:22 am

You might look at this -

https://www.digital-loggers.com/iotfaqs.html

It'd be a safe option with not much investment (I think I paid about $25 delivered) and can be easily controlled using the Pi's GPIO's. Actually, here's a video showing it controlling a lamp based on the light level reading from a BLE sensor:

https://youtu.be/kEgvEpwTl1o?t=10

Return to “Automation, sensing and robotics”