Provided LM75b temperature sensor does not seem to work

Discussion in 'UDOO NEO' started by RoughingIT, Nov 11, 2015.

  1. RoughingIT

    RoughingIT New Member

    Joined:
    Nov 11, 2015
    Messages:
    11
    Likes Received:
    4
    Hi there, just got my UDOO Neo Full around last week. I decided to flash Udoobuntu and test out the given sensors. The barometric/temp sensor seems to work fine, but the standalone temperature sensor does not seem to do anything at all.

    Using i2cdetect, I can see device 0x48, but the lm75 driver does not get loaded, if I do it manually, I still can't read it.

    I've connected it standalone, or daisy chain it to the other sensor, still the same results. Is there any way I can probe the values directly using i2cget/i2cset from the device?

    Thanks.

    udooer@udooneo:~$ sudo i2cdetect -a -y 1
    [sudo] password for udooer:
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


    udooer@udooneo:~$ ls -l /sys/class/i2c-dev/i2c-1/device/
    total 0
    drwxr-xr-x 4 root root 0 Jan 1 09:00 1-0060
    --w------- 1 root root 4096 Jan 1 09:52 delete_device
    drwxr-xr-x 3 root root 0 Jan 1 09:00 i2c-dev
    -r--r--r-- 1 root root 4096 Jan 1 09:52 name
    --w------- 1 root root 4096 Jan 1 09:52 new_device
    drwxr-xr-x 2 root root 0 Jan 1 09:00 power
    lrwxrwxrwx 1 root root 0 Jan 1 09:00 subsystem -> ../../../../../../bus/i2c
    -rw-r--r-- 1 root root 4096 Jan 1 09:00 uevent

     
    Cyril BOSSELUT likes this.
  2. montella

    montella New Member

    Joined:
    Sep 6, 2014
    Messages:
    15
    Likes Received:
    4
    Same issue with the temperature sensor module.
     
    RoughingIT likes this.
  3. rreignier

    rreignier New Member

    Joined:
    Nov 7, 2015
    Messages:
    8
    Likes Received:
    3
    RoughingIT likes this.
  4. RoughingIT

    RoughingIT New Member

    Joined:
    Nov 11, 2015
    Messages:
    11
    Likes Received:
    4
    Oh man, it's is dark blue! No wonder I missed it!

    Will try this and report back when I'm home.

    Thanks

    Sent from my LG-H815 using Tapatalk
     
  5. RoughingIT

    RoughingIT New Member

    Joined:
    Nov 11, 2015
    Messages:
    11
    Likes Received:
    4
    Ok enabling it works for me. But I do have to reenable it everytime afyer reboot. Thanks.

    Sent from my LG-H815 using Tapatalk
     
    rreignier likes this.
  6. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Yes, that's it. How would you automate the process?
     
  7. RoughingIT

    RoughingIT New Member

    Joined:
    Nov 11, 2015
    Messages:
    11
    Likes Received:
    4
    Sure,

    1. Add the line into rc.local, or
    2. Create an init script for it, or
    3. Check if the file you want exists in your script, if not, execute the new_device line in your code (sudo required of course)

    Sent from my LG-H815 using Tapatalk
     
  8. Vinz87

    Vinz87 UDOOer

    Joined:
    Nov 11, 2015
    Messages:
    105
    Likes Received:
    19
    Hi, my experience is that it actually works, I tested all its functionalities specified in the datasheet, reading temperature with a LSB of 1/16th of a degree: why, instead, using the method described in the Docs the read value is rounded to half degree? Is it intended?
     
  9. Chris Dickerson

    Chris Dickerson New Member

    Joined:
    Nov 20, 2015
    Messages:
    6
    Likes Received:
    2
    The sensor works, here is my script to start the temperature sensor and give the output in Fahrenheit.

    #!/bin/bash

    if [ ! -f /sys/class/i2c-dev/i2c-1/device/1-0048/temp1_input ];
    then
    echo "Temperature sensor is not initialized."
    echo "Enter credentials to initialize..."
    sudo sh -c 'echo lm75 0x48 >/sys/class/i2c-dev/i2c-1/device/new_device'
    sleep 5
    fi

    if [ ! -f /sys/class/i2c-dev/i2c-1/device/1-0048/temp1_input ];
    then
    echo "Something went wrong and the sensor wasn't initialized."
    exit
    else
    echo "The sensor is initialized!"
    fi

    while [ 1 ]; do
    raw="$(cat /sys/class/i2c-dev/i2c-1/device/1-0048/temp1_input)";
    #get raw data from sensor

    cel=$( echo "9*$raw/5+32000" | bc)
    #convert raw data from celsius to fahrenheit

    fah=$( echo "$cel*.001" | bc)
    #correctly place decimal

    temp=$( echo $fah | rev | cut -c 3- | rev )
    #remove trailing 0s

    echo "Temperature: $temp F";
    sleep 10
    done​
     
    Andrea Rovai likes this.
  10. mparkes

    mparkes New Member

    Joined:
    Nov 20, 2015
    Messages:
    5
    Likes Received:
    3
    That's all fine and dandy to get it working after each boot.

    But how can we have it enabled on boot without entering credentials? I'd like to have the temp sensor enabled by default so if udoo loses power and restarts, cron scripts work without issue.

    Thanks in advance
     
  11. Chris Dickerson

    Chris Dickerson New Member

    Joined:
    Nov 20, 2015
    Messages:
    6
    Likes Received:
    2
    As RoughinIT stated before, just add a line to rc.local. so - "sudo nano /etc/rc.local" and add the lines "sleep 1" and then "echo lm75 0x48 >/sys/class/i2c-dev/i2c-1/device/new_device" before the "exit 0"

    Upon testing this before posting it I found that the 1 second sleep was needed to give everything time.
     
  12. Andriy

    Andriy Member

    Joined:
    Nov 10, 2015
    Messages:
    30
    Likes Received:
    2
    sketch (internal or external Arduino IDE) for udoo neo for bricks i2c temperature EXIST???
     
  13. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Not for the moment sorry.
     

Share This Page