Introduction: LDR Shield for a Programmable LED

In this instructable I will be showing how to setup a shield for a programmable LED that allows you to change the colours through red green and blue by using 3 light dependent resistors.

This tutorial uses Arduino & Max7, and although I have set up the LED as part of the shield, I will not be using it, but instead will show the colour changing of the LDRs through your computer screen. (this is easy to then transfer to the LED itself).

Step 1: What You Will Need:

1 x Arduino Uno

1 x stripboard (cut 10 height 20 width)

3 x double headers & 1 x header with 6 pins

3 x LDR's

3 x pins (2, 3, and 4 lengths)

3 x 10k Resistors

1 x RGB LED

Step 2: Stripboard

Cut the stripboard to size making sure the connections run horizontally, 20 holes long and 10 holes high. This should fit on top of the Arduino Uno.

Place the pins in to connect the stripboard to the Arduino in:

5V, Ground

A0, A1, A2

~6, ~5, 4, ~3

Step 3: Place All Your Components in the Stripboard

Refer to the diagram for correct placings, make sure when soldering that the solder doesn't connect to the rows above or below. If it does, scratch through the middle of it.

To finish the shield, use a drill bit by hand to disconnect the parts of the circuit you don't want to connect (image 4).

Step 4: Connect the Shield Into the Arduino

Refer to the pins on the last diagrams, these should line up nicely with the pins on the Arduino.

Step 5: Coding

  • Open Arduino and find the example that is under File > Examples > Communication > VirtualColourMixer

(created 2 Dec 2006 by David A. Mellis, modified 30 Aug 2011 by Tom Igoe and Scott Fitzgerald)

  • Scroll down to the bottom to find the 'Max patch' and copy all of it (image 1).
  • Open Max, create a new patcher and paste the code into it (image 2).
  • Click to open Max Console, fourth button down on the right hand tool bar
  • Plug Arduino in via USB
  • Click the lock in the bottom left (image 3).
  • Press 'Print' and look in the Max Console on the right to see which port your Arduino is in. e.g Port C
  • Re-click the lock and change the port to the correct letter (shown in max console)
  • Click the lock again and press the top button (image 6).

You might have to change the digits to match the RGB colours you want, e.g 255, 255, 255 near the bottom of the code where it currently says 0, 0, 0

You should now be able to change the colours of the Max background using your 3 LDR's!

(Once you've got this you can go on to making the LED change through red green and blue instead of the screen)

Step 6: Test

Comments

author
DIY Hacks and How Tos (author)2016-01-21

Great DIY Aduino Shield.

About This Instructable

2,143views

47favorites

License:

More by ahriant:LDR Shield for a programmable LED
Add instructable to: