IoT Wall Outlet With Arduino and ESP8266

34,169

244

54

Introduction: IoT Wall Outlet With Arduino and ESP8266

In this instructable, I show you how to add enhanced accessibility, intelligence and connectivity to an ordinary wall outlet. This is done with a combination of microcontrollers, Arduino, various sensors, ESP8266 and a mix of software packages. As I have designed this project in a sort of a modular fashion, you can try to build the whole project as it is or parts of it or even extend this project with more functionality.

Features

Light On/Off

Fan On/Off

Fan Speed Regulator

IR Remote Control

Touchscreen Display

Smartphone App

Twitter Alerts

SMS Alerts

Mood Lighting

Log to Cloud Platforms

Smart Algorithms

This is the second instructable in the series of IoT related instructables that I am writing on automating my house.

The first instructable is:

An inexpensive IoT enabler using ESP8266

https://www.instructables.com/id/An-inexpensive-IoT...

Step 1: Design Considerations

This project was conceived when I felt the need to automatically reduce the speed of an AC ceiling fan in the bedroom as temperature drops through the night. In Bangalore, where I live, during winters, I like to switch on the fan when I go to sleep. But early mornings, when the temperature drops, the fan makes it even colder. Which disturbs my sleep and I don't want to or cant get up to reduce the speed or switch off the fan since the wall socket is not close to the bed. So I needed a way to automatically shutoff the fan or reduce its speed in the mornings and thought of building one myself since there aren't any commercial products already available in the market. I know, I know, there are bigger problems to solve in this world, but I guess this problem needs solving too, so what the heck :)

Along with this initial requirement, the following were also considered while designing the project.

  • Should automatically reduce the speed of the fan based on the time elapsed or temperature drop.
  • Should still be able to operate physical switches.
  • Should be able to remotely control light and fan. IR remote is a necessity. Smartphone app is perhaps an indulgence.
  • Should be able to function independently.
  • If the board breaks down for any reason, before it can be fixed or properly uninstalled, it should still be possible to use the physical switches to operate the light and the fan without any changes.
  • Need to be able to switch off the board, when the house is going to be empty for extended periods of time (say vacation), but when switched on again, should again function properly without needing any manual intervention.
  • The board should update the state of the devices controlled properly irrespective of the mode of control - IR remote, smartphone app or physical switches.
  • Should not look too ugly or messy.

Step 2: Basics

What is an Arduino?

Arduino is an open-source electronic prototyping platform to create interactive electronic objects.

http://www.arduino.cc/

What is ATMEGA1284P-PU?

This is the microcontroller IC used in this project.

http://www.atmel.com/devices/ATMEGA1284P.aspx

What is ESP8266?

ESP8266 is a highly integrated chip designed for the needs of a new connected world. It offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.

https://espressif.com/en/products/esp8266/

http://mcuoneclipse.com/2014/10/15/cheap-and-simpl...

https://scargill.wordpress.com/?s=esp8266

What is MQTT?

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. For example, it has been used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios.

http://mqtt.org/

http://en.wikipedia.org/wiki/MQTT

What is node-red?

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.

http://nodered.org/

What is NetIO?

NetIO is a multi platform smartphone application, a generic remote controller for almost everything. It simply sends and reads strings over a network socket. You can easily communicate with microcontrollers or PCs connected to your LAN!

http://netio.davideickhoff.de/en/

What is Thingspeak?

ThingSpeak is an open source “Internet of Things” application and API to store and retrieve data from things using HTTP over the Internet or via a Local Area Network. With ThingSpeak, you can create sensor logging applications, location tracking applications, and a social network of things with status updates.

https://thingspeak.com/

Step 3: Proof of Concept

There is hardly any information on the web regarding how to control the speed of an AC fan electronically. One of the links I found, copied below, shows an image of a ceiling fan remote control circuit, but it does not contain an actual circuit diagram. It uses triacs to select the capacitor or combination of capacitors. Based on how much capacitance is in the circuit, the speed of the fan can be varied. For max speed, the input is directly connected to the fan.

http://leoricksimon.blogspot.in/2011/07/troublesho...

Then I bought a regular off-the-shelf fan regulator and took it apart. Found that it also uses capacitors to control the speed of a fan and the principle of operation is similar to the one in the link above.

