Arduino Nano (AVR): OK. Arduino Nano 33 iot (SAMD): flickering.
spacejunkies opened this issue · 6 comments
Describe the bug
When I use the Arduino Nano (AVR), the dimmer works very well, without fickering. When I use the Arduino Nano 33 iot (SAMD), there is flickering in my house mains. (I used an oscilloscope and I observe that the trigger pulse period from Arduino Nano 33 iot to the RobotDYN dimmer (TRIAC) is not always constant.) I get the same behavior whether I use [1_dimmable_light], [2_dimmable_lights] or [7_linearized_dimmable_light].
The application is a heater. See the HW and SW used below.
Hardware and software used
Arduino 1.8.19
- Library version: [1.6.0]
- Arduino core: [Arduino SAMD v1.8.13]
- Enviroment/IDE: [Arduino IDE]
- Dimmer board: [RobotDYN 2-channel]
- Board: [Arduino Nano 33 IoT]
Selected 60Hz network frequency
Hi, had you tried to adjust (and increase) the constants such as startMargin, endMargin, and gateTurnOffTime at the begin of thyristor.c
?
EDIT: I had tried to clean library v1.6.0 with RobotDyn Dimmer (1-CH) and example 1, and it works perfectly. Since I don't have 60hz network, I cannot replicate your exact setup. May you post the link of the Dimmer board you are using?
Hello, thank you for your quick reply. I will try different values for startMargin, endMargin, and gateTurnOffTime. Based on your experience, would you recommend specific ranges of value to try for those parameters? (I would expect the 2-CH module to behave the same as the 1-CH module.)
https://www.aliexpress.com/item/32972336897.html?pdp_npi=4%40pre%21CAD%21C%24%2011.17%21%21C%24%2011.17%21%218.18%217.93%21%402101f08717046829714527105ed6da%2112000016908124674%21sh01%21CA%21949636932%21&spm=a2g0o.store_pc_home.productList_2006959807184.32972336897
The 2 modules have slightly different electronics, but it shouldn't be a problem...
An easy trial may be respectively 800, 800, 700us, and then tune them by steps of 100us.
You are correct: the library works with Arduino Nano 33 iot. However, under certain conditions, flickering can be observed. In summary, there is a design problem with the Arduino Nano 33 iot board design that causes an issue then the board is powered with Vin. Thank you for your support - and let me explain (it could help another user having issue with your dimmer library.)
I found out the problem by accident when I disconnected the board from the 12V Power Supply that was connected to Vin, and powered it through the USB port. I observed that the flickering was less intense. Curious, I then used a external variable power supply that I connected to Vin. As I increased the voltage, the flickering became, indeed, more intense. I then researched to see if anyone else had problems when Vin is used. And I found many users reporting issues. Example:
https://forum.arduino.cc/t/extreme-noisy-board-voltage-3-3v-on-nano-33-iot/623016
The conclusion from all those threads: the power regulator on the Arduino Nano 33 iot was not designed in correctly, and generates a very noisy 3.3V power line. It creates performance issues with some pins. So I set my external power supply to 3.3V and connected it to the 3.3V pin (bypassing the power regulator altogether). And the flickering disappeared!
The solution for my prototype: I will use an external power regulator, that will step down the 12V into 3.3V and I will connect it directly to the Arduino Nano 33iot 3.3V pin.
https://www.amazon.ca/gp/product/B08214MRSW/ref=ox_sc_act_title_2?smid=A30Y6WWS77DGEW&psc=1
Thanks!
Thanks for reporting the link about the Arduino IoT 33 issue, for sure it may help other developers!