-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No data when reading light from the TSL2561 (RPI 2g, Arduino Uno) #1196
Comments
Did some more testing, added a BME280 sensor to the setup and configured it to communicate over i2c. It works like a charm. |
Fascinating... I wonder what the root cause was?? Can we close? |
Hi - regretfully i have not succeeded in reeding any values from the tsl2561 over J5-Arduino yet. I have confirmed that the wiring are correct and working, and that the sensor is ok - by by making my own program in Arduino. I have also confirmed that J5 and the firmata/I2C seems to work by using J5 to read over firmata/I2C on the Arduino for the temp sensor (BME280). I have not succeeded with J5 -> Firmata and the tsl2561 and would appreciate some guidance on how to debug this issue, or things to try out :) (In the mean time I am getting light values from a standard photoresistor - so this is not the most important thing in the world) |
@larskaare ok, I just wired up a tsl2561 and your issue is 100% reproducible. I'll take some time to find the issue and when I have something for you to test, I will ping here. |
…initialization. Fixes gh-1196 Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
@larskaare in your project, do this:
The fix addresses the missing timing enforcement. I must've had this when I was developing and then removed it thinking I was simplifying or improving? I have no idea. I tested this by shining a flash light back and forth over the sensor and got really nice responses. Let me know how it goes |
Thanx! No success yet :) This is what i did; I wired up the sensor to the arduino, loaded up a program to the arduino that set-up the sensor and printed the lux values (an example from adafruit) - this verified the sensor and the wiring. I then loaded the standard firmata up to the arduino. After this I created a small project that installed the j5 module as instructed (I verified that your fixes was in the light.js file) and wrote a small rutine the defined the light sensor with the proper controller and tried to read the values from the sensor on the value and level properties. My code was based on the examples in the j5 api documentation. It always return 0 on the "data" event ..... and never triggers the "change" event ..... |
Can you describe how you attempted to affect the environment to trigger changes in the value read? ie. did you flash a light over the sensor, or something similar? |
@rwaldron, amongst others I used the "flash light" on my iPhone. When using the specific code running on the Arduino the sensor was responding ok to he ambient light. I experimented with covering up the sensor, turning off the light in the room - all with the sensor responding as expected. (As a side note, after my last post i did a quick test to check that the sensor was on the expected address on I2C used by J5 - which it was). |
I wonder if J5 is using some configuration that limits its sensitivity? Can you share the Arduino code that you're using so that I can compare? Thanks! |
(Also, I really appreciate your patience while we work through this together) |
I used two Arduino libraries from Adafruit; the unified sensor driver (https://github.com/adafruit/Adafruit_Sensor) and then the specific driver for the TSL2561 (https://github.com/adafruit/Adafruit_TSL2561). The example in the specific driver is what ended up on my Arduino - which I referred to earlier. |
@larskaare perfect, this is very useful—I'm going to spend some time on this right now and will report back when I've learned something. |
Just an update: I have a significant rewrite in progress, which allows for changing the gain and integration. I will post here for you to test as soon as I have tests written |
I'm not going to have a chance to write the full tests that I want to write until probably next week, but I want you to test the code anyway, so I'm going to push the branch for you to work with |
…initialization. Fixes gh-1196 Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Then:
|
I've done some preliminary testing. I am getting lux values from the sensors. I intend to do some more testing comparing those values to the ones I'm getting while using the "native" Arduino routine - but this will most likely take some time :) I've also been testing a setup with this TSL2561 and a BME280 combined. Both are on the i2c bus and seems to work fine together. |
@rwaldron just a short status. I'm planning to do some more testing here, but my TSL2561 got hijacked by another project so I had to order a few new ones :) |
@larskaare any updates? |
@rwaldron not yet - i've set aside some time for tomorrow and intend to do a bit more thorough testing then. I guess i'm still testing the 1196 branch.... |
Yes please! I'm waiting for you to sign off on the fixes :) |
Done more testing on #1196 using the following protocol (all tests done with default setup, no options used)
Tests
In essence
We should investigate the "strong light" giving zero "issue" @rwaldron |
…initialization. Fixes gh-1196 Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This is awesome feedback! I will iterate, with specific focus on the final lux calculation and ping you when ready for more review. |
Greetings,
I am experimenting with an Adafruit TSL2561 sensor but are not able to get any light values.
I have the current setup; RPI with J5, and Arduino Uno connected using USB, running firmata on the Arduino, having the TSL2561 sensor wired with default settings all the way. The sensor i using i2c - default addresses. My experiment is based on the default example for the tsl2561 sensor.
Testing that I have done:
In the light.js code i have tried setting the frequency of the sensor and using the on("data") event. The data that is returned is always [0,0,0,0]. The on("change") event never triggers.
Putting it briefly - I am not getting values back from the sensor - as far as I can see that is :)
I have done some debugging, but it getting quite complex with callbacks on callbacks, events and emitters, i2C over firmata - so any guidance would be appreciated.
The text was updated successfully, but these errors were encountered: