Introduction: Arduino IoT Project - Reading a Photoresistor Sensor Data

About: Osoyoo brand products are mainly focused on STEM education.User experience and customer feeling are always our first priority. Our goal is to create the best designed product to help students and hobbyist to e…

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

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

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

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

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

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.