Code help!!
 
Notifications
Clear all

Code help!!

53 Posts
3 Users
0 Reactions
16 K Views
Posts: 2541
(@lightup)
Famed Member
Joined: 17 years ago
Reply
Posts: 37
Topic starter
(@sherman-desouza)
Eminent Member
Joined: 13 years ago
LightUp wrote:Don't feel too badly. When Scott (zparticle) started his journey to dimming lights he too had problems with getting the zcd working. He ended up building several iterations and finally got one going. It isn't clear why it appears to be elusive for some.

🙂 i guess i will have to keep trying till i get it right. I am so happy atleast the code is talking to the hardware which was my biggest worry because i dont understand c++ at all.
I should be able to figure something out with the ZCD soon.

thank you for all your help Light up!


Reply
Posts: 37
Topic starter
(@sherman-desouza)
Eminent Member
Joined: 13 years ago
kev wrote:I ran my Zero Cross Detection code again tonight and took a screenshot of the results that show up in the serial monitor. If you are not getting anything like what is shown then I think it is safe to say the circuit has a problem.

If it comes down to it, I could build and test a circuit board here and send it to you. Never mailed anything to Canada though.

Hi Kevin,
you are too kind! dont worry about it I will figure this out. My biggest concern was the software which seems to be working properly now.

Thank you again!


Reply
Posts: 1387
 kev
(@kev)
Noble Member
Joined: 12 years ago

I know, all simple things but sometimes overlooked while looking for a bigger problem.
-Double check resistance values (meter) in ZC circuit.
-Check continuity from ZC to MEGA. If cat5 is solid wire, maybe damaged?
-Maybe the problem is not with the Zero Cross.
-Double check grounds to all boards (continuity).
-Have you tried a different MEGA board?


Reply
Posts: 37
Topic starter
(@sherman-desouza)
Eminent Member
Joined: 13 years ago
kev wrote:I know, all simple things but sometimes overlooked while looking for a bigger problem.
-Double check resistance values (meter) in ZC circuit.
-Check continuity from ZC to MEGA. If cat5 is solid wire, maybe damaged?
-Maybe the problem is not with the Zero Cross.
-Double check grounds to all boards (continuity).
-Have you tried a different MEGA board?

-Double check resistance values (meter) in ZC circuit. - Checked 15K on each leg on the AC side 10K on the DC side
-Check continuity from ZC to MEGA. If cat5 is solid wire, maybe damaged? no the wire is fine. if i touch it i get a response on the interrupt.
-Maybe the problem is not with the Zero Cross. - it most likely is. Everything else is working as intended.
-Double check grounds to all boards (continuity). all good her. common ground bus to the entire system on the DC side starting with the 5V power supply.
-Have you tried a different MEGA board - that will be my last option. I am waiting to get my hands on a scope so i can check if the ZCD is working properly. Its going to be painful to change that mega but thankfully i am using a shield so i dont have to undo any wires 🙂


Reply
Posts: 2541
(@lightup)
Famed Member
Joined: 17 years ago

You didn't try the battery test, right?


Reply
Posts: 37
Topic starter
(@sherman-desouza)
Eminent Member
Joined: 13 years ago
LightUp wrote:You didn't try the battery test, right?

not yet 🙁 on my to do list.. getting busy at work.. will try it soon.


Reply
Posts: 37
Topic starter
(@sherman-desouza)
Eminent Member
Joined: 13 years ago
LightUp wrote:Another way to test the zcd circuit is to;
1) Remove the AC power from the zcd input terminals.
2) Use a 9V battery and connect the negative terminal to any one of the zcd AC input terminals then;
3) Connect the positive terminal of the 9v battery to a 820 ohm resistor and the other end of the resistor to the 2nd input of the zcd AC terminal.

You can monitor the zcd output with a multimeter, which should be low when you connect the resistor to the AC input terminal and high (approx. +5V) when you remove the resistor to the AC input terminal. Since the opto-coupler has two internal LEDs you can reverse the battery terminals and repeat the process above with similar results.

Hey Lightup,
so I tried your test today.. what i noticed is with or without the voltage on the input side my trigger output is always low... (0.89V), if i take the chip out the voltage rises to about the same as the 5V input.... i went through 4 chips and they are all doing the same thing... I am positive i have wired the circuit correctly. I have tested the resistance values and continuity to all points and they are all correct... this is driving me nuts 🙂


Reply
Posts: 2541
(@lightup)
Famed Member
Joined: 17 years ago

The opto output should only be high near the zero crossing voltage and low elsewhere. Therefore with no battery you should get close to 5V output, and close to zero volts when you apply 9v. Your measurements suggests that your "10K" collector resistor is almost open, or your opto's are all shot.
Socket issue? wiring issue?

With no power applied and only using an ohmmeter, do you get 10K ohms from pin 5 of the IC and the 5V supply point? Do you get close to zero ohms from pin 4 and the ground on your Arduino? When power applied do you get 5V between pin 4 of the IC and the 10K resistor end that is connected to 5V, including the wiring?

On my oscilloscope I get a pulse width of about 0.65ms at the base and about a peak voltage of 4.95V that looks like a 1/2 sinewave shape. This pulse peak straddles the zero crossing point on the AC waveform.


Reply
Posts: 1387
 kev
(@kev)
Noble Member
Joined: 12 years ago

Sounds like the opto-output is always forward biased. What is the resistance from pin 6 to pin 5? maybe you have a solder bridge between the two pins.


Reply
Page 4 / 6
Share: