Wiznet makers


Published August 23, 2022 © Creative Commons Attribution-NonCommercial CC BY-NC version 4.0 or later (CC BY-NC4+)

0 Projects

0 Resellers

1 Contests

Monitor Ambient Light Using WizFi360-EVB-Pico

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

COMPONENTS Hardware components

WIZnet - WizFi360-EVB-Pico

x 1

Adafruit - Adafruit BH1750 Ambient Light Sensor

x 1

Software Apps and online services

Arduino - Arduino IDE

x 1

WIZnet - WIZnet WizFi Library

x 1

x 1



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.

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.


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.


WizFi360-EVB-Pico is based on Raspberry Pi RP2040 and adds Wi-Fi connectivity using WizFi360. It is pin compatible with Raspberry Pi Pico board and can be used for IoT Solution development. Features, hardware specification and documents you can find here: https://docs.wiznet.io/Product/Open-Source-Hardware/wizfi360-evb-pico

The pinout of this board is shown below:

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.

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:

After making the electrical connections it would look like this:


  1. We will use the Arduino IDE and you can download it at this link: https://www.arduino.cc/en/software
  2. You will need a terminal emulator, and here you can download Tera Term: https://osdn.net/projects/ttssh2/releases/
  3. 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
  4. We will use 'WizFi360_arduino_library' provided by WIZnet: https://github.com/Wiznet/WizFi360_arduino_library

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


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


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

The test code is shown below:


What is obtained by the serial port is shown below:


Now you have to create a channel with the next settings.  

Once the channel is created, please open the "API Keys" tab. Now take note of the Write API Key, it will be used in the arduino code.

Next we will use and modify the demo example of ThingSpeak in this library: https://github.com/Wiznet/WizFi360_arduino_library/tree/main/examples/Thingspeak


#include <stdlib.h>
#include <BH1750.h>
#include <Wire.h>

#include "WizFi360.h"

BH1750 lightMeter;

// setup according to the device you use
//#define ARDUINO_MEGA_2560
#define WIZFI360_EVB_PICO

// Emulate Serial1 on pins 6/7 if not present
#include "SoftwareSerial.h"
#if defined(ARDUINO_MEGA_2560)
SoftwareSerial Serial1(6, 7); // RX, TX
#elif defined(WIZFI360_EVB_PICO)
SoftwareSerial Serial2(6, 7); // RX, TX

/* Baudrate */
#define SERIAL_BAUDRATE   115200
#if defined(ARDUINO_MEGA_2560)
#define SERIAL1_BAUDRATE  115200
#elif defined(WIZFI360_EVB_PICO)
#define SERIAL2_BAUDRATE  115200

/* Sensor */
#define CDSPIN A0

/* Wi-Fi info */
char ssid[] = "XXXXXXXXX";       // your network SSID (name)
char pass[] = "XXXXXXXXXXXX";   // your network password

int status = WL_IDLE_STATUS;  // the Wifi radio's status

char server[] = "api.thingspeak.com"; // server address
String apiKey ="XXXXXXXXXXXXXXXX";                    // apki key

// sensor buffer
char lux_buf[10];

unsigned long lastConnectionTime = 0;         // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 30000L; // delay between updates, in milliseconds

// Initialize the Ethernet client object
WiFiClient client;

void setup() {
  //initialize BH1750 sensor
  Serial.println(F("BH1750 Test begin"));

  // initialize serial for debugging
  // initialize serial for WizFi360 module
#if defined(ARDUINO_MEGA_2560)
#elif defined(WIZFI360_EVB_PICO)
  // initialize WizFi360 module
#if defined(ARDUINO_MEGA_2560)
#elif defined(WIZFI360_EVB_PICO)

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  Serial.println("You're connected to the network");

  //First transmitting

void loop() {
  float luxValue = lightMeter.readLightLevel();
  // if there's incoming data from the net connection send it out the serial port
  // this is for debugging purposes only   
  while (client.available()) {
    char c = client.read();
    Serial.print("recv data: ");
  // if 30 seconds have passed since your last connection,
  // then connect again and send data
  if (millis() - lastConnectionTime > postingInterval) {

// Read sendsor value
void sensorRead() {
  float luxValue = lightMeter.readLightLevel();
  String strLux = dtostrf(luxValue, 4, 1, lux_buf);
  Serial.print("Lux: ");

//Transmitting sensor value to thingspeak
void thingspeakTrans() {
  // close any connection before send a new request
  // this will free the socket on the WiFi shield

  // if there's a successful connection
  if (client.connect(server, 80)) {
    // send the Get request
    client.print(F("GET /update?api_key="));
    // note the time that the connection was made
    lastConnectionTime = millis();
  else {
    // if you couldn't make a connection
    Serial.println("Connection failed");

void printWifiStatus() {
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI):");
  Serial.println(" dBm");

Don't forget to type the SSID, password and API KEY. The image below shows the data captured in a test.

Another useful tool that you can configure in the ThingSpeak channel is the widget as shown below:

Finally, you can download the ThingView android app to be able to monitor the data in our example in real time. You can download here: https://play.google.com/store/apps/details?id=com.cinetica_tech.thingview&hl=es_MX&gl=US

Below I show you a captured screenshot:

Below I show you an image of the project.


First, I want to thank the sponsor for the gift hardware, this was a good experience. I have just started this project and I want to make more complex changes in the future. At first, I had problems with the firmware but I solved it satisfactorily. One suggestion I make to the sponsor is that you add a reset mode to the board to return it to the factory settings, as it already exists in other programming boards.

  • monitoring-ambient-light

    Github project codes

  • BH1750test.ino

  • Thingspeak.ino

  • Schematic diagram


0 Projects

0 Resellers

1 Contests

Comments Write