http://www.inmojo.com/store/krida-elect ... -heatsink/
Now to figure out if it is even possible to get this going with Basic.
I am not to sure which pins to use for gate and sync.
And I have a lack of knowledge about Zero Cross Detection according to this it is on the board already.
So many questions now that I have this board...
Does timing need to be handled by the esp?
Can the ESP handle the proper fractions of a second?
Is Basic in its current form able to handle this type of project?
There is a sketch for the arduino as well as an android.apk to control it with the HC05 bluetooth adapter...
Sketch: https://drive.google.com/open?id=0B6GJo ... zF5MHBnUDQ
// Testing sketch for 50Hz !!!
//
// Bluetooth Module HC-05, Speed 9600kbps
//
// How to connect dimmer and hc-05 modules to Arduino UNO board
//
// Dimmer Arduino
// | |
// GND GND
// VCC 5V
// SYNC DIGITAL.3
// GATE DIGITAL.7
//
// HC-05 Arduino UNO
// | |
// GND GND
// VCC 5V
// TX RX (DIGITAL.0)
#include <TimerOne.h> // download this library from arduino.cc
unsigned char channel_1 = 7; // Output to Opto Triac pin, channel 1
unsigned char CH1;
unsigned char i=0;
unsigned char clock_tick; // variable for Timer1
int incomingByte = 0;
int mas[3];
void setup() {
Serial.begin(9600);
pinMode(channel_1, OUTPUT);// Set AC Load pin as output
attachInterrupt(1, zero_crosss_int, RISING);
Timer1.initialize(100); // set a timer of length 100 microseconds for 50Hz or 83 microseconds for 60Hz;
Timer1.attachInterrupt( timerIsr ); // attach the service routine here
CH1=95; // WHEN ARDUINO START, BULB OFF (95 - FULLY OFF ; 5 - FULLY ON) !!!
}
void timerIsr()
{
clock_tick++;
if (CH1==clock_tick)
{
digitalWrite(channel_1, HIGH); // triac firing
delayMicroseconds(10); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(channel_1, LOW); // triac Off
}
}
void zero_crosss_int() // function to be fired at the zero crossing to dim the light
{
// Every zerocrossing interrupt: For 50Hz (1/2 Cycle) => 10ms ; For 60Hz (1/2 Cycle) => 8.33ms
// 10ms=10000us , 8.33ms=8330us
clock_tick=0;
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
if (incomingByte=='X')
{
mas[0]=Serial.read();
mas[1]=Serial.read();
mas[2]=Serial.read();
Serial.flush();
}
if (mas[0]=='A') { if(mas[1]>=0) {CH1=mas[1]; CH1=100-CH1; if (CH1<5) {CH1=5;} if (CH1>95) {CH1=95;}}}
}
}
Android APK: https://drive.google.com/open?id=0B6GJo ... 196ODF4U2s
However this is a basic forum and I kind of want to make it possible for basic and share the project and create a video of it operating etc....
Anyone with a decent knowledge feel free to join in on this project and help it along right now I do not have anything but "some of the parts" and a whole lot of questions. I still need a light fixture for the final application but for now I have a light fixture that will work as a test rig.
I would like to share all instructions, parts, code, etc... But I must say that I would never suggest that ANYONE who is not certified to work with High Voltage should do so nor that anyone should try it without the proper safety, knowledge, and tools.
Thanks in advance to any contributions made to this project we need to show some cool stuff with basic in mind I have all the tools at my disposal to make this happen.
Somethings to note:
Currently the electric I use is 60hz 120VAC
So all timing will be based off of this!
Could I just copy and paste code and get this thing working with my arduino?
Yes I could but it defeats the purpose of bringing this to Basic to really show the potential.
I will need help on this one due to my lack of understanding but in the end the project will be a community project that will improve upon what is available with Basic.
If there is zero interest in making this happen or zero help I may just copy and paste code and skip making this project at all so that I don't have equipment sitting around collecting dust for no reason at all.
Lets reinvent this thing and make a basic AC light dimmer!
Arduino Test Sketch:
unsigned char AC_LOAD = 7; // Output to Opto Triac pin
unsigned char dimming = 3; // Dimming level (0-100)
unsigned char i;
void setup() {
// put your setup code here, to run once:
pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
attachInterrupt(1, zero_crosss_int, RISING);
// Serial.begin(9600);
}
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 : (50Hz)-> 10ms (1/2 Cycle) For 60Hz (1/2 Cycle) => 8.33ms
// 10ms=10000us
int dimtime = (100*dimming); // For 60Hz =>65
delayMicroseconds(dimtime); // Off cycle
digitalWrite(AC_LOAD, HIGH); // triac firing
delayMicroseconds(10); // triac On propogation delay (for 60Hz use 8.33)
digitalWrite(AC_LOAD, LOW); // triac Off
}
void loop() {
// Serial.println(pulseIn(8, HIGH));
for (i=5;i<85;i++)
{
dimming=i;
delay(20);
}
for (i=85;i>5;i--)
{
dimming=i;
delay(20);
}
}
NOTE WE SHOULD NOT NEED TO USE SERIAL FOR THIS !!! WIFI is built in to the ESP...
Where I buy my ESP8266 boards from... (Banggood)