SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By smgdb626
#114207
Hello everyone,

I'm designing a light meter that will display the amount of lux on a lcd screen. I’ve made some great progress on the light meter so far. For learning purposes I have successfully completed the “Hello World” project from the Arduino website (http://www.arduino.cc/en/Tutorial/LiquidCrystal). I’ve got the Arduino board communicating with the computer and now the LCD screen is correctly displaying the information. I have attached a picture of my project so you can see it. I feel like I’m almost there which feels great!

My last 2 parts I need to complete is hooking up the photocell that I have (http://www.sparkfun.com/products/9088) to the Arduino Uno board and obtaining the right code so the LCD will display the amount of lux. Well I was able to find a few codes online and try them out but they did not work for me. Here is one of them I tried:

http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1202530375

http://www.youtube.com/watch?v=H1wwhJlwnWg

The two links go together. The video is of that particular code working. I know this code does not display the amount of lux but it does display 4 different light conditions (pretty dark, dark, bright, pretty bright). I just wanted to see my photocell in action displaying the light conditions on my lcd screen. When I hooked up the photocell and uploaded the code my lcd screen just went blank for some reason. This is how I hooked up the photocell which I found on a different webpage:

5V >--[ Photocell ]---+---[ 10k Ohm ]---< GND
|
Arduino pin A0

I tried resetting the board and uploading the code many times. I also uploaded the “Hello World” code in between testing and that would work perfectly every time. So the possible 2 issues I think I’m having are that I do not know the type of photocell the person used or how exactly he hooked up the photocell. Even if I didn’t know his exact photocell he used I’m thinking I should still be able to see a light condition being displayed on my lcd even if it’s a wrong light condition.

I also found this code (http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1255287054) which looks to be the best and the exact code I would need for my application but it also just makes the LCD screen go blank for some reason. Can anyone please help me out? I would so greatly appreciate it. THANK YOU SO MUCH!
You do not have the required permissions to view the files attached to this post.
User avatar
By itikhonov
#114256
Hooking seems ok. On sparkfun schematics photocell and resistor swapped, check product page, but this do not change much.
smgdb626 wrote:I also found this code (http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1255287054) which looks to be the best and the exact code I would need for my application but it also just makes the LCD screen go blank for some reason. Can anyone please help me out? I would so greatly appreciate it. THANK YOU SO MUCH!
In this code you need to change Serial.print to lcd.print and also change
Code: Select all
void setup(void) {
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);  
}
to
Code: Select all
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}
It's hard to run without learning how to walk first.