
This work is licensed under a Creative Commons Attribution 4.0 International License.

These data were captured with a 50 ms delay between each value to minimise hysteresis. Vs brightness is approximately linear (Fig. Inversely proportional to the light intensity. What shape trendline best fits the data? Can you find a transformation that makes it linear?Īnswer: The approximate functional form of the LDR response is that resistance is Measure the current by measuring the voltage across the load resistor and using Ohm’s law.ĭiscover the functional form of LDR resistance vs brightness. A better solution would be to measure the current flowing through the diode and use that as the independent variable in the analysis.
PRINT ARDUINO OUTPUT TO EXCEL CODE
That’s all that needs to be added to normal Arduino code to start plotting data in Excel using PLX-DAQ. The word DATA has to be written in front of each row of data, with each column of data separated by commas.
PRINT ARDUINO OUTPUT TO EXCEL SERIAL
Void setup () \) is approximately independent of \(I\). The Arduino writes successive rows of data separated by commas to the serial port using the Serial.print command. Possible states, and \(256 = 2^8\) so we see that PWM ratios are 8 bit The significance of 0.255 is that there it gives 256 0 means that the output is completely off and 255 means Pulse width modulation in Arduinos requires a duty cycle that is defined to Varying theĭuty cycle in this manner is called pulse width modulation. However, it can approximateĪn analog signal by rapidly turning a voltage on and off (Fig.

The Arduino cannot output an analog value directly. An alternative would be to use cling wrap and alfoil (forĮlectrical insulation and to block the light, respectively). Once you have the position right, cover the breadboard with some paper or fabric We will use the LED as a light source to vary the light incident upon the LDR. 3: Position the LED and LDR next to each other so that the LED light will shine upon the LDR. 2: Breadboard layout for LDR circuit.įig. In Excel, I was able to set the COM port and establish a connection and see a R box flashing red. The sketch worked in Arduino as I was able to see the output through the Serial Monitor. 1 – 3 is a good case study inĮxploring the properties of a very cheap sensor.įig. I am trying to show the table and graph on excel from the sinus function you posted here but I could not get anything to work in Excel. Serial.begin (9600) and write your sensor values to the serial interface using. in the arduino code initalize the serial lib in the setup method. The light dependent resistor (LDR) circuit shown in Figs. you can write the sensor data to the serial port using serial-lib and write a small processing program that reads the data from the serial port and writes it to a file. Many real sensors exhibit the property of hysteresis, meaning that the measured Measurement depend upon previous measurements? Will your sensor always return the same value for the same stimulus? Does a

Hysteresis Lesson #14-Non-ideal sensor properties Sensor theory
