Page 1 of 1

Matrix 1-wire problem

Posted: Mon Jan 09, 2017 11:15 pm
by davef
I am trying to read DS18B20 1-wire sensors using code adapted from the Matrix Temperature sensor example, as found at Armworks. I have noticed that the current Wiki example is quite different and appears NOT to be suitable for the NanoPi.


Code: Select all

//temp sensors

  if ((devFD = ds18b20Init(GPIO_PIN1)) == -1)
  {
    printf("Fail to init ds18b20\n");
    return -1;
  }
 
  if (ds18b20Read(temperature1) > 0)
  {
    printf("HotWaterTemp = %s\n", temperature1);
  }
  else
  {
    printf("Fail to get HotWaterTemp\n");      
  }

  hot_water_temp = atoi (temperature1);
  free(temperature1);
  ds18b20DeInit(devFD);

and periodically can get the following error:

Code: Select all

FAHW-Lib: Fail to read /sys/devices/w1_bus_master1/w1_master_max_slave_count/w1_slave

Appreciate any comments.

Thanks,
davef

Re: Matrix 1-wire problem

Posted: Fri Mar 24, 2017 9:59 am
by chensy
Hi,
Our matrix accessories Matrix-Temperature_Sensor is used with DS18B20, inside the example you can refer to
http://wiki.friendlyarm.com/wiki/index. ... _Sensor/zh
Thanks!

Re: Matrix 1-wire problem

Posted: Sat Mar 25, 2017 2:53 am
by davef
chensy,

I believe that for the NanoPi I would need a significantly different code base. For example, with the NanoPi everything is compiled-in and does not use modules.

I lose about 5% of my readings, which is not a significant problem for me.

Thanks anyhow.

Dave