element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Achievement Levels
    • Benefits of Membership
    • Feedback and Support
    • Members Area
    • Personal Blogs
    • What's New on element14
  • Learn
    Learn
    • eBooks
    • Learning Center
    • Learning Groups
    • STEM Academy
    • Webinars, Training and Events
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Arduino Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Project Groups
    • Raspberry Pi Projects
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Or choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Sensors
  • Technologies
  • More
Sensors
Blog ROHM Colour Sensor BH1749NUC - part 2: Other Firmware Libraries
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Sensors requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 25 Nov 2018 3:06 PM Date Created
  • Views 1229 views
  • Likes 4 likes
  • Comments 6 comments
  • RoadTest
  • rohm
  • road_test
Related
Recommended

ROHM Colour Sensor BH1749NUC - part 2: Other Firmware Libraries

Jan Cumps
Jan Cumps
25 Nov 2018

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.

 

image

 

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.

https://github.com/sparkfun/SparkFun_BH1749NUC_Arduino_Library/blob/master/examples/Example3_NewDataInterrupt/Example3_NewDataInterrupt.ino

 

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.


In this explanation, I assume that you use the unchanged example from Adafruit. and that you dock the colour sensor evaluation board in i2c dock #1 as per instructions. The Adafruit code listens to D2 for Interrupt 0;

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.

 

image

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);

 

image

 

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

 

Related blog
ROHM Temperature Sensor BD1020HFV
ROHM Magnetometer Sensor BM1422AGMV
ROHM Hall Sensor BD7411G
ROHM Colour Sensor BH1749NUC
ROHM Colour Sensor BH1749NUC - part 2: Other Firmware Libraries
ROHM Ambient Light and Proximity Sensor RPR-0521RS
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps +3
    Until now no success with the SparkFun trigger. I'm checking on my scope to capture the falling edge of the interrupt pin when the red light goes below 50 or above 500. It does not happen ... I know that…
  • fmilburn
    fmilburn over 5 years ago +2
    Nice find on Sparkfun library
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to fmilburn +2
    fmilburn wrote: Nice find on Sparkfun library I'm trying it out. I have the basic examples running. The ones with interrupts not yet. I'll put an oscilloscope on that interrupt pin.
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to fmilburn

    I found a way to make the interrupt work, after mapping the pins of the SensorShield out (ROHM SensorShield V3: Map PINS to Arduino).

    It's

    1: depending on where you dock it. I docked it at i2c dock #1.

    2:Then, as described in the instructions, also put jumper on conncetor J1, Pin INTR1.

    3: also pull J16 INT1 high by placing a jumper.

     

    A bad foto tells a few words:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 5 years ago in reply to Jan Cumps

    I was just thinking that might be it and to use the continuity tester on my DMM to test that myself.  You are flying through these sensors!  I should be ready to publish something on the RoadTest myself soon. 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps

    ... I just learned - by beeping the SensorShield out, how the interrupt jumpers work.

    You have to set the jumper depending on the docking position where you plugged in the sensor.

    That pin is then linked to Arduino D2.

    If you use the INT?x pi, the voltage is translated. If you use the INT?, it's a direct connection to pin D2.

    Trying again now ...

     

    edit: J3 ties to D2, J1 ties to D3 of the Arduino.

    D1 on the interrupt selector is pin 3 of J11, D2 is pin 4, with the voltage translator in between.

    D1 on that J11 is also directly connected to arduino D0, and D2 to Arduino D1.

     

    A bit of a bummah, because D0 (and also D1) of the arduino UNO is hard to drive, with the USB part attached to it and pulling that pin high via a 1K resistor...

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps

    Until now no success with the SparkFun trigger. I'm checking on my scope to capture the falling edge of the interrupt pin when the red light goes below 50 or above 500.

    It does not happen ...

     

    I know that the interrupt handler works, because I can manually force one on D2 with a wire attached to ground, but with the sensor it does not seem to work yet ...

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to fmilburn

    fmilburn  wrote:

     

    Nice find on Sparkfun library

    I'm trying it out. I have the basic examples running.

    The ones with interrupts not yet. I'll put an oscilloscope on that interrupt pin.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube