Connecting ds18b20 to nrf9160dk

Hi, 

I am looking to connect the ds18b20 sensor to the nrf9160dk. I followed this post, but when I tried running it, I was getting a "create_nordic_project.py failed (1)" saying "error: cmake failed". 

I am a complete beginner when using the development kit so please bear with my questions. 

I have added "CONFIG_GPIO" in the prj.conf file, is there anything else I should be adding. 

Additionally, should I be making changes to the cmake file? The link above only mentioned the .c and .h file so I wasn't sure what else should be changed. 

If anyone could help me with this or could point me to resources that will help me solve this, I would really appreciate it. 

Update : The code is now running without any build errors but not printing any values. I had been using the hello_world sample to run it before which was giving the error, but then I tried switching to the blinky sample and running on that and it's building and running without any errors. (Would anybody know why this is).

My issue now is that it is not printing any values or anything to the Debug terminal on SES or the LTE Link Monitor. Does anyone know why this may be?

Parents
  • Hello Nandini,

    nrffan18 said:
    Also for the temperature reading issue, I noticed this post for a nrf52832- https://devzone.nordicsemi.com/f/nordic-q-a/70069/interfacing-nrf52832-with-ds18b20 where they use an external crystal oscillator as the timer. Do you think this could solve my issue and if that is the case, what would be the equivalent for the nrf9160, I am unable to find it for some reason?

    I’m not quite sure if this is necessary. When running the drivers, are you able to see any traffic on the GPIO pin connected to the sensor? If so, does the bit flow pattern match the sensor specification?

    nrffan18 said:

    Also I eventually will also be inculcating a SD card with the board. So in that case, what pin/pin range would you recommend using for my temperature sensor?

    And what pins should I use for the sd card?

    You can freely decide that for yourself :-) I recommend you having a look at ../<your_build_folder>/zephyr/zephyr.dts. The content of this file gives you a nice devicetree overview of your board.

    Regards,

    Markus

Reply
  • Hello Nandini,

    nrffan18 said:
    Also for the temperature reading issue, I noticed this post for a nrf52832- https://devzone.nordicsemi.com/f/nordic-q-a/70069/interfacing-nrf52832-with-ds18b20 where they use an external crystal oscillator as the timer. Do you think this could solve my issue and if that is the case, what would be the equivalent for the nrf9160, I am unable to find it for some reason?

    I’m not quite sure if this is necessary. When running the drivers, are you able to see any traffic on the GPIO pin connected to the sensor? If so, does the bit flow pattern match the sensor specification?

    nrffan18 said:

    Also I eventually will also be inculcating a SD card with the board. So in that case, what pin/pin range would you recommend using for my temperature sensor?

    And what pins should I use for the sd card?

    You can freely decide that for yourself :-) I recommend you having a look at ../<your_build_folder>/zephyr/zephyr.dts. The content of this file gives you a nice devicetree overview of your board.

    Regards,

    Markus

Children
  • Hi

    thank you for the feedback. I am currently examining the logic for sending/receiving commands to the ds18b20 and I had a question. 

    So in a situation, if I want to let the sensor know that it needs to go into a mode called "skip rom", the master needs to send 0xCC to the sensor starting with the least significant bit (datasheet on page 11). What commands would I use to do this. 

    Additionally after this mode has been set, I would need to call a "Read Scratchpad" function (also on page 11 of the datasheet) by sending 0x44. Would I need to use the same command that I used to send the "Skip ROM" to do this function or is there a different procedure?

    Thanks.

Related