Barometer Brick example not working?

Discussion in 'UDOO NEO' started by I Hate Google!, Jun 26, 2016.

  1. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    http://www.udoo.org/docs-neo/Hardware_&_Accessories/Bricks_snap_in_sensors.html

    I've copied and pasted the code from the above and get an error like this:

    cat: /sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_raw: No such file or directory

    (much the same for the second "cat") and the end result is I get a syntax error from the shell because the variables are not set.

    I can get down as far as this:

    /sys/class/i2c-dev/i2c-1/device/1-0060

    but that only contains the following:

    -r--r--r-- 1 root root 4096 Jun 26 21:04 modalias
    -r--r--r-- 1 root root 4096 Jun 26 21:04 name
    drwxr-xr-x 2 root root 0 Jun 26 21:04 power
    lrwxrwxrwx 1 root root 0 Jun 26 21:04 subsystem -> ../../../../../../../bus/i2c
    -rw-r--r-- 1 root root 4096 Jun 26 21:04 uevent


    Yours,

    Baffled from England.
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Did you connect the brick after you booted the Neo? Because then you have to restart the module.
    sudo rmmod mpl3115
    sudo modprobe mpl3115
     
    I Hate Google! likes this.
  3. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    I've never actually removed it. I'm actually asleep right now and this is my subconscious writing.

    That's worth a try though. Barometric and temperature are the something that interest me so that brick is a godsend. At least, it would be If I could get it to work. :)

    The more pocesses I "kill" on the A9, the more reliable the M4 output (via serial) becomes. With some tweaks, I might be able to coax it to work enough of the time. Simply a case then of "spotting" rouge data, which should be easy enough with JSON and some string mangling.

    I wonder if turning off the M4 (required for some other modules) might help?
     
    Andrea Rovai likes this.
  4. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Not an electronic sausage unfortunately. Uname gives this just to make sure we're all on the same page:

    Linux udooneo 3.14.56-udooneo-02013-gabdce68 #1 SMP PREEMPT Mon Mar 14 17:12:34 UTC 2016 armv7l armv7l armv7l GNU/Linux

    If that's any help.

    On a hunch, I did look at "dmesg" to see what the kernel was saying and when I try to remove the module (the brick is attached) I get the following error log (nothing on the console).

    mpl3115: probe of 1-0060 failed with error -110

    The same message appears much earlier in boot which, I expect, probably explains what's going on:

    [ 6.070142] fxos8700_probe succ
    [ 6.142828] (stk) :ldisc installation timeout
    [ 6.147040] (stk) :ldisc_install = 0<6>[ 6.149623] CSI: Registered sensor subdevice: fsl_vadc
    [ 6.163080] wait vadc auto detect video mode....
    [ 6.195314] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [ 6.402881] lm75: probe of 1-0048 failed with error -110
    [ 6.913719] mpl3115: probe of 1-0060 failed with error -110
    [ 7.027165] random: nonblocking pool is initialized


    I also note there's an FSCHK recommended here. I'll see if that is related.

    EDIT: fsck doesn't even try to run... (it should warn about a mounted FS).

    Error -110 (might, again I can't be sure) be error 110: ETIMEDOUT (from errno.h)?
     
    Last edited: Jun 27, 2016
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    The only thing I can advise you is to use a clean udoobuntu image. Perhaps someone of the Udoo team can help with your I2C problem? @Andrea Rovai
     
  6. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Thanks Walter that sounds like the way to go. This has a lot do with getting my kids interested in the IoT and computing as a functional part of our lives - not just games!

    However, I'm going to drop it for the moment - I've actually discovered (gasp!) what is potentially a better use of the Neo as a motion sensor which has a number of applications including stabilising my video camera (a project that's driven me nuts for several years!) and even as a seismometer/datalogger.

    I've written a simple kludge in C and it's already thrown me a loop - but it's a different issue so I'll start a thread about it.

    ==========
    QUICK UPDATE: got both the LM75 and the MPL3115 bricks working with a clean install of the minimal image. I haven't tried the desktop image yet as it's way past my bedtime.
     
    Last edited: Jun 28, 2016
    waltervl and Andrea Rovai like this.
  7. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  8. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    I have! Although I used the minimal image rather than the GUI version. I've found the GUI is loading the processor so hard (as discussed elsewhere) it's affecting the serial connection to the A9.

    The shell example to read the barometric brick does give odd results though. The temperature is highly accurate (the LM75 reads several degrees high) but the pressure is off by a huge factor- perhaps 1000x?

    The raw result comes back with figures around 100.9 (unitless) which I assume is supposed to be 1009 millibars or 100900pa. This is a little less than the local weather station is reading, 1016 millbars, but sufficient to get a register of change.

    Exciting stuff!
     
    Andrea Rovai and waltervl like this.
  9. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  10. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Right now, my local pressure (mbar) is 1007 from the nearest station.

    The brick is reading (uncorrected):

    pressure: 99.95125
    pressure: 99.95675
    pressure: 99.9595
    pressure: 99.95775


    TL;DR - I've had a look at the source and it's delivering kiloPascals instead (line 124 where the author kindly noted in a comment):

    *val2 = 250; /* want kilopascal */


    99kpa = 990 millibars

    * 10 to get millibars and *1000 to get pascals.

    So all's well that ends well!
     
    Andrea Rovai likes this.
  11. Girija virupaxi Chougala

    Girija virupaxi Chougala New Member

    Joined:
    Sep 4, 2019
    Messages:
    2
    Likes Received:
    0
    Hi All,

    We are using mpl3115.c - Support for Freescale MPL3115A2 pressure/temperature sensor driver code posted on the Github.


    Link to driver on the Github is https://github.com/torvalds/linux/blob/master/drivers/iio/pressure/mpl3115.c


    We have connected the MPL3115 sensor to IMX8MQ-EVK board.


    We are able to probe the sensor but not able to find a way on how to read from the sensor. We tried to read /sys/class/i2c-dev/i2c-1/device/1-0060/iio\:device0/in_temp_scale but it doesn’t exist.


    We are able to see till /sys/class/i2c-dev/i2c-1/device/1-0060/ but not the iio\:device0/in_temp_scale

    The mpl3115 device is probed successfully and creates a folder /sys/class/i2c-dev/i2c-1/device/1-0060/. But we can’t find iio:deviceX directory or the in_pressure_raw files to access the sensor data.

    We would appreciate if you can help us.


    Thanks,
    Girija
     
  12. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    @Girija Are you using this with a Udoo Neo on a Udoobuntu operating system?
     
  13. Girija virupaxi Chougala

    Girija virupaxi Chougala New Member

    Joined:
    Sep 4, 2019
    Messages:
    2
    Likes Received:
    0
    @waltervl No I am not using Udoo Neo. We are using IMX8MQ-EVK board on Ubuntu operating system. But the drivers used for sensor is same.
     
  14. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580

Share This Page