Wake up arduino with a light sensor

hey guys I just got my light sensor to my arduino, the sensor have a D0 and A0 output I would like if it could wake up the arduino from sleep state, I was lurking around this but somehow cant figure it out Arduino Playground - ArduinoSleepCode , I need to squeeze out the most uptime from my arduino. here is the sensor code, http://www.instructables.com/files/orig/F1I/7MZL/HZ88NFJJ/F1I7MZLHZ88NFJJ.ino its a different sensor but works the same can anyone point me to the right direction?

its a different sensor

In electronics it matters a great deal what sensor you are using. Unless you tell us what sensor you are trying to use no one can tell you how to use it.

Is it sensor like this

Hi, the A0 will provide you with an analog voltage depending on the amount of light the sensor receives.
Read the following code and it will give you an idea as to how the sensor works.
Reading the analog voltage from A0 will always give you a value.
You can then take the proper decisions, based on the amount of light
(if low light is detected, then turn on the light, if plenty of light is detected, then you might want to turn off the light fixture.

Please explain what you want to do in your main loop:
Here is a rough example that will help people to help you:

  • put arduino to sleep
  • come back from sleep
  • read light sensor
  • do whatever is appropriate
  • do it all over all again ...

dan

Grumpy_Mike:
In electronics it matters a great deal what sensor you are using. Unless you tell us what sensor you are trying to use no one can tell you how to use it.

its the same sensor as the one you see in the code, just a different led, works the same with the same board just the led is different, so it does not matter. its a sensor like on the picture

I need to squeeze as much power from the arduino as I can, I need to wake up the arduino and execute a code when the sensor senses light and then put it to sleep again till the next time it senses light. hope you understand :slight_smile:

if you say that A0 gives always a output I would probably need to connect it to one of the wake up pins of the arduino and then execute the code and put it back to sleep, am I right? but I dont think I understand where to connect A0 and what code to use to wake the arduino up

BoKKeR:
I need to squeeze as much power from the arduino as I can, I need to wake up the arduino and execute a code when the sensor senses light and then put it to sleep again till the next time it senses light. hope you understand :slight_smile:

If power is a problem then you will need to remove the LED's on the board.

Using analogue will draw more power than doing a digital read but this may be offset by the power requirements of the LDR and the comparator that gives you a digital output of a light level threshold.

How fast does your code need to react to the change in light level. If it can be slow then use the WDT to wake the MCU from deep sleep, read the light level and react to it, then deep sleep again.
Read this to give an idea of what consumes power (and how much).

its the same sensor as the one you see in the code, just a different led, works the same with the same board just the led is different, so it does not matter. its a sensor like on the picture

Sorry I thought you wanted help. A photograph of a sensor is not much help, a link to the data sheet or at least a sales lead is required if you expect some one look at it and try and fit it into your project.

So I see you are not interested in being helped.

3.3-5V Input Light Light Sensor Sensor Photodiode Module Raspberry pi 664055565459 | eBay thats the site I got it from but it have no more text than A0 to A0 and D0 to D0 the board works with the code up there, I am going to remove the leds, and I am looking at the link you posted right now

Thank you for the link.

Vcc and ground should be connected to the Arduino's 5V and ground.

D0 from the sensor board should be connected to pin 2 and that makes you able to wake up the Arduino on the light sensor signal, as per:-
http://playground.arduino.cc/Learning/ArduinoSleepCode
You adjust the pot so that this triggers at the right light levels.

The A0 output should only be connected if you need an analogue reading of the light in place of the on / off indication.

Never read Instructables unless you know exactly what you are doing, it contains so much crap and misinformation it is a totally useless source for actually learning stuff.

I went with
SLEEP_MODE_STANDBY : 0.84 mA
instead of
SLEEP_MODE_PWR_DOWN : 0.36 mA
for higher speed and accuracy

I still have to measure how much it eats and calculate the uptime but this should be good, thanks for the help :slight_smile: and have a nice day ^^