Arduino controlled outlets
So i got this box with an outlet. A switch a button and a buzzer on the inside is a relay and a timer. I wont be doing anything with this first. I cut out all the wires, then i checked which of the wires made a connection with the button. I did this with the beeping function on my multimeter. This i did because i want to reuse the button. I found some other outlets in a junk drawer and decided to use these. I can already start with connecting all the grounds and neutrals. Together with these jumper wires. I made some extra holes and the existing holes a bit bigger so that the outlets may fit the black wires will be the hot wires for each outlet to be switched separately. I need four of these. Each outlet has its own. Now all these hot wires will be screwed down in a solid state relays. Each solid state relay has three terminals, a common are normally open and a normally closed. I shall be using the common and the normally open. The hot wires will be going to the common of each of the four relays, and the wire that goes to the outlet will be in the normally open like so i added an outlet in the inside of the box for the power adapter of the arduino. Here i wired the arduino like in the schematic i added the power adapter in, and it just clears the lid and the outlets i replaced the terminal blocks with a wacko.
This holds the wire just a little bit better, since this is all wired up. Lets go and see what code will look like the code for what i made is actually pretty simple. I define the inputs and the outputs they are in or outputs. Here i check if the button is pressed. If so, i make relay 1 high and write the current milliseconds. The arduino is powered on to the current time. Then i check, if current time, minus previous time is greater than or equal to delay, time which was set to 500. If it is greater, we make all the relays high and make previous time equal to current time and last. If the button is not high make everything low, i grabbed the second multimeter and stuck them in the outlets i set the multimeter to alternating current and lets see what it does. When i press press, the button all seems to work as intended. If you are thinking of making something like this yourself, please keep in mind that you are working with mains voltage and could possibly be fatal and always disconnect the breakers.