Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » BH1705 Sensor.(Trying Read bh1705 light sensor using i2c.)
BH1705 Sensor. [message #1792734] Mon, 23 July 2018 10:30 Go to next message
shubh wade is currently offline shubh wadeFriend
Messages: 28
Registered: July 2018
Junior Member
                          I2CDeviceConfig config = new I2CDeviceConfig(
        			I2CDeviceConfig.DEFAULT,           	//I2C bus index
        			0x23,          				//I2C device address
        			I2CDeviceConfig.ADDR_SIZE_7,       	//Number of bits in the address
        			1000000       						//I2C Clock Frequency (Fast Mode)
        			);
            	I2CDevice    aDevice = (I2CDevice) DeviceManager.open(I2CDevice.class, config,1);
            	 aDevice.write(0x10);
            	int result1 =  aDevice.read(); 
            
            	s_logger.info("Read "  + result1);


Got ouput value of sensor is 0.
please tell me how i get lux value .

kura version: 3.2.0.
Re: BH1705 Sensor. [message #1792861 is a reply to message #1792734] Wed, 25 July 2018 08:42 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 423
Registered: July 2015
Location: Italy
Senior Member
Hi,
are you getting any error in kura.log or kura-console.log?

Best regards,
Matteo
Re: BH1705 Sensor. [message #1792889 is a reply to message #1792861] Wed, 25 July 2018 12:05 Go to previous messageGo to next message
shubh wade is currently offline shubh wadeFriend
Messages: 28
Registered: July 2018
Junior Member
Hello,
Now i update my code and reading 2byte of data.

		I2CDeviceConfig config = new I2CDeviceConfig(
    			I2CDeviceConfig.DEFAULT,           	//I2C bus index
    			0x23,          				//I2C device address
    			I2CDeviceConfig.ADDR_SIZE_7,       	//Number of bits in the address
    			1000000       						//I2C Clock Frequency (Fast Mode)
    			);
        	 aDevice = (I2CDevice) DeviceManager.open(I2CDevice.class, config,1);
                   
                   aDevice.write(0x10);
        	 //byte[] p = new byte[2];
        	 ByteBuffer p =ByteBuffer.allocate(2);
        	   aDevice.read(p); 
        	   int result=(p.get(0)<< 8 | p.get(1));
        	   s_logger.info("Read p "  +result);

But now sometime i got minus values.
I dnt know this procedure is right or not to read the BH1705 sensor data.
Please tell me if any changes need in this.
Re: BH1705 Sensor. [message #1792891 is a reply to message #1792889] Wed, 25 July 2018 12:14 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 423
Registered: July 2015
Location: Italy
Senior Member
Hello,
I've personally never used that device.
What I can suggest is to have a look at the logs to see if something strange is written there.
Best regards,
Matteo
Re: BH1705 Sensor. [message #1792900 is a reply to message #1792891] Wed, 25 July 2018 13:17 Go to previous message
shubh wade is currently offline shubh wadeFriend
Messages: 28
Registered: July 2018
Junior Member
Hello ,
Thank u for reply.
Have u used MCP23017 IC for GPIO Expander.?This device is also works on I2C.
Previous Topic:Sending MQTT to AWS NOT WORKING
Next Topic:update kura version
Goto Forum:
  


Current Time: Thu Mar 28 20:30:19 GMT 2024

Powered by FUDForum. Page generated in 0.03212 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top