Analog Comparator and Timer Help

Hello,

I'm working on a project using an array of IR phototransistors an lm353 op-amp and an Arduino Micro board connected to an alarm. I have
never worked with an Arduino board before, but was told they are relatively easy and very versatile. The input to the Arduino board will receive a voltage value based on how many phototransistors pick up IR light coming in. I need to write a program that will compare the voltage value recorded, to the previous value and if they are different, do nothing. If they are the same, start a timer that after 20 seconds will trigger an alarm. If the voltage values vary inside of the 20 seconds, the timer will reset.

Can anyone give me some guidance on how to do this, I would appreciate help on both the physical set-up and coding because I am a complete newbie!

Thank you so much!

Hello,

I'm working on a project using an array of IR phototransistors an lm353 op-amp and an Arduino Micro board connected to an alarm. I have
never worked with an Arduino board before, but was told they are relatively easy and very versatile. The input to the Arduino board will receive a voltage value based on how many phototransistors pick up IR light coming in. I need to write a program that will compare the voltage value recorded, to the previous value and if they are different, do nothing. If they are the same, start a timer that after 20 seconds will trigger an alarm. If the voltage values vary inside of the 20 seconds, the timer will reset.

Can anyone give me some guidance on how to do this, I would appreciate help on both the physical set-up and coding because I am a complete newbie!

Thank you so much!

If you have a single voltage you can use the analog comparator on the chip. Example here:

I'll let you work out the timing part, however you might want to look up the millis() function to see how much time has elapsed.

Are you able to read anything from the sensors?

Are you able to compare the current reading to the previous reading?

When they are different, are you able to record the time that they became different?

Are you able to tell how much time has elapsed since an event?

Are you able to trigger the alarm?

Those seem to be all the things that you need to do. None of them is difficult.

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

  • Moderator

How to use this forum