I'm Road Testing the Rohm SensorShield-EVK-003 (Arduino Compatible) and the sensors that come with it. In this post, alternative libraries for the Colour Sensor BH1749NUCBH1749NUC.
|
This is a follow up on ROHM Colour Sensor BH1749NUC. I was planning to extend the ROHM example with support for interrupt.
During my research I stumbled over two alternative libraries, one of which has dona the legwork already.
FaBo library
FaBo is an online shop that designs and sells sensor and other breakout boards (called Bricks).
They may do other things but the website is in (I think) Japanese.
The library provided has similar functionality as the ROHM one. The OO flavour is a little different but the same functionality is supported.
The example shows how to play with the gain for the IR and RGB range (the SparkFun library below does that too).
https://github.com/FaBoPlatform/FaBoColor-BH1749NUC-Library.
SparkFun Library
SparkFun made a library for their experimental and indeterminately out of stock RGB Sensor (Qwiic).
They have a concept called SparkX, where they try out new products, often with a rough edge.
Even though the module is experimental, their library and examples are the most advanced that I can find.
I will not elaborate here, please check for yourself.
It's worth it: they have a data ready interrupt and a threshold interrupt (I talked about the latter in my previous post) example.
Heads-up: I haven't been able to run that threshold trigger example successfully yet. The normal polling one works right out of the box. Investigating ... To make the example work, you have to help the interrupt pin a little.
Also as per instructions, put a jumper on INTR1 on connector J3. This ties that pin to Arduino D2, so that the Arduino INT0 can be used. But that pin - going to the volatge translator IC - needs a pull-up. To get that extra omph to help the signal pull up, you can jump INT1 on connector J16. That adds a pull-up resistor.
The Adafruit example works just fine then. When the red component of your light drops below the low threshold or jumps above the high threshold, the serial monitor show measurements. If the red component is between both thresholds, nothing happens.
// Set high and low thresholds. If red value is >HIGH_THRESHOLD or <LOW_THRESHOLD, then an // interrupt will be triggered //rgb.setThresholdHigh(HIGH_THRESHOLD); //rgb.setThresholdLow(LOW_THRESHOLD); // Alternatively, setThresholds can be used to set high and low thresholds simultaneously rgb.setThresholds(LOW_THRESHOLD, HIGH_THRESHOLD);
It's easier to dock the board in i2c location #3 and put the jumper of J3 on INTR3, the jumper of J16 on INT3. That way the interrupt pin is not also connected to D0 on the Arduino (see this post to check how things are interconnected on this shield). You have a pure situation where only D2 is connected to the interrupt pin. |
The interrup
Top Comments