# Lux Meter With Arduino

933

1

1

## Introduction: Lux Meter With Arduino

A Lux meter (Also known as a light meter) - A light meter is a device used to
measure the amount of light.

Lux - The lux (symbol: lx) is the SI derived unit of illuminance and luminous emittance, measuring luminous flux per unit area.

In lame men's term, a lux is how much light is over an area and a lux meter is a tool to use this. This is a very useful tool but if you are going to use it once or twice a year or even just once then the cost of a meter is kind of a waste, however if you are like me and have an LDR and an ideal Arduino then you realise that you and build it in a about 20 minutes and for less than the cost of the petrol needed to drive you to the shop.

## Step 1: The Things You Need

· 200 Ω resistor

· Arduino UNO

· Perfboard

· Light dependant Resistor (LDR)

· Solder

· Soldering Iron

· Male to Male Jumpers

(Optional)

## Step 2: Build It

Arrange the 200 Ω
resistor and LDR in a voltage divider configuration, as described in the schematic above:

First
I would recommend that you build the circuit on a breadboard to test it before you solder it to the Perfboard, like this:

## Step 3: Make It Permanent

Arrange the parts like this:

One lead of the resistor must be on its own rail and one lead of the LDR must be on its own rail, the remaining lead should then be connected to one rail. This will create the voltage divider that we need to feed to the Arduino and don’t forget the headers; each header gets connected to one rail.

Tip: Do not put the LDR flat on the Perfboard if you are using a stick soldering iron (not a soldering station), I burnt the LDR and had to redo it.

When you are done then it should look like this:

## Step 4: The Code (The Arduino Sketch)

After you have built the probe, we still need a meter to translate that raw data into human speak, Lux measurement.

First, we define some constants to use later on in our calculations.

In our setup function, we just start a serial connection to display our readings.

In our loop, we declare of variables and their types. Next, we get the reading from the probe via Arduino pin A1. Now everyone’s favourite part, MATH, we divide the voltage from A1 by our constant MAX_ADC_READING then multiply by our ADC_REF_VOLTAGE constant to get out resistor voltage. To get the LDR voltage we minus our calculated resistor voltage from our ADC_REF_VOLTAGE, this value is then used to get the LDR resistance by dividing out LDR voltage by our resistor voltage then multiplying the result by our REF_RESISTANCE constant, almost done, we use the pow() function in the Arduino library to get an exponent using ldrResistance as base and LUX_CALC_EXPONENT constant as out exponent, this value is then multiplied by the LUX_CALC_SCALAR constant to get our Lux value. Ok Math class is over. Now we print this information to the serial monitor and wait for 250 ms so we can read it. Just upload the code to your Arduino and connect the probe, now you are good to go and measure light illuminance

## Step 5: Conclusion:

Yes I know you can fancy light meter from Arduino but it can still be improved with an LCD and/or SD card breaks out, where I live to get those compounds are quite expensive so I could not add it. Although I do hope someone that reads this will improve my design and make it. Another improvement could be to use a smaller Arduino like a mini or nano, and then you can make it easier to move around and to store. Participated in the
Arduino Contest 2019