Hi All, wondering if I can power a small relay off the GPIO output to power an external device that only boots after DHCP is running. Problem i have is Our device needs the DHCP to be running at boot, DHCP seems to take a while in the TRB-140.
Powering up another device from GPIO should be possible by executing a script, I am also assigning you a connection diagram for your scenario here.
To achieve this configuration a simple startup script that checks if the DHCP server is running is required. To create a startup script for your device, you need to follow the instructions that are covered in our wiki article.
I have wrote you a script that should be used in your startup script file for this solution, although it might need some adjustments:
#!/bin/sh
if ps | grep -q “[d]nsmasq”; then
echo “DHCP server is running.”
ubus call ioman.gpio.dio0 update ‘{“value”:“1”}’
else
echo “DHCP server is not running.”
fi
You might consider changing the “ioman.gpio.dio0 to oman.gpio.dio1” depending on which pin your setup is using.