Raspberry Pi Wifi enabled 4-way power box

Oh, I think I understand what you are seeing. Thanks for the photo.

You are correct in saying transistors or FETs can provide buffering and voltage translation. The transistors in this case appear to be on the other side of the optoisolator on the JD-VCC rail. It is not for buffering of the GPIO but instead they act as a switch to interrupt the current through the coil in the relay (because of the high current inductive kick when switching it on/off could blow up the isolator otherwise). The buffer is the optoisolator but it is for buffering the IO signal for on/off.

The PI side is on the opposite side of the optoisolator on the VCC rail.

The way the power on the two sides are decoupled from each other is by the two pin jumper. When the jumper is in place the VCC rail is shorted to the JD-VCC rail. When the jumper is removed, you have the VCC driving the GPIO side and pin 2 of the two pin jumper is used to provide power to the JD-VCC rail (opposite side of the isolator, relay coil, transistors, etc.) If you remove the jumper, the JD-VCC is effectively powered-down until power is supplied to pin 2 on the two pin header.

There is a schematic I had posted earlier in the thread which is easier to decipher than looking at the PCB.

There is no active buffering on the IO entering the PCB. What you have in series is an LED, then the transmitter side of the isolater (also an LED), a current limit resistor, and then VCC. What you do get is a bunch of voltage drop from the LEDs and the limiting resistor. The more I look at it the more I’m thinking it may be sufficient to ensure any voltage appearing at the uP is generally below the 3V3 rail (when both rails are driven to 5V).

edit: With the close-up photo, I found the datasheet for the optoisolator. :+1:
http://henrysbench.capnfatz.com/wp-content/uploads/2015/05/817C-Optocoupler-Datasheet.pdf

The transmit side LED notes a forward voltage of 1.2V. Just going by that, you’d have 5 - 1.2V = 3.8 volts. Then you have another drop from the second LED along with the current limit resistor (which has no value in the schematic).

With the additional drop, I’m guessing the voltage will below the rail. But, I’d measure it to make certain that’s actually the case (for longevity of the device). When using 5V on both VCC and JD-VCC, that is.

2 Likes

When you say “this one” do you mean the one in the original post or the relay shield @WMoon518 linked to that stacks on top of the Pi?

I know just enough about this stuff to be thoroughly confused at this point as to which one (the relay board in the first post or the shield version) will or will not be safe to use with the Pi.

So far, Im not sensing any consensus on this…??

1 Like

You can semi-ignore what I’ve been rambling about. I was referring to the one in the OP. The Sunfounder one on a detail that caught my attention when looking at the schematic. Not wanting anyone’s experience to be bad. Or, I could’ve be looking at the wrong PCB. idk.

Oh, congrats on becoming a programmer.

1 Like

Ah I found the schematic you posted previously. I understand what you’re getting at now. This makes a lot more sense.

The LED is red, and those typically have a 1.8V drop, so with the opto that’s probably going to be 5-1.2-1.8=2V.

2 Likes

:+1: Ok, good. Thanks for looking at that.

Folk following this thread, ignore what I’ve been yammering about. :stuck_out_tongue_winking_eye:

2 Likes

I’m just glad we know for sure. :joy:

Don’t want my pumps to stop getting switched some day when I’m out of town.

2 Likes

Ok, Im ready to order parts and dive in - but - I need to know how the system handles power failures and what it does when the power turns back on. I have no way to test this until after I get parts - which is a bit late. Ive looked through the nodered site, but have found zero information on this.

Can you set the timers so they will automatically start back up - at the beginning - all by themselves, or does a human need to push a button?

I need two different timing cycles to automatically start at power up - can this be done?

Note that I do NOT want the timers to continue where they last left off when the power failed - it needs to be a brand new start from zero.

I don’t know whether they will work with the zero (I am going to look into it) but the 3B(+) can use a (1x)18650 or (2x)18650 set up or a LiPo pack to keep power to the board (the pumps wouldn’t work but the timing would stay current). It works with an LST connection on the Pi, but maybe it could be adapted to connect in line with the Zero. I will let you know what I find.

1 Like

8K
I just thought of something, What powers the Pi itself? Is it the plug that fits into the microUSB? if so, then you would need two plugs to power the system, one for the Pi and one for the “Controlled” plugs, correct?

If you are responding to my question - thats exactly what I DONT want. :slight_smile:

