Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.

Ambient Light Sensor

Screenshot of 110-ldr

Let’s introduce a new sensor to measure the ambient light level. A photoresistor (aka light dependent resistor or LDR) will do a great job of measuring the parameter. However, there is a small problem: we do not have a photoresistor node in XOD.

We have basic nodes for working with digital and analog ports though. The photoresistor is a pretty primitive device, and all we need to do is read its value from the analog port. To do so, use an analog-sensor node.

Circuit

Assembling LDR to Uno

↓ Download as a Fritzing project

Exercise

Let’s make a smart (or dumb) light bulb.

  1. Assemble the circuit with an LDR and LED.

  2. Link the VAL output pin of the analog-sensor node to the LUM pin of the led node.

  3. Upload the patch to the board.

Cover the photoresistor with your hand and watch how the brightness of the LED changes.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.