Now I needed a triac circuit to mimic the turn of the knob on the off-the-shelf fan regulator. Found this link that talks about a simple way to turn on/off AC appliances using triacs:

https://www.instructables.com/id/Small-Triac-Switch...

Based on the above details, created a circuit that uses MOC3041 optocouplers to trigger BT136 triacs. Salvaged the capacitors from the off-the-shelf regulator and used them in this circuit. Based on which triacs are triggered, the amount of capacitance in the circuit can be varied thereby controlling the speed of the fan. In this proof of concept, I just added a IR receiver and a LM35 temperature sensor. It worked well. But there is no IoT connectivity and it was not ready for proper installation.

Please note that this is the first proof of concept board that I made. The rest of this instructable does not contain information about this, rather, it contains the details of the prototype that I made that also has IoT connectivity as well as many other features.

Step 4: Parts

ATMEGA1284P-PU microcontroller chip

ESP8266 ESP-01 module

ILI9341 TFT Touch SPI LCD screen

0.96" OLED i2c LCD screen

DHT11 or DHT22 sensor

5v relays

WS2812B LED strip

IR receiver

Active buzzer

BTA136 triacs

MOC3041 triacs

4N25 zero cross detectors

Bridge rectifier

DIP switches

Resistors

Capacitors

Breakaway male and female headers

PCBs

Enclosures

220v AC to 5v DC 2 Amps power supply module

Current transformer

LM1117 3.3v LDO voltage regulator

FTDI USB to TTL adapter cable

In addition to the above, another Arduino board (any model should be fine) is needed to install the bootloader on the ATMEGA1284P chip.

Step 5: Circuit

The circuit is split into two major parts:

1. First is the main microcontroller circuit. Only DC here.

2. Second is for all the AC components. Mix of AC and DC here.

This is a combination of various circuits I have found on the web. The only part of the circuit that I had to struggle with, as explained earlier, is the one for controlling the speed of a AC fan. Although I found a few variations of this circuit, I did not get a proper schematic. Hence, this part of the circuit needs a little explanation.

The basic idea is that the speed of the AC fan can be varied by using 250v AC capacitors in parallel. Depending on how much capacitance is in the circuit, the speed of the fan could be increased. Actually, it is the impedance or the capacitive reactance or some such thing that actually does the trick, but since I have little knowledge about that, I will refrain from even making an attempt to explain it here. In my circuit, you can notice that there are four MOC3041/BTA136 triacs. Each of the first three triacs is connected to capacitors of 1uF, 2uF and 3uF capacitors and then to the fan. The last is directly connected to the fan.

With this circuit, its possible to have 7 different speeds by triggering the triacs as needed.

  • Speed 0: None of the MOC3041 triacs are triggered.
  • Speed 1: Only the MOC3041 connected to 1uF is triggered.
  • Speed 2: Only the MOC3041 connected to 2uF is triggered.
  • Speed 3: Only the MOC3041 connected to 3uF is triggered.
  • Speed 4: MOC3041s connected to 1uF and 3uF are triggered.
  • Speed 5: MOC3041s connected to 2uF and 3uF are triggered.
  • Speed 6: MOC3041s connected to 1uF, 2uF and 3uF are triggered.
  • Speed 7: Only the MOC3041 directly connected to the fan is triggered.

Another thing about this circuit are the two zero cross detectors - one for the light and the the other for the fan. These are needed to check if the light or fan is actually switched on or off. Note that there are two physical 2-way switches on the wall socket that can still be used. When the state of the light or the fan is changed by/through the infrared remote or the smartphone app or the physical switches, it is the the zero cross detector circuits that actually detects whether the light or the fan is actually in the on or the off state.

The Kicad files of the circuits are available at https://github.com/tangophi/iot_wall_socket/tree/m...

Step 6: Wiring

Original Wiring

There was a 2-way switch for the light on this board as well as a 2-way switch on another wall socket near the door. The fan had only a 1-way switch and a fan speed regulator.

New Wiring

In the new scheme, the 2-way switch for the light near the door has been retained as it was. But the other 2-way switch for the light has been moved for fan's use. And the 1-way switch that was previously used for the fan is now used to control power to the IoT board.

Step 7: Code

The Arduino sketch for the ATMEGA1284P microcontroller and the source code for the firmware of the ESP8266 module is available at

https://github.com/tangophi/iot_wall_socket

The node-red code is available at

