Tag Archives: iot

Sonde température DS18B20 1-Wire intégrée à la ZiBase via Raspberry Pi

 

 

Sonde 1-wire DS18B20

Sonde 1-wire DS18B20

raspizibase

 

 

 

 

 

Pour quelques €uros vous trouverez facilement sur internet des montages avec sonde déjà pré-cablée.

ds18b20 pré-cablée

ds18b20 pré-cablée

Installation Matériel

Sonde 1-wire ​DS18B20​

shema-branchement-DS18B20

Raspberry Pi

Zibase

Installation Logiciel

module ZiBase.py modifié ( ajout méthode setVirtualProbe )

def setVirtualProbe(self, id, value1, value2=0, type=17):
 """
 Cette commande permet au système HOST d’envoyer dans ZiBASE une information de sonde virtuelle
 comme si celle-ci était reçue sur la RF.
 Probe type: 
 17 : Scientific Oregon Type
 20 : OWL Type
 """
 req = ZbRequest()
 req.command = 11 # Virtual Probe Event
 req.param1 = 6
 req.param2 = id # Sensor ID (e.g; 4196984322
 req.param4 = type
 binStr = '00000000'+ dec2bin(value2 & 0xFF) + '00000000' + dec2bin(value1 & 0xFFFF)
 req.param3= int(binStr,2)
 #req.param3 = value1
 #print binStr, req.param3
 self.sendRequest(req)

Installer le  module w1thermsensor:  https://github.com/timofurrer/w1thermsensor.git

w1thermsensor.zip

crontab

crontab -l
 
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
MAILTO=ericxxxx@gmail.com


# m h dom mon dow command
*/2 * * * * cd /home/pi/python/weather; sudo python temp.py >> temp.log

Création sonde ZiBase

 

zibase_web.php