PiicoDev Ambient Light Sensor VEML6030 - Raspberry Pi Pico Guide

Updated 29 August 2021

Introduction

This guide will help you read light intensity data from your PiicoDev® Ambient Light Sensor and a Raspberry Pi Pico

To follow along, it's best to have:

In the video we use a PiicoDev Platform to keep everything safe and secure.

If you prefer not to use the Expansion Board for Raspberry Pi Pico, there are other connection options in our PiicoDev Connection Guide.

Connect the PiicoDev sensor to your Pico

Plug your Pico into the Expansion Board, connect your light sensor to the Expansion Board via the PiicoDev cable, and finally connect your Pico to your computer with a USB lead.

If you're unfamiliar with connecting PiicoDev modules, read the PiicoDev Connection Guide before proceeding.

pico-veml6030-connections

Download the PiicoDev Modules and Example Code

Download the following files and save them to your working directory (Right Click > "Save Link As")

It will be best to keep this file wherever you like to keep your coding projects eg. make a directory Documents > PiicoDev

Example Code

Open Thonny, connect to your Pico and upload the three files from the previous step.

Press Ctrl+D to restart your Pico and run the main script - light data should begin streaming up the shell

If you're unfamiliar with Thonny, read our setup guide.

piicodev-light-sensor-veml6030-example-raspberry-pi-pico

Above: Light data streams up the shell. The plotter shows historic light data, which starts at about 175lux, then ramps down as the sensor is gradually covered. Finally, the sensor is uncovered and the light data jumps back to ambient levels.

Now we can easily read light data with our Pico.

Tip: Open the Plotter (View > Plotter) to see a nice plot of your temperature data

Remix - Day/Night message

In the final part of the video, we modify the example code to keep track of whether it is day or night (bright/dark). When light data transitions between bright and dark, we can print an appropriate greeting eg. "Good Morning" or "Goodnight". You can use this structure for decision-making in your own projects - be sure to code along!

If you have any questions or uncertainty, start the discussion below. We're full-time makers and here to help!

In the video we use a PiicoDev Platform to keep everything safe and secure.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.