https://github.com/tangophi/iot_house

In addition to the above, the NetIO based smarphone app also needs to be build. But not sure how to share that code here. It is pretty easy to build the app. See the section on the smartphone app for more details.

Step 8: DIP Switch Settings

There are three DIP switches on the board. These need to be set correctly for various modes of operation:

Normal Operation

SW1: 1100

SW2: 1100

SW3: 01

Uploading sketch to Arduino

SW1: 0011

SW2: 0000

SW3: 01

Uploading firmware to ESP8266

SW1: 0000

SW2: 0011

SW3: 10

Step 9: Flashing the Firmware

Make sure the DIP switches are set properly and use Arduino IDE to upload the sketch to the ATMEGA1284p. And use ESP8266 SDK to flash the firmware to the ESP8266 module.

Instructions for both of these are available widely on the net and hence have not included them here.

Step 10: Node-red

node-red running on a Raspberry Pi acts as a coordinator and manages various IoT boards in the house. It does this by getting/sending MQTT messages from/to various boards as well as socket messages from a NetIO based smartphone app. It also acts as an interface to send data to thingspeak.com and to send tweet alerts.

The node-red flow in the repo contains nodes related to the IoT wall socket as well as nodes of other projects. The IoT wall socket related entities are labeled as socket1 in the node-red flow.

If a Raspberry Pi is not available to run node-red, a cloud platform such as IBM Bluemix can be used to host node-red. One advantage of using a cloud platform is that the IoT boards can be controlled from anywhere in the world easily.

Step 11: Smartphone App

The smartphone app is built using the NetIO Design Editor at http://netio.davideickhoff.de/editor

Once the app is designed, the NetIO app should be downloaded to your smartphone. Note that this is a paid app, but it does not cost much.

Whenever a button/switch/slider is pressed in the app, it will send a message through sockets to the Rpi box that is running node-red. The node-red application will process the messages and then send MQTT messages to the wall socket board.

For the smartphone app to work it should be in the same network as the IoT wall socket board.

It is possible to use the smartphone app from outside the local network. If the ISP allows incoming connections, it is just a simple matter of forwarding the socket port on the router. If the ISP does not allow incoming connections, then VPN can be used as a workaround.

Step 12: How It Works

This diagram shows a high level overview of this project.

Infrared remote

When the infrared remote is used, the IR signals generated by it are detected by the IR receiver in the board. And depending on the command, relays are either turned on or off to switch on/off the light or the fan. Also, various triacs are triggered to set the speed of the fan.

Smartphone app

The NetIo based app talks to node-red on the Raspberry Pi through sockets. Based on the command sent by the app, node-red triggers MQTT messages. Which are processed by the broker and sent to the ESP8266 module. Which in turn send the command through the serial port to the Arduino as json formatted strings.

Data logging

Data such as temperature, humidity and light/fan states are sent by the Arduino to the ESP8266 module as json strings. The ESP8266 modules makes MQTT messages out of this data and sends them to node-red via the broker. For temperature and humidity readings, node-red collates them and sends one set of readings per a predetermined interval to thingspeak.com via http.

Twitter Alerts

When the security alarm goes off, node-red sends an alert to Twitter and the account holder as well as all those who are following him will get a tweet.

SMS Alerts

If SMS notifications is enabled in Twitter account settings, then whenever a alert is sent, a SMS alert is also sent to the registered mobile number.

Step 13: Operations

The board can be operated in any of the following ways. Some functionality that is available in one method may not be available in others.

1. Touch screen operation

  • The light or the fan can be switched on/off just by touching the relevant image on the screen.
  • The speed of the fan can be increased or decreased by touching the Fast or Slow images.
  • Time alarm can be set by pressing the clock display on the screen for more than 2 seconds.
  • Light and Fan options can be accessed by pressing the relevant image for more than 2 seconds.
  • Security alarm can be activated by pressing the Alarm logo for more than 2 seconds.
  • Led strip can be switched on/off by pressing the LED logo. But its mode cannot be changed.
  • Debug messages can be enabled by pressing the bottom edge of the screen for more than 2 seconds.

2. IR Remote Control

  • Light/Fan/Led canbe switched on/off by pressing the relevant key.
  • Fan speed can be set directly by pressing keys 1 to 7 or by pressing the increase or decrease keys.
  • LED mode can be changed.
  • Big clock display can be activated.
  • Needs line of sight to work - similar to how normal TV remote works.

