Arduino IoT Project - Reading a Photoresistor Sensor Data

by osoyooproduct in Circuits > Electronics

1667 Views, 1 Favorites, 0 Comments

Arduino IoT Project - Reading a Photoresistor Sensor Data

Lesson 3 Reading a Photoresistor Sensor data

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

Hardware Setup

1.jpg

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!

Add New Device

2.jpg
3.jpg
4.jpg

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

Setting the Data

5.jpg

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.

Software

6.jpg
7.jpg

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.