<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13860/problem-with-ac-dimmer-circuit-with-nrf51822</link><description>hi, 
 i tried to make a ac dimmer circuit controlled with dc 
 i use nrf51822 
 this is my dimmer circuit 
 
 aaand this one is zero crossing detector 
 
 finally this is my mbed code; 
 DigitalOut trigger(p15); 
 DigitalIn zero(p14); 
 int</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Jun 2016 15:29:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13860/problem-with-ac-dimmer-circuit-with-nrf51822" /><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52955?ContentTypeID=1</link><pubDate>Mon, 13 Jun 2016 15:29:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51ca7e84-4f85-4785-95c2-8c855152cc0b</guid><dc:creator>OnureaN</dc:creator><description>&lt;pre&gt;&lt;code&gt;include &amp;quot;mbed.h&amp;quot;

InterruptIn zero(p5);

DigitalOut trigger(p11);

Timeout dim;

void event()

{

    trigger = 1;

    wait_ms (1);

    trigger = 0;

}

void dimmer()

{

    dim.attach(&amp;amp;event,0.005);

}

int main()

{

    //zero.mode(PullDown);

    while (1)

    {

        zero.rise(&amp;amp;dimmer);

    }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;this code solved my problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52953?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 14:22:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0c8fc2f-0b58-43c8-8ca7-cba0e38c97c2</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;It looks like that. You have to check the trigger signal on the oscilloscope and check that the trigger signal and the zero crossing signal happens at the correct time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52952?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 13:56:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab3c406f-0df1-4d06-bb44-5d779f3bd6c3</guid><dc:creator>OnureaN</dc:creator><description>&lt;p&gt;actually,
i look at h11aa1 pulse output at first channel, and AC line second channel, and every 10 ms (zero cross moment) a pulse happend.(in my country freq is 50Hz) but of course trigger pulse isn&amp;#39;t happend every 5 ms. code is like i wrote, nothing more or less.&lt;/p&gt;
&lt;p&gt;but after seeing oscilloscope i am sure wrong part is code, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52951?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 13:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21aa2dc1-66c8-44a0-9847-347f1df7d749</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Do the trigger signal happen 5ms after the zero crossing if you look at the oscilloscope? Are you doing anything else in your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52950?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 12:52:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:905f4b47-c85d-4a00-ac83-66e464e1f22d</guid><dc:creator>OnureaN</dc:creator><description>&lt;p&gt;ty for reply. actually i made this schematics for question in a rush, and now i see that its pin config wrong, but my circuit desing on board correct, of course i made config by datasheet of h11aa1&lt;/p&gt;
&lt;p&gt;also i detect the zero crossing pulse correctly on a oscilloscope. so my problem on the code part.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52954?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 09:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50bb8e89-db0c-49cb-b485-b69024f50800</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You should also use GPIOTE, TIMER and PPI instead of doing wait_us and polling pin in main. When using code that run asynchronously, like the SoftDevice, this code will not work because interrupts can happen during the wait_us and the timing will be wrong. With GPIOTE, PPI and TIMER the triggering of the triac can happen automatically without using the CPU.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem with ac dimmer circuit with nRF51822</title><link>https://devzone.nordicsemi.com/thread/52949?ContentTypeID=1</link><pubDate>Wed, 18 May 2016 09:25:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c828648-d4b5-4f1b-8f38-8b5199ecf4dc</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;First of all, the h11aa1 symbol does not seem to be correct. h11aa1 is an AC optocoupler, as can be seen from a quick &lt;a href="https://www.google.no/search?q=h11aa1&amp;amp;espv=2&amp;amp;biw=1920&amp;amp;bih=1075&amp;amp;tbm=isch&amp;amp;imgil=Kzk9NH8r8cWZ4M%253A%253BOS1lt3TUGVQwGM%253Bhttp%25253A%25252F%25252Felectronics.stackexchange.com%25252Fquestions%25252F212739%25252Fhow-zero-crossing-optoisolator-to-work-with-220vac&amp;amp;source=iu&amp;amp;pf=m&amp;amp;fir=Kzk9NH8r8cWZ4M%253A%252COS1lt3TUGVQwGM%252C_&amp;amp;usg=__CU9irt1zCpO9UH6qQQwXI_GuJ0Q%3D&amp;amp;ved=0ahUKEwj59taro-PMAhWJkCwKHRrAAG4QyjcIRA&amp;amp;ei=LjE8V_mnJomhsgGagIPwBg#imgrc=Kzk9NH8r8cWZ4M%3A"&gt;search on google&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Second; you have connected the base of the phototransistor, this should in most cases be left open. You should connect the collector (pin 5) to the microcontroller (as can be seen in the google search). With your configuration the zero pin on nRF (p14) is always high, which means that the code will trigger the triac approximately every 5ms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>