SMART INTERNET SWITCH

by hansiart in Circuits > Arduino

581 Views, 0 Favorites, 0 Comments

SMART INTERNET SWITCH

socket.jpg
connectsonoff gem
ipswitch_inbouw2.jpg

With only a few components you can build this very intelligent internet switch.

It may be not the first but it is the smartest !! The problem with these devices is always the complexity to connect it to wifi. This one is really simple to connect, even by a noob.

Watch the video to see how simple it is...

Some of the features this switch has:

  • a very nice and intuitive web interface, also suitable for a phone
  • it has 4 timers so you can easy setup switching schedules
  • You can switch relative to sunset or sunrise
  • All kind of information available on the webinterface
  • works together with google home (via IFTTT)
  • software can be updated "over the air".
  • it does'nt have a relay that can wear down
  • It can be configured as wifi range extender (repeater)

Because the simple operation of this switch, it could be a nice birthday present.

The wifi range extender is also very handy. If you have guests, they can connect to the repeater AP. This way, the wifi credentials of your router stay secure.

This switch has different flavours. Say you want to switch 12Volt DC to drive a few leds. With only a small adaption this can be realized too. Or just buy a sonoff, flash it with the relevant software and you will have a very versatile switch that can be applied in all kinds of situations.

Supplies

  • a 3.3Volt dc power supply (ebay)
  • an ESP8266-01
  • an LED and 3 resistors
  • an optocoupler moc3041
  • a triac BTA16 400B or BTA10
  • a piece of stripboard
  • a tactile button or a ttp223b touch pad

All together is should cost around 5 or 6 dollars

Soldering

ipswitch.jpg
pcb.jpg
touch.jpg
inbouw.jpg

You start with soldering the components on a piece of stripboard. The capacitors between te power supply and the ESP can be skipped, just preserve some place for them in case you need them. You can use a touch sensor instead of the button, supply it with 3.3 Volt and the datapin on pin2 of the ESP. When you are going to build it in a socket, this is preferrable.

The layout can be something like you can see on the photo. By keeping the board very compact, you can build it in an old wall socket.

Don't get confused by the photos and one of the scheme's, some show an old version with a 5Volt dc supply and a regulator. When you have a 3.3Volt supply you can skip the regulator. If you want, you can solder a fuse of say 10 Amp on the board. The triac is rated 16 Amp but i would'nt try that without cooling.

The value of the resistor in series with the led you have to calculate yourself, depending on the color of the led.

When ready, you have to flash the software on the esp. Google on how to do that.

The software is in two languages:

English language version: download ESP01-TRIAC-v3_2_UK.bin

Dutch language version: download ESP01-TRIAC-v3_2_NL.bin

Dutch language version: Download ESP01-SOCKET-V7-REPEATER

DC SUPPLY SWITCH

schematic1.jpg
outdoor.jpg

A varion of the project is a switchable dc powersupply. You can build it with the voltage you need. The scheme is a 12 volt supply that i made for some power leds.

By using a touch pad instead of the pushbutton, i was able to build it in a waterproof enclosure to switch leds in the garden. This leds come on 10 minutes after sunset, when it is getting dark.

Here you can download the English version of the software: download ESP01-FET-v3_2.bin

SONOFF

peripherals8285.jpg
sensors.jpg

If you, like me, are interested in domotica but don't like to solder too much, there is another possibility.

Buy a sonoff. This will cost you less than 5 dollars. You only have to solder a header to it and you can flash it. Now you have a very multi functional switch that can also be used as a:

  • thermostate
  • hygrostate
  • motion sensor
  • pressure sensor
  • light sensor
  • touch sensor
  • rain sensor

In short any sensor that has a digital output can be connected.

The switch can output sensor values via a http message to a user defined address, e.g. domoticz

THE SOFTWARE

The important part of this project is the software. I developped it with the following in mind:

  • it should be easy to connect to the wifi network
  • operation has to be simple and intuitive
  • automatic switching with easy to configure timers
  • manual operation should be possible
  • OTA software replacement should be enabled
  • the witch has to be secured with a password

The switch, when connected to wifi, retreves the time from the internet. When supplied with the geographical position it calculates sunrise and sunset. Now you can configure it to switch on at say 15 minutes after sunset and switch off 18 minutes before Sunrise. You have 4 timers so a rather complex switching scenario can be configured.

The swich must be secured, this can be done at two levels. You can log-in as administrator, with the permission to edit the settings and set a userpassword.

Provide the user password to your housemates. When the as user, they don't have permissions to the settings. They can only operate the timers.