Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need Help: Automatic Daylighting

Status
Not open for further replies.

Don_dody

Full Member level 1
Joined
Nov 4, 2012
Messages
96
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Indonesia
Activity points
1,921
This project will control the lighting system inside a room. It will maintain comfortable light intensity by dimming or brightening the AC lamps based on the outside light source (sun).

3 LDRs are used to measure light intensity inside a room (LDR front, LDR middle, LDR back). Output of these LDRs will be used to control 3 AC lamps (front, middle, back.

A zero crossing detector is used to enable the external interrupt of my AVR. Phase firing theory is also implemented.

Now, I've built the whole hardware and my problem is in programming.

I can dim one AC lamp by MANUALLY change the firing delay time through the code.

My Problem:
1. I don't know how to dim THREE AC lamp at once with different intensity?
2. I can display the ADC value (8bit) into LCD but I cannot use it to automatically change the firing delay of three lamps. Let say if ADC1 > 200 then increase firing delay1, if ADC1 < 150 then decrease firing delay1. So do ADC2 and ADC3

Please help me out.

I use codevisionAVR for compiling.
 

One BIG assumption is that there is no interaction between the three lamps and sensors. If there is, you've got problems. For example, if you increase the light intensity from the back lamp, and that causes a change in the sensor for the middle lamp, well, you can see what's going to happen. Depending on timing, etc., you may have lights blinking like mad as the controllers try to maintain a constant level.

I don't understand your question #1. You just need 3 identical controllers in your system. Your second question doesn't make sense. What does "So do ADC2 and ADC3" mean? What do you mean "I cannot automatically change ..."? Is there a problem with your software? Your hardware? Your algorithm?
 

One BIG assumption is that there is no interaction between the three lamps and sensors. If there is, you've got problems. For example, if you increase the light intensity from the back lamp, and that causes a change in the sensor for the middle lamp, well, you can see what's going to happen. Depending on timing, etc., you may have lights blinking like mad as the controllers try to maintain a constant level.

I've been thinking about it and I'm sure there will be interaction between the back lamp with the middle or front sensors. So do you have any suggestion for this problem?

I don't understand your question #1. You just need 3 identical controllers in your system. Your second question doesn't make sense. What does "So do ADC2 and ADC3" mean? What do you mean "I cannot automatically change ..."? Is there a problem with your software? Your hardware? Your algorithm?

1. Up until now, I can dim one lamp only. What I don't know is how to dim the THREE lamps at the same time but they may have different intensities. (e.g. lamp front on for 50%, lamp middle 80%, and lamp back 80%). This is my problem.

2. I'm pretty sure there is NO problem with my hardware. This all about the programming.
I want to dim the lamps based on ADC value. So front lamp will be based on front LDR, middle lamp is based on middle LDR, and back lamp is based on the back LDR. Up until now, I just can display the ADC value (from LDR) into LCD only. I dont know how to use them to dim the lamps.


I really need help now :(
 

1- To dim 3 different lamps you can use 3 different timers OR decrement 3 different counter variables for each of the lamps at a single timer overflow after the zero crossing happens. Then fire the triac for the lamp when the corresponding timer or counter is zero.

2- You may try to obtain a specific value for the ADC. If the ADC result goes below that value, dim up the lamp. Otherwise dim down. That question depends upon the application, ldr type and many other variables really. You have to decide what to do besides all this.
 

Well, so I should use external interrupt to activate 3 timers (timer0, timer1, and timer2) at the same time? is that what you mean?
 

That would be a possible solution for dimming 3 different lamps. Or as I mentioned before, you can decrement a separate counter for each lamp when a timer overflows (considering a 50Hz mains, time between 2 zero crossings will be 10ms, you can adjust a timer which overflows every 200us for a resolution of 10ms/200us=50) and fire the corresponding triac when they are zero.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top