I2C Sensor + UniPi analog output
-
Hello,
we connected an Sensirion sensor to the I2C RJ-11 on the UniPi (I2C Port)
with python:https://pypi.python.org/pypi/sht-sensor/15.01.5
Test Python driver tool sht-sensor-16.1.0
cd /home/pi/Arbeitspapiere/Nebelsensor/GPIO
sudo python sht-sensor-test_01.py
from sht_sensor import Sht
sht = Sht(3, 2)
print 'Temperature', sht.read_t()
print 'Relative Humidity', sht.read_rh()It works fine!
Also the evok API with JsonRPC works goodPython using JsonRPC
control the UniPi usint Python library jsonrpclib
JSON = Java Script Object Notation
RPC = Remote Procedure Call
from jsonrpclib import Server
UniPi server
s=Server("http://10.10.10.41/rpc")
s.ao_set_value(1,5) # set analog output 1 of 5 V
s.ai_get(1) # analog input 1 recall voltage
u = s.ai_get(1) # array analog input 1
u[0] # array element 0 -> voltagebut together it is not possible set and recall the ports on UniPi if we make an Sensor recall before.
Is there any solution?Thank you!
With best regards
Ulf B.
-
Hello,
we connected an Sensirion sensor to the I2C RJ-11 on the UniPi (I2C Port)
with python:https://pypi.python.org/pypi/sht-sensor/15.01.5
Test Python driver tool sht-sensor-16.1.0
cd /home/pi/Arbeitspapiere/Nebelsensor/GPIO
sudo python sht-sensor-test_01.py
from sht_sensor import Sht
sht = Sht(3, 2)
print 'Temperature', sht.read_t()
print 'Relative Humidity', sht.read_rh()It works fine!
Also the evok API with JsonRPC works goodPython using JsonRPC
control the UniPi usint Python library jsonrpclib
JSON = Java Script Object Notation
RPC = Remote Procedure Call
from jsonrpclib import Server
UniPi server
s=Server("http://10.10.10.41/rpc")
s.ao_set_value(1,5) # set analog output 1 of 5 V
s.ai_get(1) # analog input 1 recall voltage
u = s.ai_get(1) # array analog input 1
u[0] # array element 0 -> voltagebut together it is not possible set and recall the ports on UniPi if we make an Sensor recall before.
Is there any solution?Thank you!
With best regards
Ulf B.
-
Any progress? Most probably it is cuased because two applications are trying to acess the i2c bus… You should choose only one.
-
I tested enabling the I2C interface on the raspberryPi
sudo raspi -config
"8 Advanced Option"
"A7I2C"
ok ..
reboot
analog to
http://www.raspberrypi-spy.co.uk/2014/1 ... pberry-pi/after these steps
UniPi Webserver -UnPi conntrol panel- "http://adress/"
dont show the "Relays" and "Analog"It is possible that the EEPROM is defect?
-
The eeprom is now only used to detect version of UniPi, see the output of i2cdetect -y 1 and maks sure that 0x20 and 0x68 are visible
-
Hallo,
after new installation of evok the 'i2cdetect -y 1' find the 0x20 and 0x68.
After calling the sensor from python library 'sht-sensor 15.01.5'
sudo sht 3 2
the 'i2cdetect -y 1' don't find the 0x20 and 0x68
Is it possible that two library's for the gpio are used
'PIGPIO' and 'GPIO' and is that the problem?Thanks!
-
That's what I wrote in my first reply