Milosh10.5
Posts: 2
Joined: Mon Jun 03, 2019 10:30 pm

Need 4 inputs to trigger 4 outputs.

Mon Jun 03, 2019 10:38 pm

Hello folks. The Great Canadian Hillbilly here.
I'm new to All this. Not really sure if this is what I need.
I would like to pick your collective brains. Here goes.
I want some thing with 4 inputs for sensors and 4 corresponding outputs. If any sensor is activated it triggers the corresponding output and continues to do so as long as sensor tripped. Sounds simple enough, right?
I just have no idea what I would need to buy or how to program it. That's all, lol. Thanks for any advice.
The Great Canadian Hillbilly.

W. H. Heydt
Posts: 10362
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Newbie

Tue Jun 04, 2019 1:09 am

Welcome to the forums.

You need to be more specific. What you described could be as simple as a LED wired to a sensor output or as complex as a supercomputer analyzing the input data over time and determining exactly what is going on and outputing graphical data about the event.

It is worth noting that what you need to use will depend, on part, with the type of sensors and outputs you want. In particular, Pis have no analog I/O pins. Thus you may need a fair amount of additional circuitry or microcontrollers in the interfaces.

PhatFil
Posts: 1247
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Newbie

Tue Jun 04, 2019 2:25 am

As said above .. the options open to you depend on what types of input and output you want to use, where the solution may 'live' may also be important due to extreme conditions? and your budget could also steer the direction you take..

for example in my home automation experiment i take input from the cheapest battery powered sensors that provide temperature, humidity, movement (pir) and door/window status wirelessly and control a/c mains smart sockets also via wifi to turn appliances and lights on/off However my choice to go wireless with sensor and output control carries a cost premium, as a bluetooth temp/humidity sensor (aliexpress etc) costs circa £10 while a number of sensors suitable for direct connection to the pi gpio could probably be sourced for £1. And a wifi smart socket (retail version) will also cost at least a tenner probably £15 against a hard wired relay option that could probably be solved for about 10%.of that cost.

If your worried about giving away hints about your secret project destined to destroy the world or make your fortune, focus on 1 x input or output to start with..

Milosh10.5
Posts: 2
Joined: Mon Jun 03, 2019 10:30 pm

Re: Need 4 inputs to trigger 4 outputs.

Tue Jun 04, 2019 1:43 pm

No world dominating secret projects folks, sorry to disappoint y'all. I want a simple solar sun tracker. 4 sensors correspond to vertical and horizontal axis. What I want is when any one sensor exceeds water the Pi input triggering threshold is, e.g. 6v, it outputs 5+v to trigger a small relay which in turn triggers the relay on my linear actuator. The voltages are not set in stone and can easily be whatever the Pi is happiest with.

User avatar
B.Goode
Posts: 7875
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Need 4 inputs to trigger 4 outputs.

Tue Jun 04, 2019 1:54 pm

The gpiozero python library, a standard component of the Raspberry Pi Foundation Raspbian Stretch Operating System, has simple Recipes that demonstrate this sort of 'if this then that' behaviour:

See the second highlighted block of code here: https://gpiozero.readthedocs.io/en/stable/

W. H. Heydt
Posts: 10362
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Need 4 inputs to trigger 4 outputs.

Tue Jun 04, 2019 2:31 pm

Milosh10.5 wrote:
Tue Jun 04, 2019 1:43 pm
No world dominating secret projects folks, sorry to disappoint y'all. I want a simple solar sun tracker. 4 sensors correspond to vertical and horizontal axis. What I want is when any one sensor exceeds water the Pi input triggering threshold is, e.g. 6v, it outputs 5+v to trigger a small relay which in turn triggers the relay on my linear actuator. The voltages are not set in stone and can easily be whatever the Pi is happiest with.
Pi GPIO pins run on 3.3v.

User avatar
davidcoton
Posts: 3810
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Need 4 inputs to trigger 4 outputs.

Tue Jun 04, 2019 3:57 pm

W. H. Heydt wrote:
Tue Jun 04, 2019 2:31 pm
Milosh10.5 wrote:
Tue Jun 04, 2019 1:43 pm
No world dominating secret projects folks, sorry to disappoint y'all. I want a simple solar sun tracker. 4 sensors correspond to vertical and horizontal axis. What I want is when any one sensor exceeds water the Pi input triggering threshold is, e.g. 6v, it outputs 5+v to trigger a small relay which in turn triggers the relay on my linear actuator. The voltages are not set in stone and can easily be whatever the Pi is happiest with.
Pi GPIO pins run on 3.3v.
+1
Not only is 3.3V required for inputs and supplied by outputs, therefore it is the magic "whatever the Pi is happiest with", but
trying to use any higher voltage directly may destroy your Pi, making YOU very unhappy. :shock:
Signature retired

Return to “Beginners”