---
title: "Arduino IoT Project - Reading a Photoresistor Sensor Data"
url: "https://maker.wiznet.io/mayuri/projects/arduino-iot-project-reading-a-photoresistor-sensor-data/"
markdown_url: "https://maker.wiznet.io/mayuri/projects/arduino-iot-project-reading-a-photoresistor-sensor-data/md"
type: "UCC: User Created Content"
author: "ossoyo"
author_url: "https://www.instructables.com/Arduino-IoT-Project-Reading-a-Photoresistor-Sensor/"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "ossoyo"
original_url: "https://www.instructables.com/Arduino-IoT-Project-Reading-a-Photoresistor-Sensor/"
published: "2022-11-29"
language: "en"
hardware: ["WIZnet W5100 ethernet shield"]
likes: 2
views: 934
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Arduino IoT Project - Reading a Photoresistor Sensor Data

> In this lesson, we’ll show how to automatically send a Photoresistor Sensor data to your Cayenne Dashboard.

Original author: ossoyo (source: https://www.instructables.com/Arduino-IoT-Project-Reading-a-Photoresistor-Sensor/)

## Components

- **WIZnet W5100 ethernet shield** x 1 ([docs](https://www.wiznet.hk/en/open-source-hardware/102-w5100s-ethernetshield.html?search_query=W5100+ethernet+shield&results=84))

## Article

**Hardware preparation:**

- Arduino UNOx1

- Ethernet shield W5100x1

- USB cablex1

- Photoresistor sensor Modulex1

- Jumper wires several

- Bread boardx1

Please note:This project needs to connect Arduino to Cayenne IOT platform firstly, to learn how to setup arduino, please visit : http://osoyoo.com/?p=5407

## **Step 1: Hardware Setup**

[![Hardware Setup](https://content.instructables.com/F4J/VMXO/J8UMYLBY/F4JVMXOJ8UMYLBY.jpg?auto=webp&frame=1&width=849&fit=bounds&md=947a66e5ec906653b6afc50fe3202aa0)](https://content.instructables.com/F4J/VMXO/J8UMYLBY/F4JVMXOJ8UMYLBY.jpg?auto=webp&frame=1&fit=bounds&md=947a66e5ec906653b6afc50fe3202aa0)

Connect your Photoresistor with Uno as per connection graph

**A couple of notes before you get started:**

The Photoresistor uses analog output, so you will need to use the analog pins on the Arduino.In this example, we are using a 5v power supply from the Arduino, but we could use the 3.3v as well.The provided diagram is just an example of how to connect the hardware. There are many ways to connect devices, so try what works best for you!

## **Step 2: Add New Device**

[![Add New Device](https://content.instructables.com/FW3/F5GI/J8UMYLC3/FW3F5GIJ8UMYLC3.jpg?auto=webp&frame=1&crop=3:2&fit=bounds&md=97b32899ecfb68ac31e733d77596cccf)](https://content.instructables.com/FW3/F5GI/J8UMYLC3/FW3F5GIJ8UMYLC3.jpg?auto=webp&frame=1&fit=bounds&md=97b32899ecfb68ac31e733d77596cccf)

[![Add New Device](https://content.instructables.com/FAL/N997/J8UMYLCG/FALN997J8UMYLCG.jpg?auto=webp&frame=1&crop=3:2&width=381&fit=bounds&md=5aa4afbfb1c456ba90fb860848480402)](https://content.instructables.com/FAL/N997/J8UMYLCG/FALN997J8UMYLCG.jpg?auto=webp&frame=1&fit=bounds&md=5aa4afbfb1c456ba90fb860848480402)

[![Add New Device](https://content.instructables.com/FZQ/9IT4/J8UMYLCT/FZQ9IT4J8UMYLCT.jpg?auto=webp&frame=1&width=381&fit=bounds&md=2bd97388e2fc0fc60f5c4cb0103192d3)](https://content.instructables.com/FZQ/9IT4/J8UMYLCT/FZQ9IT4J8UMYLCT.jpg?auto=webp&frame=1&fit=bounds&md=2bd97388e2fc0fc60f5c4cb0103192d3)

Login Cayenne platform <https://mydevices.com/> and add new device as following step:

Click Add new…->Device/Widget, Choose Sensors->Luminosity, Click “Photoresistor”

The datasheet will be shown

## **Step 3: Setting the Data**

[![Setting the Data](https://content.instructables.com/F4U/NS44/J8UMYLCY/F4UNS44J8UMYLCY.jpg?auto=webp&frame=1&fit=bounds&md=340b1de455990889bd5a6c08d5ee57f8)](https://content.instructables.com/F4U/NS44/J8UMYLCY/F4UNS44J8UMYLCY.jpg?auto=webp&frame=1&fit=bounds&md=340b1de455990889bd5a6c08d5ee57f8)

**Widgit Name:** Give your actuator a name, the default name is Photoresistor

**Select Device:** Select your Arduino device, the one used in this example is the Arduino Uno

**Connectivity：**Select your method of connectivity: There are Digital、Analog、Virtual, in this example we use Analog;

**Pin:** The Arduino may have several pins that can be used as Analog inputs (e.g. Arduino Uno has A0, A1, A2, A3, A4 & A5). we use A0 in this example

**Choose Widget: **Widgets are used to control a device or are used to show the visualization of data coming from a device. Cayenne has a growing list of custom widgets available for IoT projects. Each widget has its own settings and configuration options.

**Choose Icon**： Select an Icon to be used for the widget. For example, a temperature sensor could a thermometer Icon.

## **Step 4: Software**

[![Software](https://content.instructables.com/FSB/91Z2/J8UMYLD4/FSB91Z2J8UMYLD4.jpg?auto=webp&frame=1&crop=3:2&fit=bounds&md=04bf0140dd934fe8c93e3dfbf9afdc7e)](https://content.instructables.com/FSB/91Z2/J8UMYLD4/FSB91Z2J8UMYLD4.jpg?auto=webp&frame=1&fit=bounds&md=04bf0140dd934fe8c93e3dfbf9afdc7e)

[![Software](https://content.instructables.com/FZ7/QP3V/J8UMYLDA/FZ7QP3VJ8UMYLDA.jpg?auto=webp&frame=1&crop=2:3&width=369&height=1024&fit=bounds&md=c825cd9ba370275338ada9121f4dfbe5)](https://content.instructables.com/FZ7/QP3V/J8UMYLDA/FZ7QP3VJ8UMYLDA.jpg?auto=webp&frame=1&height=1024&fit=bounds&md=c825cd9ba370275338ada9121f4dfbe5)

click “Step 1:Sketch File”, the sample sketch will be displayed, copy and paste the sketch into Arduino IDE.

Choose the Board type Arduino Uno and correct Port, remember to use your authentication token. upload the sketch to your Uno board. In the Cayenne dashboard, you can click “Step 2: Add Actuator” Then the Photoresistor widget will be displayed on your dashboard.

As you can see the luminosity valus is 280 from the datasheet, at the same time you can also read the data from your mobile.

---

Source: https://maker.wiznet.io/mayuri/projects/arduino-iot-project-reading-a-photoresistor-sensor-data/
