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

Unable to get ADC results using accelerometer

hi, i am working on ble_app_uart_simple_adc example which is referred from the link github.com/.../nrf51-ADC-examples i flashed the code successfully. and detecting the device using NRFTool box application. during the circuit setup i connected accelerometer(ADXL335) Z- output to the p0.01 of the nrf51 development kit and connected ground. after connecting to the device through nrftool box UART application. the log file showing unknown values(strange symbols). how to get accelerometer z output values using this ble_app_uart_simple_adc example code.

Parents
  • Hi

    The nRFtoolbox UART app is probably receiving the correct ADC values, but it displays the values as ascii characters. If you would instead send readable ascii characters, then the nrftoolbox UART app would be able to display it correctly. E.g. if you would write the adc_event_handler as follows:

    static void adc_event_handler(nrf_drv_adc_evt_t const * p_event)
    {
    	uint8_t adc_result_temp[] = {'c','a','f','e'};
    	
    	if (p_event->type == NRF_DRV_ADC_EVT_DONE)
    	{
    		ble_nus_string_send(&m_nus, &adc_result_temp[0], 4);
    	}
    }
    

    it would write "cafe" in nRFtoolbox. If you want to see the real ADC values however, it is better to connect with nRF Connect app, then you see the raw hexadecimal values instead of ascii characters.

  • Thanks for the reply Stefan, I understand what you conveyed there. I have used example at github.com/.../nrf51-ADC-examples and getting 1023 decimal value if analog pin p0.01 is connected to VDD and 511 if I left it open in air. I am using ADXL335 that has 3.3v connected to its VCC.

    When I connect accelerometer xout to the p0.01 decimal value sent to uart and nrfconnect app keeps on increasing (for e.g. 241 to 468) even I have accelerometer idle. Can you tell me, where could I have possibly gone wrong and what is the ADC configuration I should be using ?

    If you can also let me know what should be my interfacing setup it would be of a great help.

Reply
  • Thanks for the reply Stefan, I understand what you conveyed there. I have used example at github.com/.../nrf51-ADC-examples and getting 1023 decimal value if analog pin p0.01 is connected to VDD and 511 if I left it open in air. I am using ADXL335 that has 3.3v connected to its VCC.

    When I connect accelerometer xout to the p0.01 decimal value sent to uart and nrfconnect app keeps on increasing (for e.g. 241 to 468) even I have accelerometer idle. Can you tell me, where could I have possibly gone wrong and what is the ADC configuration I should be using ?

    If you can also let me know what should be my interfacing setup it would be of a great help.

Children
No Data
Related