TRB-140 enable GPIO when DHCP is up and running?

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.

Thanks!
Chris.

Hi there,

Thank you for contacting us.

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.

PIN3 = dio0
PIN4 = dio1

Sincerely,
Tomas.

1 Like

Excellent, thanks for your help sure i’ll get this working now.
CR

This topic was automatically closed after 15 days. New replies are no longer allowed.