3. Smartphone App

  • Light/Fan/Led canbe switched on/off by sliding the relevant switches
  • Fan speed can be set directly by using the slider.
  • LED mode can be changed.
  • LED color can be set
  • Can be used from anywhere in the network or even from outside the network - possibly from anywhere in the world.

4. Physical switches

  • Light and Fan can be switched on/off using the 2-way switches in the wall socket.
  • The board itself can be switched off using the switch on the wall socket.
  • If the board is switched off, the physical fan regulator can be used to change the fan speed.
  • If the board is switched on, the physical fan regulator should be set to max speed. The actual fan speed will be controlled by the board.

Step 14: Monitoring

The board logs temperature, humidity and power consumption readings once every 10 minutes to thingspeak.com. It also logs state of the light and the state and speed of the fan whenever they are changed.

https://thingspeak.com/channels/32932

Presently only Thingspeak.com is configured. If needed, nodes for other cloud services can also be added.

The following links have information on how to add nodes for various IoT cloud services:

http://logic.sysbiol.cam.ac.uk/?p=1473
http://logic.sysbiol.cam.ac.uk/teaching/Node-RED_...

Step 15: Smart Algorithms

1. Automatic Fan Speed Control

Various options to set the fan speed are available

  • Decrease fan speed by 1 step for every 1 degree drop in temperature.
  • Decrease fan speed by 2 steps for every 1 degree drop in temperature.
  • Decrease fan speed by 1 step every 90 minutes.
  • Decrease fan speed by 2 steps every 90 minutes.
  • Stop fan if temperature falls below the specified temperature.

2. Time alarm options

When the clock arm goes off, along with the buzzer, the following options can be set.

  • Switch on light.
  • Switch off fan.
  • Switch on fan and set it to maximum speed.

3. Automatic full screen clock display

During nights (when the fan is switched on and the light is switched off), if a movement is detected after 10 minutes of idleness, show the current time in full screen so that it is visible clearly from the bed.

Step 16: Security Alarm

The PIR motion detector can be used as a security alarm. The alarm can be "armed" when going out. And when the alarm is armed, and if motion is detected, the screen will show a keypad so that the security code can be entered. If the correct security code is entered within a minuted then the alarm is disarmed. But if the correct code is not entered within a minute, a tweet is sent along with activating the buzzer.

Also, a SMS message will be sent to the mobile number associated with the twitter account. This is achieved by enabling SMS notifications in Twitter account settings.

Step 17: Clock/Alarm

There is no RTC module on the board to provide current time. Instead, an event is triggered every minute that will send the current timestamp as a MQTT message to the board. And we extract the required info from the timestamp and use it to update time.

Features

  • Normally the clock is displayed in small font at the top right of the display. But to see the time from a distance, a key can be pressed on the IR remote to show just the current time in big font.
  • A clock alarm with options like switch on/off fan/light when it goes off can be configured by long press of the time window.
  • At nights, when the fan is on and the light is off, if movement is detected after an 10 minutes without detecting motion, the board will automatically display the clock in big font. So that it is readable from the bed.

Step 18: Mood Lighting

There is a strip of WS282b LEDS around the enclosure. These can be turned on to create various colors or patterns.

This mood lighting can be controlled through the following means:

1. Smartphone app can be used to turn on/off the LEDs, change pattern as well as changing the color.

2. IR remote can be used to turn on/off the LEDs and change the pattern.

3. Touchscreen can be used to just turn on/off the LEDS.

Step 19: Issues

Most of the functionality works fine. There are a couple of issues however:

1. A couple of BTA136 triacs used in this project have gone bad twice over the last couple of months. I replaced just those triacs and everything seems to be fine. However, I have not been able to determine what exactly caused these triacs to short out or if there is something inherently wrong with my circuit.

2. Power Consumption readings are mostly wrong. I guess there is too much noise in the circuit, since there are three relays and no opto-isolation for them. Guess the current transformer circuit needs to be isolated to prevent noise from other parts of the circuit interfering with the readings.

3. The PIR motion sensor is sometimes erratic. Even when there is no-one in the room, it detects motion. Probably due to the fact that its next to the window and the window shades. Tried tuning the sensor, but so far no luck.

Any help/suggestions on the above would be highly appreciated.

Step 20: Future Ideas

