When I power it through external power (9V ac-dc) the behavior changes.
Using USB power I have the expected behavior (yellow LED ON in shadow and OFF in light).Using external power (9V) yellow LED OFF in light an slowly blinking in shadow.Using external power (15V) yellow LED blinks slowly regardless light conditions.I can't explain it.
The USB voltage is not guaranteed to be 5V. It could be as low as 4.4V and as high as 5.25V. With the linear regulator used with external power, you will get 5V.
Your sketch prints messages to the USB port, so perhaps the timing is affected by whether the USB port is connected. If you remove the Serial.print statements do you still see any difference?
Quote from: mkwired on Jan 21, 2013, 11:57 pmThe USB voltage is not guaranteed to be 5V. It could be as low as 4.4V and as high as 5.25V. With the linear regulator used with external power, you will get 5V.Can this tolerance explain Not likely. Voltage regulators are subject to their own device tolerance allowed, just like the 5vdc voltage source powering the PC's USB port. A typical output voltage tolerance for a linear 5 vdc regulator might be:IO = 5 mA to 1 A, VI = 7 V to 20 V, 25°C = 4.8 - 5.2 VDC 0°C to 125°C = 4.75 - 5.25 VDCOr did you believe that the Arduino folks hand pick and select their voltage regulators for 5.000 vdc output so that the analogRead() function would be as accurate as possible? Lefty
It is hard to understand if I can't see values returned by reading A1 pin ... is there any workaround to force external power while USB cable is connected?
The NCP1117ST50T3G is trimmed to be +/- 1%.
That is how the existing auto-voltage switching circuit already works. If both USB and proper external DC power is available at the same time, the circuit utilizes only the 5vdc regulated from the external DC voltage source and switches off the FET switch path to the USB 5vdc power source.Lefty
I read that but I can't understand why the sketch works fine while the board is connected to both the sources and doesn't work if connected only to external source.It should be powered by external source in both cases.