more G-Labs products

Author Topic: chronothermostat with DS18B20 weekly programming  (Read 4269 times)

October 21, 2014, 04:45:43 PM
Read 4269 times

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi Genie,
great project!!!  ;D
I'm waiting for Banana-pi and DS18B20, first to find your project, I finded this:
http://www.raspibo.org/wiki/index.php/Termostato
Do you think is possible install server for data and monitor, in homegenie Banana Pi SD-Card?
http://www.raspibo.org/wiki/index.php/File:Termostato_grafico.png

I want build a chronothermostat with DS18B20 and implement the weekly programming but I don't like the system used in the link http://www.raspibo.org/wiki/index.php/File:Termostato_prog_settimana.png only "N:night" or "G:Day" ...unfortunatly I'm not a developer and search news idea about the weekly programming and web interface.
For example insert a function like "away" or "on/off" or a pir sensor who switch the state on/off when away.
In the next future you have idea about a chronothermostat  weekly?

Thank in advance

Marco

November 08, 2014, 01:12:48 AM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer

November 13, 2014, 12:34:04 PM
Reply #2

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi Genie,
the APP for read the temperature from the sensor DS18B20, work very well.
Tested 3 sensors at the same time and work fine.

An other information please, is possible disable the fahrenheit temperature and view only the grade temperature?

how I can disable the refresh information in the right corner?
Every time the temperature change a windows appear, and the temperature is displayed only in fahrenheit.

thank
Marco


November 13, 2014, 12:49:18 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Marco,

the DS18B20 app was just an early example, so it is not complete.
You can't disable the event notification but it shouldn't popup if the value is the same as the previously reported one.
Later on today I will add the ability to configure the update interval and the unit (celsius/fahrenheit).
If you can test this I will include the app in the next hg update as well.
One question: did you have to "modprobe" for 1-wire modules in order to make it work?

Cheers,
g.

November 14, 2014, 04:09:02 PM
Reply #4

Bitcraze

  • ***
  • Information
  • Full Member
  • Posts: 73
Hi, Marco

How did you get the DS18B20 to work on RPI?

I have it plugged in, as per AdaFruit instructions on GPIO 4 and 1-Wire is enabled. No readings. Must I enable MCP3008 as well?

Any other tricks? Must GPIO be enabled as well?

November 14, 2014, 09:38:07 PM
Reply #5

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi Bitcraze,
sorry but I use bananapi  is little bit different like raspberrypi.

Check two time the wire and pin, if you have use another sensor(possible your is broken) then update homegenie, there is new app by default "One-Wire Devices" enable it, and read instruction : Integrates 1-wire devices as HG modules (linux only).To enable a 1-wire device, its ID must be specified in the module options popup.To find out your connected devices ID, issue from a terminal the command:
  ls -la /sys/bus/w1/devices/"

after the command in the terminal, you need to copy something like this number:
28-00044aXXXX  (Is your sensor if you have one, more like this if you have more sensors) after the command  and put in "devices ID" of the app.

Or you can read this: http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/temperature/

I hope you solve your problem

Marco
« Last Edit: November 16, 2014, 11:35:45 PM by Marco »

November 14, 2014, 09:59:03 PM
Reply #6

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi Genie,
about your request, this is my configuration for bananapi and the commands used for read the sensor DS18B20
thank for the APP, work well

banana pi + HomeGenie_1_00_beta_r411_banpi-armhf-4GB + 3 sensor DS18B20 with resistor of 4700 ohm between  pin 7(GPIO) and pin 1(+3.3 V), pin6 for GND.

updated the system with

sudo apt-get update && sudo apt-get dist-upgrade

update  homegenie

then in the terminal:

cd /home/bananapi/
sudo apt-get install git
sudo apt-get install make
git clone https://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools
sudo make
cd /boot/bananapi/
sudo /home/bananapi/sunxi-tools/bin2fex script.bin bananapi.fex
sudo nano bananapi.fex

Information: add the following at the end, save (CTRL + O) and close
[w1_para]
gpio = 4

then use the command below

sudo /home/bananapi/sunxi-tools/fex2bin bananapi.fex script.bin
sudo reboot

After reboot I can see the sensors and use ID for APP with command:
ls /sys/bus/w1/devices
28-00044a3XXX  28-00044aXXXX  28-00044XXXXX  (the numbers are the 3 ID-sensor,  because I used 3 sensors)

Marco

« Last Edit: January 01, 2015, 10:20:47 PM by Marco »

November 18, 2014, 08:25:24 PM
Reply #7

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi,
sometime I have a wrong read of sensor, it's normal?

root@lemaker:/sys/devices/w1_bus_master1/28-00044a3866ff# cat w1_slave
ff ff ff ff ff ff ff ff ff : crc=c9 NO
52 01 55 00 7f ff 0c 10 53 t=-62

and the APP read negative value  -0.1 °C

I use three sensor at the same time and casually the read temperature of one, is wrong..
In the link down, (Reading temperatures on a Raspberry Pi using DS18B20 sensors - part 2), speak about an error of read, is possible read again the value and don't view the wrong value in the app?

http://raspbrew.tumblr.com/

thank
« Last Edit: November 18, 2014, 08:37:32 PM by Marco »

November 18, 2014, 09:20:51 PM
Reply #8

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Marco,

the app doesn't check against the CRC line, which supposingly tells if the reading was correct.
Add the follwing instruction before line #56:

Code: [Select]
          if (data.Count > 0 && data[0].Contains(" crc=") && data[0].Contains(" NO")) continue;

Also the parseTemperatureData function could be optimized... the code is very approximative.... for example if the temperature value is always placed on the 2nd line, there's no need of using a for iteration (or at least should be break once the temp value is found).


Cheers,
g.

November 19, 2014, 10:31:19 PM
Reply #9

Marco

  • **
  • Information
  • Jr. Member
  • Posts: 36
Hi Genie,
thank for the fast answer.  :)

First to add the instruction, I tested five sensors and obtained less errors when I used only one  resistor of 1200 ohm.
I think obtain better temperature value, When I use 5 V and not 3.3 V, in the future I will connect it with long wire.
I hope this is useful for other forum users.

Thank 
Marco