I was able to implement the same on nrf52832 based on this example. It wasn't as easy as I expected, but using pwm + ppi did the trick. Thank you!
@TasteTheCode Жыл бұрын
I'm glad that it worked!
@chimpofm3 жыл бұрын
My dude!! This is what ive been looking for. Can you do a video on how to add pid temp control of the ac fan controler. Outputting the temp value via iot user interface like blynk.
@TasteTheCode3 жыл бұрын
Thanks! That's an interesting request. I'll add the idea to my list.
@chimpofm3 жыл бұрын
@@TasteTheCode thanks buddy. The cheapest pid fan controller is the smscom at 50 bux. Thats without iot. I hope this makes it to a video. It would help me and my gardening budys out loads to be able to control fan speed based on temperature. Plus it would compliment our iot aquarium monitor we have just made. Coughs * hydroponics *
@TakamiWoodshop3 жыл бұрын
I like it Bill, I had no idea you could do that with arduino! Playing around with 240v would scare the crap out of me though.
@TasteTheCode3 жыл бұрын
Yup, not for the faint hearted 😅😅😅
@TakamiWoodshop3 жыл бұрын
@@TasteTheCode ⚡😬⚡
@MixwellSidechains Жыл бұрын
Can I connect more multiple module's zero-crossings pin to the same pin (e.g. pin 2) of the microcontroller or do I have to have a interrupt pin for each as I would the PWM signal pin? Isn't it the PWM signal pin that controls the triac? Why would I need an interrupt to do so?
@TasteTheCode Жыл бұрын
No, you will need an interrupt for each. It is needed because we need to know when at the sine wave signal to turn on the triac. This is AC so it works much differently to PWM in DC. The interrupt is there for the precise timing as otherwise the microcontroller will miss the right moment to turn on the triac.
@Aisi555 Жыл бұрын
For you who have flickering problem, try to add snubber R-C 100ohm - 10nF across the triacs MT terminal. The triacs available on the market are cheap crap or fake one. BTA16 will couse headache. Try using triacs from old power electronics and its all smooth dimming. Chinese semiconductor sucks...
@TasteTheCode Жыл бұрын
Hey, thanks for the added info. I did not had issues with mine but this is nice to know.
@BenBilesBB-box2 жыл бұрын
going to try this with 2 modules and an esp32. hopefully the interrupts stay high long enough for that.
@TasteTheCode2 жыл бұрын
Yep, that should work just fine. I tried it once with an Attiny85 once and it was still working OK.
@BenBilesBB-box2 жыл бұрын
@@TasteTheCode nice to know! I ordered 2 already. I'm making a 3d printer enclosure and I want to regulate the internal temp of the case with the 110v extractor fan and I'm thinking of powering the actual printer with another module so I can shut the printer off if the thermistors detect unusual high temps etc. maybe even hook up a smoke detector in there to
@TasteTheCode2 жыл бұрын
@@BenBilesBB-box Sounds like an interesting project 😀 If you need simple on/off, maybe a solid state relay is better for turning off the printer?
@BenBilesBB-box2 жыл бұрын
@@TasteTheCode thanks, great idea. I just found the same company sell an SSR with opto isolation and 3.3v - 12v logic for a few bucks. I can have 2 variable speed fans and power shut down for the printer now with SSR.
@ocean86493 жыл бұрын
Hi, I am currently working on a project similar to this, this video is very helpful. I do have a question, are the two loads connected in parallel?
@TasteTheCode3 жыл бұрын
Yes, both the fan and the light bulb are connected in parallel.
@ocean86493 жыл бұрын
@@TasteTheCode thank you for the reply
@TasteTheCode3 жыл бұрын
@@ocean8649 You are welcomed!
@mrgcav8 ай бұрын
In the USA we use 120VAC and I have a large 2.0HP (about 10amps) Inductive AC motor I need to control the the speed of on a table saw. I like you setup. Problem with Triacs is Idle current. So when your circuit is "OFF" how much power is it still drawing ? If I am Drawing 10 amps then would I not need a much bigger heatsink for the Triac ? Would you still use an Arduino node MCU if you did this again ?
@TasteTheCode8 ай бұрын
You will need a dimmer that is rated for the load you are applying. However, large inductive loads are now a good thing to regulate with this method. In terms of the NodeMCU, sure, it does the job but you can also go with ESP32 nowadays.
@zyghom3 жыл бұрын
that is exactly the project I am working on now! Perfect. But how to do it with Raspberry? I think this should be fairly similar: zero detection: any pin with interrupts, then control over standard PWM, right?
@TasteTheCode3 жыл бұрын
Yes you are.correct!
@zyghom3 жыл бұрын
@@TasteTheCode Thank you ;-) I am going to change 20 GBP fan for "200 GBP Wahoo fan" with 1 pico and 1 module from Ali (2 GBP) - lets see if it works ;-)
@whyzhr3 ай бұрын
Is it necessary to use a universal motor, or is it also safe to use with a solenoid motor?
@TasteTheCode3 ай бұрын
Sorry but I'm not familiar with the solenoid motor so I can't tell.
@TheEdevat11 ай бұрын
Your content is great! Inspired by this, I started creating a circuit that simulates sunrise and sunset for a chicken farm. I am trying to dim 15 different lamps with a single dimmer module. Everything is fine up to 2 lamps, when there are 3 or more lamps, I constantly get 220v output, dimming does not work. I couldn't understand what I did wrong, can you help me?
@TasteTheCode11 ай бұрын
Thanks for the great words! For the dimmer, what is the actual rating of it? The dimmer must be rated to handle the attached load so I'm guessing that yours is not and it fails ro handle the dimming properly.
@TheEdevat11 ай бұрын
@@TasteTheCode First of all, thank you for your quick response. I'm not sure what actual rating means, I'm sorry, my electronic knowledge is limited. But I can give more information about my circuit. I am using Robotdyn AC dimmer module, this module has bta16-600 Triac on it. The bulbs I use are dimmable 9w LED bulbs, 15 in total. I measure 0.3 amps when all bulbs turn on at the same time. The mains voltage where I am is 230V 50 Hz. Finally, I use the module on a nodemcu and the library I use is dimmable_light.h
@Ram-bf7xq2 жыл бұрын
Sir plz make it with EEPROM
@TasteTheCode2 жыл бұрын
You can check my other video on how to add EEPROM data retrieval and saving kzbin.info/www/bejne/n3acYoarj7imfLM
@SJman-ch3dj2 жыл бұрын
I'm curious where you got the schematic for the module?
@TasteTheCode2 жыл бұрын
To be honest, I don't really remember... Basically, it just follows the standard example circuit for an AC dimmer.
@pwn20wnd56 Жыл бұрын
Can we determine the output AC voltage as we want? For example I want the output to be 175V AC
@TasteTheCode Жыл бұрын
There is no real feedback about what the output voltage is but you can I guess ise math ro calculate it or use voltage sensor to read it and feed it back to the Arduino.
@Funny_sto_rees Жыл бұрын
sir what if i only connect live wire to dimmer and the gnd to the load does it will work fine or not
@TasteTheCode Жыл бұрын
Any other connection except the one shown will not work. You need both wires in both places.
@mrgcav8 ай бұрын
Please updaten the Triac Module is no longer on Aliexpress
@TasteTheCode8 ай бұрын
Hmm, I just checked the link and it works for me. Can you please double check it?
@faturahmanf30242 жыл бұрын
Hello , does an intterrupt pin affect the zerocross off the dimmer, i found trouble that when i use the dimmer and use any interrupt pin i found error in the compiler
@TasteTheCode2 жыл бұрын
Yes, an interrupt pin is required to get proper timing on the zero crossing signal. If you need multiple interrupts, then you must use a board that supports them and define different routines for each.
@faturahmanf30242 жыл бұрын
@@TasteTheCode what board do you suggest?, Can it use arduino mega??
@TasteTheCode2 жыл бұрын
@@faturahmanf3024 each board has different specs, Mega has pins 2, 3, 18, 19, 20, 21 (pins 20 & 21 are not available to use for interrupts while they are used for I2C communication) defined as interrupts. On ESP32 all GPIOs can be configured as interrupts.
@faturahmanf30242 жыл бұрын
@@TasteTheCode so in arduino mega i can use each of this pins to use interrupt pin for any different function including use it as zero cross for the dimmer, is that right? Currently in my board using arduino uno i cannot compile the program of rbd dimmer if i use one of the interrupts pin on it, so in my board i use pin 2 for zero cross and i use pin 3 for the interrupts pin for the encoder, but the arduino ide cannot compile it, a cannot use it at the same time. i have to use one of it so the compiler not error, so if i use dimmer i cannot use my encoder, then if i use my encoder i cannot use my dimmer, if you give me some help i will be very appreciate it, currently i working on my final project for my college
@TasteTheCode2 жыл бұрын
@@faturahmanf3024 hmmm I'm not sure what might be causing that. You should be able to use both interrupts at the same time as long as they have separate handling routines. Try searching for the exact error message you are getting and resolve it that way.
@zzzzzzz17293 жыл бұрын
Hi Bill, can we use arudino nano, if yes what is the interrupt pin we have to use?
@TasteTheCode3 жыл бұрын
Yes, you can. There are two interrupt pins on the Nano, pins 2 and 3.
@SurajKumar-xt4ur Жыл бұрын
hi. is this circuit frequency control or voltage regulator?
@TasteTheCode Жыл бұрын
Neither, this cuts the current flow at each zero crossing point in the input sinewave.
@danieldbird Жыл бұрын
Great video. Will this work with ESP32?
@danieldbird Жыл бұрын
Also does this work the same as Shelly Dimmer 2?
@TasteTheCode Жыл бұрын
@@danieldbird I'm not familiar with the Shelly dimmers but it should work exactly the same with ESP32
@danieldbird Жыл бұрын
Thanks!
@vincekeanneta-aca4340 Жыл бұрын
It it possible to add dht11 sensor to makeit temperature base ?
@TasteTheCode Жыл бұрын
You mean to measure the temperature of the lamp? Sure it can. Based on that you can then vary the duty cycle through the microcontroller.
@yolo9036 Жыл бұрын
Hello, we have same to add dht11, can i see your source code for this? Cuz i have to compile the value dont get it
@thewaveringwarrior Жыл бұрын
Could let us see the code which makes it work with a Potentiometer instead of using the keyboard. I guess you connect the pot to the ADC input pin?
@TasteTheCode Жыл бұрын
Yes exactly. The read value needs to be mapped in a range of 0 to 100 and can be used to drive the dimmer.
@peastfist16022 жыл бұрын
Do you know on how to control 5V fan speed using raspberry Pico ?
@TasteTheCode2 жыл бұрын
For DC loads like that fan, you new PWM signal from the Pico to turn on a MOSFET as the fan draws more current than what the Pico can provide.
@cicciosonyalfa2 жыл бұрын
Hi, I have to control 4 lights at the same time with 4 different boards, did you use the command: dimmer.setPower(val) to control one output, to control multiple outputs which command should you use?
@TasteTheCode2 жыл бұрын
For multiple dimmers, you will need to define multiple dimmerLight objects like dimmer1, dimmer2, etc., and then set the brightness on each of them. If they are running from the same AC phase, I think you might get away with using just one zero-crossing signal, but otherwise, you will need a board with multiple interrupt pins like ESP32 in order to control all of them.
@cicciosonyalfa2 жыл бұрын
@@TasteTheCode Use the same phase. Could you give me an example with the code, in the library examples I didn't find anything
@TasteTheCode2 жыл бұрын
@@cicciosonyalfa You need to create different objects for each of the dimmers like this dimmerLamp dimmer(outputPin);, dimmerLamp dimmer1(outputPin1);, dimmerLamp dimmer2(outputPin2); etc. where each dimmer has its own pin that it is connected to. Later you will need to set the values of all of them like this: dimmer.setPower(outVal);, dimmer1.setPower(outVal);, dimmer2.setPower(outVal);, etc. I have not tried this and it might have an issue with all of them using the same interrupt pin but you can give it a go. If this does not work, then all initialization will need to be done with the second constructor where a different interrupt pin is passed for each. dimmerLamp dimmer(outputPin, zerocross);
@cicciosonyalfa2 жыл бұрын
@@TasteTheCode Thanks, as soon as I get the 4-light card I'll try and let you know
@cicciosonyalfa Жыл бұрын
@@TasteTheCode The boards arrived, I started programming a board and it works well, if I add the definitions of the other 3 dimmers, (dimmer 1, dimmer 2, dimmer3) the lamp flickers, goes off halfway through the cycle, then goes back on. If I remove the 3 definitions, the lamp, as if by magic, starts working well. Does that mean this library can only work with a lamp?
@mareksendecki56953 жыл бұрын
Im using this module and SUNON DP203A AC FAN and it's acting strange. Bulb works fine but the fan is just buzzing when at 50%. At 70% it works fine but slower than 70% and at 99% it's buzzing and moving at a speed of 1 maybe 2 RPM. Any idea why? I dont have an oscilope to monitor the output wich i suppose may be useful. Thanks for the video :)
@TasteTheCode3 жыл бұрын
I wonder if there's some noise on the zero crossing signal. I had some weird behavior as well but only on very low speeds where I guess the motor was not able to spin they slow. Try the motor and the bulb in parallel, maybe the motor inductance messes with the module in some way. Let me know the results, I'm interested in what's going on.
@pritambakshi693611 ай бұрын
Can you metion your Arduino IDE, Esp8266 board manager and RBDDimmer library version.?
@TasteTheCode11 ай бұрын
I don't recall what versions I used exactly as I constantly update them to the latest ones.
@pritambakshi693611 ай бұрын
@@TasteTheCode but now its works or not
@TasteTheCode11 ай бұрын
No matter the library version it should still work.
@pritambakshi693611 ай бұрын
@@TasteTheCode Can you explain me what problem i have faced.
@TasteTheCode11 ай бұрын
I can try. What is the problem you are having?
@MarkLucas-s3x Жыл бұрын
Has anyone gotten this sample (SerialMonitorDim) to run on an Arduino Nano? If so what pins did you hook the dimmer module to, and what tweaks were needed to the code? I tried D2 for the Z-C interrupt and D5 (defined as pin 8) for PSM, but no joy. What am I doing wrong? Thanks!
@MarkLucas-s3x Жыл бұрын
So to answer my own question, for Arduino Nano outputPin should be #defined as PD5. What threw me at first was that for some still unknown reason (at least with my dimmable LED bulbs) many power level settings (particularly but not solely those >=95 or
@TasteTheCode Жыл бұрын
@@MarkLucas-s3x Some of the low power settings know to be unstable because things are happening too fast I guess so the circuit can't keep up. I've also seen flickering with values
@razidaufaa96265 ай бұрын
Excusme sir, I'am sorry, my program encountered an error, = 10 | #include "esp_intr.h" compilation terminated. Can you help me sir? Thaks sir
@TasteTheCode5 ай бұрын
Make sure that you have the right board installed and selected in Arduino IDE. There is no way for me to know what exactly is causing this issue but you can start with checking the boards. Otherwise, please search online for similar issues.
@razidaufaa96265 ай бұрын
@@TasteTheCode Oke sir, i done using board ESP32, and i try search in internet, but can't yet
@anwarisholichul7686 Жыл бұрын
from this video can it be connected to nodered?
@TasteTheCode Жыл бұрын
Yes it can but not with the current sketch. I haven't connected it myself so I would not know to tell you exactly how.
@anwarisholichul7686 Жыл бұрын
@@TasteTheCode are you still using the same module?
@TasteTheCode Жыл бұрын
Yes, why?
@anwarisholichul7686 Жыл бұрын
@@TasteTheCodeCan you provide an overview for this project, can it be connected to node red
@yogabharath17112 жыл бұрын
why this lib not work in rp2040 any other alternative src here
@TasteTheCode2 жыл бұрын
Sorry but I haven't worked with RP2040 yet so I can't get this info for you.
@manumohan19282 жыл бұрын
can we use 2hp ac motor with this Dimmer Module. pls reply
@TasteTheCode2 жыл бұрын
The 2hp is around 1.5kW? That is what Google told me so if that is true, the current draw of that motor on 220V will be about 13A. The module is only rated for 8A so the answer is no. The maximum I would use this for is around 600W. You need a module that can handle a lot more current but the setup will be the same.
@manumohan19282 жыл бұрын
@@TasteTheCode thanks for your reply
@jameswainaina44802 жыл бұрын
I want to develop a similar project
@TasteTheCode2 жыл бұрын
Awesome! Feel free to use this one as a base.
@carljay2177 Жыл бұрын
can it handle and control 1.5-2Hp 220 ac induction motor?
@TasteTheCode Жыл бұрын
The module says it can handle 8A of continuous load but I'm guessing that is for a resistive load. A 2Hp motor will draw ~13A. And that is an inductive load which brings even more problems. The module is suitable for smaller motors, fans and heaters.
@carljay2177 Жыл бұрын
@@TasteTheCode how about a 1.5Hp gear motor?
@TasteTheCode Жыл бұрын
That will be around 9-10A. Still too much. There are probably bigger modules that you can look at that should handle such loads.
@carljay2177 Жыл бұрын
@@TasteTheCode what modules should I use?
@TasteTheCode Жыл бұрын
@@carljay2177 You can try this 24A module but I've never used such high power module, I'm not sure how it will go. www.aliexpress.com/item/1005001965951718.html?spm=a2g0o.detail.0.0.2b64657cSJgOQh&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.291025.0&scm_id=1007.13339.291025.0&scm-url=1007.13339.291025.0&pvid=6c714dc3-2f23-475b-aa9e-f302b2334412&_t=gps-id:pcDetailBottomMoreThisSeller,scm-url:1007.13339.291025.0,pvid:6c714dc3-2f23-475b-aa9e-f302b2334412,tpp_buckets:668%232846%238111%231996&pdp_ext_f=%7B%22sku_id%22%3A%2212000018256785548%22%2C%22sceneId%22%3A%223339%22%7D&pdp_npi=3%40dis%21USD%217.99%217.83%21%21%21%21%21%402101d1b916787005781816918e5674%2112000018256785548%21rec%21MK%21164368730
@zyghom3 жыл бұрын
my fan went to trashbin ;-( unfortunately: not ALL AC fans are OK with speed control using this method just that you know ;-)
@TasteTheCode3 жыл бұрын
Sorry to hear that. Any specifics why? What makes some work and others not?
@zyghom3 жыл бұрын
@@TasteTheCode type of AC motor. I am not 100% sure about the names but there are few of them and .. the cheapest fans are... the cheapest, not subject to "triac things". They have wire split into 3 parts and there is a rotary switch giving possibility of speed 1,2 or 3. I wanted to be "better" and use speed 3 and then to regulate the speed by triac... I could have saved it but I turned it on and ... went for coffee. The fan was at zero rpm and got burned due to some lower current but without rotation there was no cooling so. Anyway, you cannot learn without mistakes ;-) I am back to business by making this rotary switch remotely on my turbo and relays inside the fan to switch the wires while and can do it remotely from the bike.
@TasteTheCode3 жыл бұрын
@@zyghom yes, low RPM can be a problem. In my case, I found that 30% is the minimum at which the fan spins at all so I plan to limit the low end so it does not stop to provide some cooling.
@maestrospavlou Жыл бұрын
Hi. what percentage should I send so that I get 220 volts at the output? with 60% the output is 116 volt and if i increase the percentage the output voltage decrease again. can you send your email to contact with you please? thank a lot.
@TasteTheCode Жыл бұрын
Make sure that the zero crossing code is set through the interupt and that there is no delay in the code there as with higher duty cycle, the code needs to run faster. For a full output the percentage should be 100%.