Get data from Raspberry Pi I2C-Pins for lightsensor TSL2561
Show older comments
Hi guys,
First of all, I am sort of a beginner with Matlab and the Raspberry Pi. I´m trying to measure the light intensity in 5 different places with 5 light sensors (TSL2561) through a Raspberry Pi Model 3 B combined with Matlab. It feels like I checked every website for support but didn´t really get any further.
As far as I see it, I have to use the I2C-connection for the data. The problem is that I can´t read any data from the connected sensor. What I did so far to set up one sensor in Matlab:
mypi =
raspi with properties:
DeviceAddress: 169.254.0.2
Port: 18734
BoardName: Raspberry Pi 3 Model B
AvailableLEDs: {'led0'}
AvailableDigitalPins: [4,5,6,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {'CE0','CE1'}
AvailableI2CBuses: {'i2c-1'}
AvailableWebcams: {}
I2CBusSpeed: 100000
Supported peripherals
>> scanI2CBus(mypi, 'i2c-1' )
ans =
1×1 cell array
{'0x39'}
>> light=i2cdev(mypi,'i2c-1','0x39')
light =
i2cdev with properties:
Bus: 'i2c-1'
Address: '0x39'
From this point on I don´t really know what to do as commands like "read" or "readRegister" don´t seem to work. I propably have do way more than this command but I can´t find any support regarding this type of sensors...
Hopefully somebody has a solution for this! Thank you very much in advance! :)
1 Comment
Helper
on 2 Jul 2018
Please check the following two documentations which might be helpful.
Answers (0)
Categories
Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!