Even though the schematic looks somewhat right, the breadboard sketch looks off to me. I followed the guide lines generated in Fritzing when I did the schematic sketch to place the jumpers on the BB.
And I’m still not sure about the red and blue rails.
This schematic is the best so far, IMHO. I can’t speak to the breadboard layout, since I don’t use fritzing, and am not a huge fan of breadboards in general.
So, the components I’ll need:
1 Diode 1N4148
1 Capacitor 10uF/50V
2 Resistor 120ohm
2 Resistor 100ohm (The shop I’m thinking of buying from does not have 220ohm)
1 FOD817B DIP-4 Optocoupler
1 N-Channel MOSFET 60V 30A
DC Barrel jack
12V axial fan
Wires
Breadboard
My last question is how I best can cram all this into a casing.
Im thinking something in the range of 120 to 150mm x 100 to 120mm.
Why casing? This is going to be a magnetic stir plate when it’s ready.
I feel that a bread board will have a hard time fitting in a casing like that.
The breadboards that come with the Particle kits are 80x55mm, and there are even smaller ones available.
You also might want to get medium (insertion) force breadboards if you intend to move components from time to time.
If they have no 220Ohm resistors you should also be OK with 330Ohm. https://docs.particle.io/datasheets/kits/#photon-kit
@TripleJr, you can absolutely use that buck regulator (in fact, I have)! I suggest you power the Photon via the Vin pin instead of the USB connector. Make sure you add a 0.1uF decoupling capacitor between the Vin pin and GND.
So, I tried bypassing the MOSFET directly to the opto coupler. That somewhat failed too.
I could get the fan to spin really slowly if I helped it start. When I put the fan directly to the power source it worked as expected though.
My DC adapter is rated at 300mA at 12V and the fan at 140mA.
The only problem is that the fan makes a beeping sound in lower RPMs, but that’s not something that concerns me much. Next step or an upgrade would be swapping it for some kind of brushless motor.
Thank you for telling me. I want to control AC fan speed. I found many post related with fan speed in the community but didn’t find any working solution for me.
Can you please guide me here? I did following thing but it is not working ultimately. Can you find, why is it not working?
My schematic is
My code is
//Code is based on 220V 50Hz AC
int AC_LOAD = A4; // Output to Opto Triac pin
int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF
void setup()
{
pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
attachInterrupt(A4, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above
}
//the interrupt function must take no parameters and return nothing
void zero_crosss_int() //function to be fired at the zero crossing to dim the light
{
// Firing angle calculation : 1 full 50Hz wave =1/50=20ms
// Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
// For 60Hz => 8.33ms (10.000/120)
// 10ms=10000us
// (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65
int dimtime = (75*dimming);
delayMicroseconds(dimtime); // Wait till firing the TRIAC
digitalWrite(AC_LOAD, HIGH); // Fire the TRIAC
delayMicroseconds(10); // triac On propogation delay
digitalWrite(AC_LOAD, LOW); // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}
void loop() {
for (int i=5; i <= 128; i++){
dimming=i;
delay(10);
}
}
@mohitagnihotri, the code is not working because your hardware does not match the code! The code is expecting a zero-crossing signal which generates an interrupt. Your circuit does not have that zero-crossing detector. Did you find the code in this forum? What about the circuit?
You may want, for the sake of safety and simplicity, to look at this board on Tindie:
@mohitagnihotri, yes the circuit will work and the code will also with minor modifications. I caution you that working with 220V can be fatal if not done properly.
I'm going to second that. If you're not comfortable with working with mains, then please, do not attempt to DIY it. It may cost you more than you bargained for, and that's just not worth it.
Unless you can guarantee proper and safe practice around working with mains, hire a professional. Mains is not something to be messed with and will kill you if handled improperly.
Depending on where you're located you might also be subjected to a variety of regulations prohibiting you from tampering with mains unless certified. If you fail to meet these, you may get fines, and insurances might not cover you in case of accidents.
Thread carefully.