If this is going to work for me, I need the system to power up, and automatically run two different timing sequences from the very beginning.

I do NOT want it to pick up where it left off. Both timing cycles must start over, from the beginning, every time the Pi powers up. Plus it needs to be on an auto-run basis. The timing sequences must start all by themselves as soon as the Pi powers up.

@anon32470837 - You could potentially create a startup script that resets the system time to April 20th, 1969, 4:20pm (or whatever time you decide) and then setup the nodered software triggers accordingly. It would therefore start from “zero” every time it booted.

It would be a matter of creating a simple bash script utilizing the unix/linux “date” command Linux Date Command

And then that script would be placed somewhere that it’ll be triggered at boot. Somewhere in the init scripts (often in /etc/init.d/), I am assuming - but I actually don’t have specific knowledge of Raspian boot/init processes/structure.

Gotta be doable, though.

3 Likes

If the power goes off, the Pi will go off. When the power comes back on, the Pi will restart and NodeRed will also restart. If you have a timer, for feeding, let’s say, that feeds for 10 minutes every hour (starts at 8:00 AM and ends at 8:10 AM, starts at 9:00 am and ends at 9:10 AM, etc), the power goes off at 11:40 AM and comes back on at 1:15 PM, the timer will restart at 2:00 PM and stop at 2:10 PM.

It is my understanding that the timer within NodeRed can be programed with either start time/end time, or immediate start and duration (on for 12 hours/off for 12 hours) have just started looking at it. Do you know much java scripting? It appears that it can be configured through a settings file (settings.js). I would take a look at the users guide, especially the “Configurating Node Red” section.

https://nodered.org/docs/user-guide/

Just started getting back into programming (did a fair amount of C/C+ many moons ago) but it seems fairly straight forward

I reread what you had posted and I was confused (which wouldn’t be the first time, by any means) I wanted to see if I understand. First off, the Pi never “shuts off” the timer will, but not the Pi. That would be like turning on your phone to check for calls, turning it off, then turning it back on 15 minutes later to check again. Second, it sounds like you want to start the Pi from your compressor, to start your pump, to start your compressor. I was really confused. but like I said before, not uncommon.

There are “Hats” for the PI that will sense all kinds of things like humidity, temperature and pressure. I would look into something like that, that may be able to be incorporated into NodeRed so that the pressure reads low, starts the pump, and then starts the compressor either at a certain fluid level, pressure or time. That is one of the nice things about Linux and open source, if you have a problem, someone has probably written something to fix it, because they had the same or similar problem.

2 Likes

Pretty sure he wants the Pi to be off by default. When certain conditions are met (pressure in his tank?) the Pi will be powered up and trigger some specifically-timed, sequential events. Then, when certain conditions are met, the Pi is powered off again. A very unconventional use of a Pi and nodered. Perhaps this is the source of your confusion?

Or, I am totally misunderstanding @anon32470837 as well?

1 Like

But then you would need a timer, to turn on the timer. There are probably better ways to do it. I would say to look at what some of the folks have done with HPA. Something there might be better adapted.

1 Like

I’m pretty sure he planned on using a physical trigger to turn on the Pi, based on some other environmetal factor (tank pressure?), not a timer.

1 Like

Yes, exactly. My situation is not normal.

Thanks to all of you for the help. Im going to try a different, simpler approach to doing what I want.

I may still build one of these to replace all my Sonoff switches, but that will have to wait a bit.

Like I said before, look at some of the posts dealing with Aeroponics, specifically High Pressure (HPA). There you will use pressure to start a pump to make sure tank is full, but a timer and relay to turn on sprayers. Combination of mechanical and electronic.

1 Like

hehehehehe you mean like this long thread on HPA that I started last year :wink:

Its my HPA system Im wanting to add this particular mod to. :smiley:

I would ask the question exactly as you asked it here. I don’t remember anything posted that was close to what you wanted, but if you ask it there, someone who follows that thread may give you something.

I know what you mean though. I tried to do the same thing with one of @Sebring threads, I think, it was around 900 replies at the time. I gave up after the first 4 or 5 hundred and just asked a question.

Yep! OG is a very friendly community, so it’s best to ask the question, even if it’s been asked before. Repeat questions means there is a common problem and repeating the answer will help others find the right answer easier. :wink:

2 Likes