This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Relay doesnt work toggling GPIO Output? how can pull it down

Hi triying to drive a Relay with Output but have tried every functon in "nrf_gpio.h"

this works with a LED perfectly : nrf_gpio_pin_toggle(23);

in the main i configure :

nrf_gpio_cfg_output(23); nrf_gpio_pin_write(23, 0);

but the relay dont change state with Toggle, with STM32 i change the pullup, pulldown configuration and it works, i have to send a "0v" signal for the Relay to change state to off, and a voltage to go on.

how can output configuration be change in a output pin? thanks.

Parents
  • Hello acidguy

    When a pin on the nRF51822 is configured as an output, setting it high will source current, and setting it low will sink current. The exception to this is if you specifically configure it to disconnect on either high or low. As long as you haven't done that, there is no need to use any additional pull-up or pull-downs.

    As RK mentioned driving a relay straight from a GPIO may not be the best idea. The GPIO are limited in how much current they can source/sink, as well as how large voltage they can withstand. See page 38 and 66 of the nrf51822 product specification for the absolute maximum ratings and the electrical specifications of the GPIO respectively.

    I found the datasheet for the relay in your picture. Its markings indicate that this relay has a nominal coil voltage of 12VDC, and a nominal coil current of 30mA. Both of these are far beyond what the nRF51 is capable of producing, and I would recommend you use a proper relay driving circuit.

    You mention it is already driven by a transistor, do you have a link to the specification of the specific module you are using?

    Best regards

    Jørn Frøysa

Reply
  • Hello acidguy

    When a pin on the nRF51822 is configured as an output, setting it high will source current, and setting it low will sink current. The exception to this is if you specifically configure it to disconnect on either high or low. As long as you haven't done that, there is no need to use any additional pull-up or pull-downs.

    As RK mentioned driving a relay straight from a GPIO may not be the best idea. The GPIO are limited in how much current they can source/sink, as well as how large voltage they can withstand. See page 38 and 66 of the nrf51822 product specification for the absolute maximum ratings and the electrical specifications of the GPIO respectively.

    I found the datasheet for the relay in your picture. Its markings indicate that this relay has a nominal coil voltage of 12VDC, and a nominal coil current of 30mA. Both of these are far beyond what the nRF51 is capable of producing, and I would recommend you use a proper relay driving circuit.

    You mention it is already driven by a transistor, do you have a link to the specification of the specific module you are using?

    Best regards

    Jørn Frøysa

Children
Related