A basic Arduino Solar PV Monitor.
I thought of just a row of LEDs that would illuminate in correlation to the amount of output the LDR was reading, like a VU meter.
So I thought about it another way, what was I doing? I am measuring a pulse and then stopping the measurement when the pulse occurs again, with those results I could then find stuff out.
My eureka moment was looking on the net again, this time for lap counters and timers! there were plenty and very simple.
The most understandable one I found was Claudiu Cristian’s Speed measurement with arduino with his code I began to set up my circuit and use a flashlight to experiment with some settings, changing when the LDR started to count was first, I n effect I needed to turn the < and > inside out to count what I needed, as it would measure only when the light was on otherwise.
His sketch uses two LDRs on the premise that a car passes over LDR 1, starts a timer then passes over LDR 2 then grabs the timing and divides it by the distance to calculate speed.
Using the serial monitor and some breadboard I replicated his circuit and changed the code the not calculate distance, but to calculate seconds in one minute (3600) by the time counted.
While working on this code, I was also trying to find out how to reconcile LED output by using conditions so that if I was measuring 3600W I could perhaps illuminate four LEDs or if I was pulling in 1000W two LEDs would be lit and so on.
Meanwhile I posted a topic on the Arduino forum where I found extra insight. My thanks go to Rob Tillaart from the forum for giving me the conceptual code I needed to further the sketch from a lap counter to a meter reader he showed me how the IF statements work in C and work LEDs as a result.
In the mean time I was getting to grips with C and reduced the code to only require one LDR.
For more detail: A basic Arduino Solar PV Monitor.