---
title: "Monitor Ambient Light Using WizFi360-EVB-Pico"
url: "https://maker.wiznet.io/guillengap/contest/monitor-ambient-light-using-wizfi360-evb-pico/"
markdown_url: "https://maker.wiznet.io/guillengap/contest/monitor-ambient-light-using-wizfi360-evb-pico/md"
type: "Contests"
author: "Guillermo Perez"
author_url: "https://maker.wiznet.io/guillengap/"
original_author: "Guillermo Perez"
license: "Creative Commons Attribution-NonCommercial CC BY-NC version 4.0 or later (CC BY-NC4+)"
published: "2022-08-23"
language: "en"
tags: ["Internet of Things", "Lights", "Home Automation"]
hardware: ["WIZnet WizFi360-EVB-Pico", "Adafruit BH1750 Ambient Light Sensor"]
likes: 8
views: 3239
comments: 6
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Monitor Ambient Light Using WizFi360-EVB-Pico

> Monitor system of ambient lighting in real-time with ThingSpeak IoT

Original author: Guillermo Perez

## Components

- **WIZnet WizFi360-EVB-Pico** x 1
- **Adafruit BH1750 Ambient Light Sensor** x 1 ([docs](https://learn.adafruit.com/adafruit-bh1750-ambient-light-sensor))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))
- Software: **WIZnet WizFi Library** ([docs](http://www.arduino.cc/reference/en/libraries/wizfi360/))
- Software: **ThingSpeak IoT ThingView - ThingSpeak viewer**

## Documents and links

- [monitoring-ambient-light](https://github.com/dedos/temas) (code): Github project codes
- BH1750test.ino (code)
- Thingspeak.ino (code)
- Schematic diagram (schematics)

## Article

## **INTRODUCTION**

A light meter is a device used to measure the amount of light. In photography, a light meter is often used to determine the proper exposure for a photograph. Typically a light meter will include either digital or analog electronic circuit, which allows the photographer to determine which shutter speed and f-number should be selected for an optimum exposure, given a certain lighting situation and film speed. The modern light meter works according to the principle of a cell (cell) C.C.D. or photovoltaic; an integrated circuit receives a certain amount of light (photons) and transforms it into an analog electrical signal.

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661247407%2Ejpg)

Light meters or light detectors are also used in illumination. Their purpose is to measure the illumination level in the interior and to switch off or reduce the output level of luminaries. This can greatly reduce the energy burden of the building by significantly increasing the efficiency of its lighting system. It is therefore recommended to use light meters in lighting systems, especially in rooms where one cannot expect users to pay attention to manually switching off the lights. Examples include hallways, stairs, and big halls.

**Lux**

The lux (symbol: lx) is the SI derived unit of illuminance and luminous emittance, measuring luminous flux per unit area. It´s equal to one lumen per square meter. In photometry, this is used as a measure of the intensity, as perceived by the human eye, of light that hits or passes through a surface. It is analogous to the radiometric unit watt per square meter, but with the power at each wave length weighted according to the luminosity function, a standardized model of human visual brightnessperception. One lux is equal to one lumen per square meter:

1 lx = 1 lm/m2 = 1 cd·sr/m2.

## **HARDWARE**

The pinout of this board is shown below:

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661252836%2Epng)

**The BH1750** is a 16-bit ambient light sensor that is centered around the visible spectrum, designed to communicate via the I2C protocol. The BH1750 can be used in security applications ranging from camera shutter control, brightness control in dark/lit rooms, and general monitoring of light in the visible spectrum.

![](https://maker.wiznet.io/upload/ckeditor5/103183698%5F1661565740%2EJPG)

**Main features:**

1. I2C bus Interface

2. Spectral responsibility is approximately human eye response

3. Illuminance to Digital Converter

4. Wide range and High resolution. (1 - 65535 lx)

5. Low Current by power down function

6. 50Hz / 60Hz Light noise reject-function

7. 1.8V Logic input interface

8. Adjustable measurement result for influence of optical window (It's possible to detect min. 0.11 lx, max. 100000 lx)

9. Small measurement variation (+/- 20%)

10. The influence of infrared is very small.

Below I show you the schematic diagram that will be used in this project:

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661251941%2Epng)

After making the electrical connections it would look like this:

![](https://maker.wiznet.io/upload/ckeditor5/103183698%5F1661565988%2EJPG)

## **GETTING STARTED:**

1. If you consider that it is necessary to update the firmware of your WizFi360 board, then the following link shows you three methods to achieve it: [***https://wizfi.github.io/Document/docs/basic_guides/firmware_upgrade***](https://wizfi.github.io/Document/docs/basic_guides/firmware_upgrade)

2. We will use 'WizFi360_arduino_library' provided by WIZnet: [***https://github.com/Wiznet/WizFi360_arduino_library***](https://github.com/Wiznet/WizFi360_arduino_library)

Run Arduino IDE, open File->Preferences, and add next url boards manager:

```plaintext
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
```

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661255190%2EPNG)

Install the Raspberry Pi Pico/RP2040 boards as shown below:

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661255465%2EPNG)

## **SIMPLE TEST WITH THE BH1750 SENSOR**

It's necessary to do a previous test with the BH1750 sensor, since you have to make a configuration to the code to use it on this WizFi360 board, and verify that everything is fine. You can get the BH1750 sensor library here: [***https://github.com/claws/BH1750***](https://github.com/claws/BH1750)

The test code is shown below:

## **BH1750test.ino**

```cpp
#include <BH1750.h>
#include <Wire.h>

BH1750 lightMeter;

void setup() {
  Serial.begin(9600);

  // Initialize the I2C bus
  Wire.setSDA(0);
  Wire.setSCL(1);
  Wire.begin();

  lightMeter.begin();

  Serial.println(F("BH1750 Test begin"));
}

void loop() {
  float lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");
  delay(1000);
}
```

The SCL and SDA pin configuration is as follows:

```cpp
  Wire.setSDA(0);
  Wire.setSCL(1);
  Wire.begin();
```

What is obtained by the serial port is shown below:

![](https://maker.wiznet.io/upload/ckeditor5/535460484%5F1661252975%2EPNG)

## CONCLUSION:

Board doesnt work properly

---

Source: https://maker.wiznet.io/guillengap/contest/monitor-ambient-light-using-wizfi360-evb-pico/