This is the second IoT project that I have done. The first one is a simple ESP8266 board with a relay and a temperature sensor. Details of the first project are available at

https://www.instructables.com/id/An-inexpensive-IoT...

I have also created a mood lighting project for my living room. Also modified two power strips by combining them with Arduino/ESP8266 and relays so that individual outlets can be remotely switched on or off. Photos of these two projects are included here. I will write instructables for them in the near future.

Further, I am also planning to automate the main wall socket in the living room similar to how i have done in this instructable for the bed room. In addition to all the existing features, I am going to add a IR transmitters as well more environmental sensors to that project. Later on, probably add some flame/gas sensors in the kitchen.

When all the hardware components are in place, several new algorithms/functionalities can be added. Such as:

1. At night, when the fan is switched on and the light is switched off in the bed room (meaning you are going to sleep), all appliances in other rooms should be automatically switched off.

2. When the security alarm is activated (when you are leaving the house), switch off all the appliances. Also, when the security alarm is deactivated (when you come back), turn on the appliances which normally would be turned on (bit of machine learning here).

3. Monitor sleep pattern by analyzing the data logged to the cloud. For example the time between the fan switched on in the night and it being switched off in the morning can be roughly counted as the sleep time.

4. Appliances like TV, cable, sound system and media player all need their own remote control (mostly IR based) and its cumbersome to deal with them. Instead write a smartphone app and map the keys of all the remotes by reading the code emitted by them. Then when a button is pressed in the app, it will send a message to the IR transmitter in the Arduino board to send the relevant code as IR signals to the appliances. One app to rule them all :)

5. Include footage from a security camera inside the house when sending intruder alarm alerts instead of just a plain text message.

Step 21: Conclusion

If you find this instructable useful in implementing any of your projects, it would be great if you could post some details as well as photos of them as comments.

If you have any questions/doubts, please kindly post them as a comments instead of sending a mail to my inbox. If its posted as a comment, it will be useful to all and I can reply as a comment as well.

Suggestions to improve this project as well as ideas for new features/functionalities are always welcome.

Cheers!

Soldering Challenge

Participated in the
Soldering Challenge

