LDR voltage divider manual override?

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
See the attached schematic.

I am using the voltage from the LDR/resistor voltage divider as the input to the ADC on a uC. The switch is there as a manual override, and R10 will limit the current to 13mA max. Is there a better way to do this? Thanks.

Capture.PNG
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
I guess I should have included the code, but yes, I think they are necessary. Based on the ADC level, the uC controls an H-bridge to turn a motor either clockwise or counter. I need to be able to force the input either high or low regardless of the divider voltage.

Thanks.
 

wayneh

Joined Sep 9, 2010
17,498
Why not use the switch on the ADC input to just select between the three choices of signal?

Do you need R10 if you are directly connecting the poles to the ADC?
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
Here's the whole schematic. The idea is that if the ADC is above a certain value (say 150) and if SW1 is (normally) closed, then run the motor clockwise, or if the ADC value is less than 150 and if SW2 is (normally) closed, then run the motor counterclockwise. If neither set of conditions is satisfied, then the motor does not run. SW3 is intended to override the conditions and run the motor clockwise in one position, counterclockwise in the other position, and return control to the voltage divider in the center (off) position.

At least that's what I want to happen. Am I going at it wrong?
 

Attachments

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
I have built a prototype of this circuit, and it seems to work as I had hoped. However, if anyone sees any problems with the design, I would be happen to learn of them. Thanks.
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
I made my first "field trial" this morning, and the timing was almost right; the "open" condition occurred just about sunrise, but the "close" condition occurs a bit early. I can adjust that in software.

The motor I am driving is a gearhead motor, and has surprising power, especially considering that it draws only 320mA at 12V under full load. I want to fuse the entire circuit, and am thinking a 1/2A fuse would be sufficient.

Comments? Thanks.
 

#12

Joined Nov 30, 2010
18,224
All motors start by using, "locked rotor current" because no movement is the same as being stalled for the first little bit of time. Choosing the right fuse takes up several pages in the National Electrical Code. One look-up table says, "150% slow blow". Then there are lots of exceptions. So, I'd say start with 1/2 A slow. If your motor doesn't have to struggle to get up to speed, that might be reliable...and it might not...but you have to start somewhere.
 

ErnieM

Joined Apr 24, 2011
8,377
The motor I am driving is a gearhead motor, and has surprising power, especially considering that it draws only 320mA at 12V under full load. I want to fuse the entire circuit, and am thinking a 1/2A fuse would be sufficient.
You have one data point: normal current. Now stall the motor and see what that's. Now you have lower and upper bounds to select a fuse value.

I suspect 1/2 amp will cause false trips.
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
I ordered the motor from a discount supplier, and almost no specifications were provided with it. After some Googling, I think I may have found some details about the motor.

Gearhead Motor Specifications Table.PNG
 

#12

Joined Nov 30, 2010
18,224
It stalls at 4.2 amps, so that will be your start surge. How long the start surge lasts will determine your fuse size. Obviously not more than a 4.2 amp fuse or it will never blow. Just guessing, something in the 1A or 2A range, slow, should work. Can your power supply provide enough current to blow the fuse?
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
It stalls at 4.2 amps, so that will be your start surge. How long the start surge lasts will determine your fuse size. Obviously not more than a 4.2 amp fuse or it will never blow. Just guessing, something in the 1A or 2A range, slow, should work. Can your power supply provide enough current to blow the fuse?
Initially, the power supply will be a wall wart, but longer term, it will be a deep cycle marine battery. I have limit switches that should prevent the motor from stalling, but just in case, I want to add a fuse. I think I'll start small (.5A) and see if that causes a problem; I can always increase the fuse amperage.
 

#12

Joined Nov 30, 2010
18,224
I have had to get a motor re-wound because the installer depended only on the limit switches. Yes, please, add a fuse!
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
I tested the circuit this evening. Sunset here was at 7:05, and the sky was mostly clear. I pointed the LDR at the eastern sky. At 7:17, the open signal shut off, and at 7:21, the close signal came on. Considering that the mechanism will take almost 10 minutes to fully open or close the coop door, this timing is acceptable.

I am going to test it again at dawn tomorrow. If all goes well, I will install it in the coop later this week.


ETA: Sunrise here today (15 Sep 2014) is 6:38 am, and the eastern sky is partly cloudy. At 6:25, the open signal came on. I am satisfied with the timing.
 
Last edited:
Top