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
Summer of Sensors Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Summer of Sensors Design Challenge
  • More
  • Cancel
Summer of Sensors Design Challenge
Blog IntelliLight - Adaptive Smart Bulb Controller - Part 6 - Gesture Board Integration
  • Blog
  • Forum
  • Documents
  • Design Challenge
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Summer of Sensors Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: osjef
  • Date Created: 19 Oct 2022 10:34 PM Date Created
  • Views 1317 views
  • Likes 7 likes
  • Comments 1 comment
  • vishay
  • rgb led
  • SensorXplorer
  • Summer of Sensors Design Challenge
  • proximity sensor
  • colour sensor
  • smart bulb
  • summer of sensors
  • ambient light sensor
Related
Recommended

IntelliLight - Adaptive Smart Bulb Controller - Part 6 - Gesture Board Integration

osjef
osjef
19 Oct 2022
IntelliLight - Adaptive Smart Bulb Controller - Part 6 - Gesture Board Integration

Recap
Welcome again! This is my 6th blog in a series I am writing for the Summer of Sensors Design Challenge kindly sponsored by Element14 and in my case Vishay. The challenge is to make use of two selected sensor boards from Vishay’s SensorXplorer range. My project is an adaptive, smart bulb controller designed to save electricity, reduce eye tension and spark an interest in the Internet of Things (IoT) universe. In my last blog I successfully integrated the colour sensor (VEML3328) to the ESP32 micro-controller.

Introduction
I will try to keep today’s blog fairly short, but I just want to update you all on the progress of the sensor integration. I have now successfully integrated the second sensor board, the VCNL4035 Gesture Board, with contains the proximity sensor and ambient light sensor. These sensors will be integral to this project since they will be used to control the on/off state and brightness of the smartbulb.

Integrating the Gesture Board
After examining the datasheet of the VCNL4035 gesture board in more detail I discovered that the array of components in the top right corner of the board (which I originally incorrectly assumed to be a proximity sensor array in one of my earlier blogs) is actually an array of LEDs positioned and connected together in such a way as to depict 6 different symbols (among which are an up, down, left and right arrow). These can be controlled over I2C using the same PCA9554 GPIO controller as the RGB LED on the VEML3328 sensor board.

image

In my previous blog you will have seen that I successfully controlled the RGB LED over I2C which will be useful as a status LED, so I don’t particularly have need for this “gesture indicator”, but since it uses the same PCA9554 device I already have the code written to control it.

One annoying thing about this board is the I2C slave address of the PCA9554 used to control the arrow LEDs is the same as the I2C slave address of the PCA9554 used to control the RGB LED on the first sensor board. If you remember from my last blog the slave address of this GPIO controller is configured using three external pins (A0, A1 and A2). On the VEML3328 board they were all tied high (logic 1). The idea is that in other places where the same controller is used, those pins would be configured differently so the slave address would be different. However, Vishay obviously assumed that these two boards wouldn’t be used together in the same application so they have both been given the same slave address. As it happens, for my project, this is not the end of the world since I don’t need any more LED outputs – the RGB LED is fine for my design.

image


It is worth noting that since they both share the same slave address, they will both respond to the I2C commands being sent on that bus (assuming the slave/master acknowledgement doesn’t get in a pickle). This means that when I turn on the red LED (on the VEML3328 colour board) the UP arrow (on the VCNL4035 gesture board) will also illuminate because they are connected to the same GPIO number. To this end, I have updated my code to reflect which LEDs are connected to which pins on the GPIO controller in my header file for this controller:

image

Here you can see that the white LED (on the colour sensor board) does not share a GPIO number with the LEDs on the other board, and the left/right arrows (on the gesture board) do not conflict with anything on the colour sensor board. So potentially we could use some indication on one board and some on the other board to avoid conflicts, or we could just turn on the red LED on the colour sensor board and put up with the fact that this will also illuminate the down arrow on the gesture board. If it really bugs me, then I could take a soldering iron to one of the PCA9554 ICs and reconfigure one of the address pins to give a different slave address!

Anyway, with that bad news out of the way, the good news is that the I2C slave address of the ambient light and proximity sensor (which are incidentally integrated into the same IC in the centre of the board) is an entirely different value so there are no conflicts here which makes the integration of the final sensor a breeze. Looking at the datasheet for the integrated sensor I see that the I2C slave address can be 1 of 4 values depending on the option selected:

image

image


So I took a look at the schematics for Vishay’s Gesture sensor board and it shows that the “4035X01” model is fitted to the board meaning the slave address is 0x60:

image

This information allowed me to write some code to control the VCNL4035 sensor device. As before I created a separate file for this functionality - a source (.c) file for the implementation and a header (.h) file for function prototypes and defining constants (such as the slave address). I created two public functions – one to read the proximity value and one to read the ambient light level. These will then be used to control the smartbulb’s on/off state and brightness respectively.

image

With this code implemented, I then added some quick debug to the main application loop to print out the proximity value and ambient light value (alongside the RGB value which was being printed last week). The output of this code running on the ESP32 can be seen in the terminal window at the bottom where “P” is the proximity value and “A” is the ambient light level. Half way through the run, I placed my hand a few inches above the board. This can be clearly seen in the output where the proximity level increases (larger values indicate closer distance) and the ambient light level reduces substantially (because my hand was blocking a lot of the ambient light). This screenshot shows that the three sensors are now fully working and integrated with the ESP32 micro-controller.

image

image

Coming Next…
With the sensor integration satisfactorily completed, the next stage of the project is to integrate with the smartbulb. My next blog will document this process and will include setting up the WiFi connection on the ESP32, reverse engineering the smartbulb protocol, controlling the smartbulb from the ESP32, and ultimately controlling the smartbulb based on the three sensor readings taken above.

Thanks again for your interest in this project and stay tuned for the next exciting instalment in a few days’ time.


Previous Blog (Part 5) Next Blog (Part 7)
  • Sign in to reply
  • DeltaPi
    DeltaPi over 2 years ago

    Looks nice, Great presentation.

    • 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