Be the First to Share

    Recommendations

    • For the Home Contest

      For the Home Contest
    • Make It Bridge

      Make It Bridge
    • Big and Small Contest

      Big and Small Contest

    54 Comments

    0
    Mavin_
    Mavin_

    6 years ago

    Hi gopinath. I would like to include a circuit breaker so if a certain
    current is exceeded, it breaks. Any ideas on how to include this?

    0
    gopinath.marappan
    gopinath.marappan

    Reply 6 years ago

    I am not an expert with electrical installations. But from what I understand, at a basic level, a circuit breaker works like a switch. That is if there is a short in the circuit, the circuit breaker will "break" the circuit just like an ordinary fuse does.

    If thats the case, the circuit breaker should be installed on the "lines" wire before your 'project'. Hence if something goes wrong, then the circuit breaker can handle it.

    But I would recommend you to talk to an expert in this field and review other online materials before you install a circuit breaker. Working with mains AC could be quite dangerous and unforgiving. And hence all precautions should be taken before you attempt to do it. If you are unsure about anything, I would strongly suggest you not to do it.

    0
    AshutoshB1
    AshutoshB1

    7 years ago

    Hello,

    I fail to understand how you detect whether the light is presently on or off using a zero-crossing detection? Can you please elaborate the idea?

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago

    There is a relay and a physical two way switch combination, one for the light and the other for the fan.

    If we just use the relay to turn the light or fan on/off, we can be sure which state it is in. But if we also use the physical two way switch, then we cannot be sure. Because the relay may be turned ON, but the 2-way switch may be off. You really need to understand how 2-way switches work to understand this.

    Anyway, that is the reason at the output of the relay/2-way switch, i use a zero cross detector to detect if current is actually flowing to the light or the fan. If it is, then it means the light or the fan is in a ON condition.

    0
    skmani
    skmani

    7 years ago

    hello can u share a clear circuit diagram i really wanted to implement it so i can clealry see the values and labels it would be kind of u sir

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago

    Which part of the circuit is not clear? When I posted this instructable, I had tried to get a circuit diagram which is readable. And I thought I had done that.

    I am not sure how else I can improve it...

    0
    skmani
    skmani

    Reply 7 years ago

    humm ok brother .just cant see the resistor valeus tats y i asked any ways amazing work u hve done

    0
    SanjeevS11
    SanjeevS11

    7 years ago

    Hello Experts,

    I have started working on ESP8266 and right now trying to run blink example using Ardunio IDE but we
    have been struggling to execute application on ESP8266 and
    our esp8266-01 is resetting again & again with watchdog reset error
    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld
    Setup don start

    We have been using below schematic for the connection and here is the part number.

    ESP8266 01 wifi transceiver

    D-SUN "USB to TTL" (Blue)

    Please advice how to proceed further.

    On another ESP8266-01 I don't see output of AT command too .

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago

    I have never tried Arduino IDE way of programming ESP8266. I prefer the SDK method instead and thats the method I used in this instructable.

    There are several Facebook groups, (ESP8266 for example) on which you can post this query. someone who has tried Arduino IDE may be able to help you out.

    0
    diy_bloke
    diy_bloke

    7 years ago on Introduction

    looks great.
    I have the feeling that an ESP8266 and an arduino Mega and a raspberry might be a bit much just tto switch a light and afan, but I am sure there is more to come :-)

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago on Introduction

    Thanks!

    I agree that a Mega, ESP8266 and a Rpi is a bit too much to control just a light and a fan. I had initially started off with just an Arduino Pro Mini and a simple 7 segment display. Then I added a LCD screen. The project worked as expected.

    But then I thought why not bling it up :)... Added a touch screen LCD, but found out that there is not enought flash memory available to support the display/touchscreen code as well do something useful .. hence moved to ATMEGA1284P... then added the ESP8266 module for connectivity.. And when i was exploring the easiest smartphone app to control this, i stumbled onto NetIO and node-red... Which needed a Rpi... The Rpi used in this project was already running as a file server, so didn't have to buy one exclusively for this...

    I admit that I dont have a grand plan of things, just building various projects such as this one by one... And I hope the amalgamation of all of them might eventually will lead to something useful and unique..

    Anyway, one of your instructables has been very helpful in designing the Fan speed control circuit and I have mentioned it in Step 3: proof of concept. In your instructable, you have used TIC206 triac. Since those triacs are not easily available here, I used BTA136 triac. And as mentioned in your instructable, I adjusted the resistor values accordingly.

    Now the thing is, the circuit works fine as expected. But every few weeks or so, one or two of these triacs (please kindly see the circuit I have used in step 5) goes bad. That is, they become shorted and those triacs are always "ON", does not matter whether it is triggered or not. I replaced just those triacs and everything works fine. But after a few weeks, one or two again goes bad and i have to replace them again. This has already happened 3 or 4 times.

    My knowledge in this area is very limited and I hope you can provide me some insights in resolving this issue. Hence, I would really appreciate if you could help me with the following:

    1. Are heat sinks necessary for BTA136, if it is used in a ceiling fan circuit? I think the current would not be that much given that this is a 220v circuit and the wattage of the fan is around 70-80 watts only. I have not really seen the triacs getting hot (or even warm for that matter), so i am not sure.

    2. Are the resistor values used in the circuit, especially around the MOC3041 and BTA136 acceptable? I couldn't get the exact resistors, so have to make do with resistors that are near to the ones that you have recommended in your instructable.

    3. I have just one common snubber for all the four triacs? Is this okay or should i need to have a common snubber for each one of them?

    4. Can a BTA16, instead of BTA136, alleviate these issues?

    5. I think BTA16 is scrubberless? If I use them, should i have to remove the scrubber from my circuit?

    Thanks

    Gopi

    0
    diy_bloke
    diy_bloke

    Reply 7 years ago on Introduction

    BTA136 can handle 4 amps. That should be ample for an 80 watt fan and it seems they should be able to handle that without getting hot. Yet a heatsink is always a good idea.
    Your Triacs really shouldnt continue to blow. sadly though I have no idea how yoouy control your fan speed as I didnt see any circuit in yr ibble that shows that, other than a block diagram that doesnt tell me anything. From yr link, at best I understood you are using the triacs to short out capacitors.

    with regard to the transistor values, i might have missed something in your ibble, but I cant really see what values you are using

    If you have one common snubber for all triacs, I presume you have a snubber not for the triacs but for your motor.
    I doubt if BTA16 would alleviate all yr problems as long as it is unclear what is causing your problem.

    Could you perhaps expand a bit on how you regulate your fan? a citrcuit would be nice. If I overlooked it in your ibble can you please direct me to it. Same goes for the 'resistors around the MOC3041 and BTA'

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago on Introduction

    Thanks for your response.

    The detailed circuit diagram of the circuit is available in step 5 - there are two circuit diagrams here - one for the uc and its sensors and the other is for the relays and the fan speed control circuit.

    Have also attached here for your reference. The basic idea is to use capacitors of various values in parallel. And depending on which of these capacitors are actually triggered (using triac), the speed of the fan can be controlled. something to do with capactive reactance or impedance or some thing like that.

    wall_socket.jpg
    0
    diy_bloke
    diy_bloke

    Reply 7 years ago on Introduction

    I think it is not really necessary to have two zero detection circuits.

    also,
    you have the RC networks in series with the TRIAC. I am not sure if
    that will work. Fans are notoriously difficult for triacs, but it can be
    done. However, with an TC network in series I really do not know what
    the behaviour is.

    Also, apart from the fact that you do not need
    two zero detection circuits... why would you do zero detection at all
    for the fan? You are using the MOC3041. that has zero detection built
    in, so you are just making it difficult on yourself.

    You only
    need to use your own zero detection if you want to dim a certain device
    like an incandescent lamp. You just want to switch a TRIAC on or OFF so
    you only need to write a 1 or a 0 to the entrance of yr circuit.
    I
    see you have an LED in series with your MOC3041. I had that in my
    original design, and it works, but there is a chance for problems if u use a non red led.
    The voltage drop over the LED might be too big then.

    Also,
    I get the distinct impression your circuit is not correct. I can't see
    the TRIACS being fully in serial with anything, sure, they are
    connected to the RC newtwork and that goes to the bridge rectifier, but
    that's it

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago on Introduction

    The zero cross detection circuits are not meant for dimming or even turning on/off the light or the fan.

    The sole purpose of the two zero detection circuits (one for light and the other for fan) is to know if either the light or the fan are actually on or off. There are various ways to turn on/off the light or the fan. There are relays that are used along with the physical switches. So for example, if the light is turned on using the IR remote, the light relay is toggled on. But now, if the light is turned off using the physical switch on the wall outlet, I needed a way for the uc to update the state of the light. This is where the zero cross detectors come on. The state of the light or the fan inside the uc is solely based on the output of the zero cross detectors.

    Anyway, again one of the BTA136 has gone bad. will try to see if I can get a BTA16 and use it instead. If that does not solve the issue in the long term, then I need to think of using more relays (maybe even SSR) to trigger the capacitors to change the speed of the fan.

    I had actually drawn the circuit diagram much later after I had actually made the circuit, so it may not be 100% accurate.

    Just to be clear, the MOC3041 are used only the fan speed control circuit. Depending on which of them are triggered, the corresponding TRIACs are triggered and this will add/remove capacitance (in parallel) in the line going to the fan. Thereby the speed of the fan can be varied.

    There are also 3 relays. One works in tandem with a physical 2-way switch on the wall outlet to toggle on/off the light. Similarly the second relay works in tandem with a physical 2-way switch on the wall outlet for the fan. The third relay is to enable the fan speed control circuit.

    0
    u_ashish
    u_ashish

    Reply 7 years ago

    Thanx for sharing the Idea.Good Work.
    What is the final solution that you came up with for problem with BT136?
    -Replace
    with BTA16 ? OR snubber for each Triac (as when you trigger multiple
    MOC3041s in your circuit only a single snubber shields for all the
    Triacs which may be inadequate)? OR anything else.

    0
    gopinath.marappan
    gopinath.marappan

    Reply 7 years ago

    A couple of months back, two of the BTA136 triacs shorted out. I replaced them with BTA16 and they have been fine. So I think BTA16 is probably the one we need to use here, with everything else in the circuit being the same.

    Btw, are you planning to make something similar?

    0
    u_ashish
    u_ashish

    Reply 7 years ago

    Thank you so much for such a quick response.I will go with BTA16.

    I am planning something which will require a number of parts of this project.

    0
    diy_bloke
    diy_bloke

    Reply 7 years ago on Introduction

    I see. Obviously quite an intricate circuit. I hope the BTA16 will settle your problems