How to keep fully close peristaltic pumps during reboot

I realized that during a reboot or after a shutdown, the GPIO pins are randomly assigned which causes some of my peristaltic pumps gets opened. Is there a way to avoid such behavior? Because this can lead the EC increase drastically that can be deadly for the environment. I am aware that the concentration can be balanced by adding some water into the tank aftwerwards but that needs a manual interference. I would be happier if there is an easier option that can be solved programmatically.

@KyleGabriel how did you overcome such a situation in your automated system? I try to check systemd daemon on the raspberry pi but I need to specifically set certain GPIO pins that belong to my peristaltic pumps as OFF because an accidental reboot or shutdown/boot messes the concentration in tank. I also couldn’t find proper documentation in systemd’s commands, for instance, options for “After”. I need my peristaltic always OFF unless the Mycodo function enables it.

You should always design your circuits for the desired behavior. Since GPIO pins have their voltages float until they’re configured as outputs, you should design your circuits to account for this. There’s no amount of code that can fix bad hardware design/choice. If you want a device to operate a certain way prior to an output being set up, you should design the circuit to work with a floating voltage or prevent the voltage from floating.

Hmm, I didn’t know that. What would you suggest if I, for instance, want to keep certain relays close until the floating part is over? or some keywords would be appreciated as well at least checking for a solution on the Internet. Thanks in advance!

Relays that have high-level triggers near 3.3 volts often will not switch when a GPIO is floating. It sounds like you have a low-level trigger relay, which switches at 0 volts. You may also have a relay that has a normally closed circuit instead of normally open.

I use a 5v 8 ch relay module.

I believe it is the opposite since I need to set the GPIO pin as LOW when I need to close the relay and HIGH for the other option. Isn’t there a chance to float above 1.8V at those pins which is enough to switch the relay?

Probably, but in practice it doesn’t typically trigger the relay to actuate.

A simple and inexpensive approach you can try (rather than buying new relays), is apply a pull-up resistor to keep your GPIO high rather than floating.

1 Like

@KyleGabriel I implemented a pull-down to my relay. Now it works. But interestingly, I can only observe non-floating behaviour during the reboot. If the system gets started from completely off state, I can still observe floating. Is that normal?

I’m not sure. I’ve always designed my circuit to be low/off and high/on, so never had a need to use pull-up or -down resistors for this purpose.

Sorry, if I ask, but I don’t understand how a circuit can be designed to be low/off as default in a floating environment without using a pull-down resistor. I haven’t had any experience with such a thing. Pull-down resistors were also new for me. I really appreciate any help you can provide.

The state of the pin doesn’t have to be 0 for it not to reach the threshold voltage to trigger the relay. The vast majority (or probably all) of relays I’ve used that trigger at 3.3 VDC have remained off until I set the pin High.

1 Like