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

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?