element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • 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
  • Settings
Arduino
  • Products
  • More
Arduino
Blog Grove Light Sensor Test
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 25 Dec 2022 10:29 PM Date Created
  • Views 1739 views
  • Likes 15 likes
  • Comments 2 comments
  • grove light sensor
  • grove led bar
  • seeed xiao samd21
Related
Recommended

Grove Light Sensor Test

ralphjy
ralphjy
25 Dec 2022

I'm working on a Hack the Holidays project where I need to add an ambient light sensor to a Seeed Xiao BLE to control the brightness of Neopixel LEDs.

 I decided to test the sensor on another Xiao (SAMD21) before trying to use it in the project.

The sensor that I'm using is the Grove Light Sensor v1.1.  The sensor uses the LS06-S phototransistor to produce a linear analog output relative to illuminance, which ranges from 0 to the supply voltage.  I'll use an A-to-D converter on analog pin A0 to convert that voltage.

image

As a display, I'm going to use a Grove LED Bar v2.0.  I'll use the map() function to translate the A/D range into the LED Bar bins (levels).

image

Since these are Grove sensors, I'm going to use a Xiao Grove Shield to connect them.

A quick demo of the sensor operating:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Xiao_Light_sensor.ino

#include <Grove_LED_Bar.h>
 
Grove_LED_Bar bar(3, 2, 0, LED_BAR_10);  // Clock pin, Data pin, Orientation
 
void setup()
{
  // nothing to initialize
  Serial.begin(115200);
  bar.begin();
  bar.setGreenToRed(true);
}
 
void loop()
{
 
  int value = analogRead(A0);
  value = map(value, 0, 640, 0, 10);

  Serial.println(analogRead(A0));
  Serial.println(value);
 
  bar.setLevel(value);
  delay(100);
}

  • Sign in to reply
  • DAB
    DAB over 2 years ago

    Nice simple circuit.

    You could use it as a low cost light meter.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • robogary
    robogary over 2 years ago

    Looking good

    • Cancel
    • Vote Up 0 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 © 2025 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