Interfacing External Sound Sensor with nRF52832

gopal30 gravatar image

asked 2017-04-21 10:03:00 +0100

I have made following connection between nordic device and external sound sensor:

  1. VCC--> 5V
  2. GND--> GND
  3. GATE --> Pin 04
  4. ENVELOPE --> A0

I would like to know how to proceed with the code in eclipse. i have a code but i am not sure how to proceed with it.

Thanks in Advance

edit retag flag offensive close delete report spam


1 answer

Sort by » oldest newest most voted
Tostikoning gravatar image

answered 2017-04-21 10:12:14 +0100


First have a look at the following tutorial:


Maybe try something simple first, like a blinky application to make sure your toolchain is set up right.

Also, you should try to give us more information about the SDK version you wish to use. If you wish to use a softdevice and other relevant things about your application.

edit flag offensive delete publish link more


Hey Tostikoning i have already tried that example and it´s working perfectly fine. my issue is i am not sure how to build from scratch. i am using SDK_12.2.2.0 and i don´t see any example for external sensor interfacing.

g.joshi ( 2017-04-21 10:25:26 +0100 )editconvert to answer

@gopal30: What kind of sensor are you trying to interface?

Bjørn Spockeli ( 2017-04-21 10:35:57 +0100 )editconvert to answer

I think something like this: https://learn.sparkfun.com/tutorials/... Also what nordic device are you using? nvm, I see nrf2832...

Tostikoning ( 2017-04-21 10:37:30 +0100 )editconvert to answer

@Tostikoning Yes i am using this sound sensor and my nordic device is nRF52832.

g.joshi ( 2017-04-21 10:43:26 +0100 )editconvert to answer

@g.joshi I would start with the GATE. Make pin04 act as an input, and poll this input. To give you a start: nrf_gpio_cfg_input(GATE, NRF_GPIO_PIN_NOPULL); to initialize the pin. To read the pin you need to use: nrf_gpio_pin_read(GATE).

If this works you can try to use the SAADC examples to measure the ENVELOPE pin.

Tostikoning ( 2017-04-21 10:46:55 +0100 )editconvert to answer

static void nrf_gpio_cfg_input(GATE, NRF_GPIO_PIN_NOPULL) static void nrf_gpio_pin_read(GATE


    void soundISR()
      int pin_val;

      pin_val = digitalRead(PIN_GATE_IN);
      digitalWrite(PIN_LED_OUT, pin_val);

    void setup()

      //  Configure LED pin as output
      pinMode(PIN_LED_OUT, OUTPUT);

      // configure input to interrupt
      pinMode(PIN_GATE_IN, INPUT);
      attachInterrupt(IRQ_GATE_IN, soundISR, CHANGE);

      // Display status

Does this makes sense ??

g.joshi ( 2017-04-21 11:22:36 +0100 )editconvert to answer

Yeah sure,

this is Arduino code for interfacing with the sound sensor, but you are not using a Arduino so this code is not compatible.

Tostikoning ( 2017-04-21 11:25:42 +0100 )editconvert to answer

Oh Yes, I messed up . Thanks !

g.joshi ( 2017-04-21 11:27:30 +0100 )editconvert to answer

I managed to get the Digital reading using SAADC but is their i can get the analog output. Thanks in advance .

g.joshi ( 2017-05-15 17:54:03 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-04-21 10:03:00 +0100

Seen: 138 times

Last updated: april 21