3 Jan 2011

Arduino Light Meter

Well, this is the layout for the lightmeter as it stands. I created the image using Fritzing which is a great application for virtual breadboarding. It'll also produce circuit diagrams and printed circuit boards (PCB) from your layout, although it's early days and the results can be a bit interesting.


If I've made any mistakes in the wiring, I'm sorry. Let me know and I'll correct it. And don't hold me responsible if you maim or kill yourself (or anything else) -  I'm not offering this as instructions or a tutorial.

That said, the voltages and currents here are pretty small (5volts or less) and even if you wire it wrong, you're unlikely to damage anything. Do be careful, though, of polarities i.e. positive (+ve / 3.3v / 5v ) and ground (GND or 0v).

The circuit has three main parts and they are grouped as such on the breadboard (the big white thing at the bottom).

  1. At the left are two switches that are tied to GND through the resistors and feed into digital 1 & 2. Press one of these switches and it will read the value of the LDR and store it in one of two variables. This will let me use the same LDR to measure dark areas and light areas.
  2. The central section is the LDR. Again it is tied to GND through a resistor and this time feeds into analogue 0.
  3. The right hand section includes the LCD (the green thing above the big white thing) appears to be the most complex, but it's just a lot of wiring. The little bit on the breadboard is a preset (or trimmer) variable resistor used to adjust the contrast of the display. There is also a resistor there which serves to drop the voltage to a safer 2v for the LED illumination that the LCD uses. More about that later.
If you're wondering what the blue thing is, that's the Arduino. It even says so. It's virtually identical in colour and layout to my real Uno.

Now, some explanation about a couple of things:

There is an explanation of breadboarding here, but basically, the two tracks at the top and bottom are linked horizontally and are normally used for power (and ground) rails. The central section has tracks that are linked vertically and this is where we build the circuits.

I've wired the LCD into a hotchpotch of inputs. It doesn't really matter which you use so long as they are reflected in the code, which we'll look at later.

Where I've tied something to GND through a resistor, that is because if there is no definite state on an input, the Arduino can't make up its mind how to read it and the result can be erratic. 'Pulling it down' to ground gives it a definite default off state. You can also 'Pull up' to a voltage, say the 5v rail, in which case it would have a definite default on state. Think of it like a door. With a closer spring, the door will be closed unless it is held open. Without the spring it will be however it was left: open, closed or part-open.

That's all for now. Next time I'll look at the code, explain how it works and think about improvements.

No comments:

Post a Comment