Contenidos
Components
Touch sensor
The touch sensor is a capacitive sensor that serves as a button to learn more about the can click here.
Relay to 220V
It is a device to separate electrical circuits of the arduino powered 5v to the bulb that operates at 220V.
Circuit
We will use the same circuit that we did for the relay or the touch sensor.
5V control circuit
Power a 220v circuit
THIS ASSEMBLY CAN HAVE CERTAIN ENDANGERMENT TO THE WORK WITH 220V IS RECOMMENDED HAVE CERTAIN KNOWLEDGE OF ELECTRICITY AND DISCONNECT THE CIRCUIT WHENEVER IS CHANGE, NOT WORK WITH THE USB DIRECTLY TO THE PC AND USE A POWER INDEPENDENT FOR ARDUINO.
Program
The software will be a rise detector, bulb has a status that can be switched on or off, having a change in the detector from «low» to «high» must change us that State, so we will use the flanks detector
Code
PUSH BUTTON SWITCH
pinLED int = 13;
int pinTouch = 8;
int SenalActual = 1;
int SenalAntigua = 1;
int State = 1;
void setup() {}
On light bulb
pinMode (pinLED, OUTPUT);
sensor input
pinMode (pinTouch, INPUT);
}
void loop() {}
flank detector
SenalActual = digitalRead (pinTouch);
If (SenalActual == HIGH & SenalAntigua == LOW)
{
If there is a rise flank, it changes the status of low to high 0 from high to low.
State =! State;
We get it
digitalWrite (pinLED, State);
};
SenalAntigua = SenalActual;
}
Once programmed by touching the sensor should change the status of the light bulb.
Video of operation
If you are looking for a developer for Arduino, this is your site.
Exhibitor Arduino
If you wish to buy an Arduino for this or other projects click here or on the image.