Author Topic: ESP8266 mains sensor switch project  (Read 2347 times)

0 Members and 1 Guest are viewing this topic.

Offline HixfieldTopic starter

  • Contributor
  • Posts: 21
  • Country: be
ESP8266 mains sensor switch project
« on: February 27, 2017, 06:57:47 am »
Attached my schematic (and prototype picture) for my ESP8266 mains sensor switch project.

Any feedback /  help is appreciated.

What is does?

- Its a mains switch operated via WIFI based on the ESP8266
- It contains a digital temp sensor (DS18B20)
- It contains a PIR movement sensor
- It has a beeper
- It has a simple button that can be pressed that also contains a led for status indication

So basically it can be configured as a WIFI enabled thermostat with manual button and movement activation for example.

Maybe some questions / ideas :

1. Do I need a big cap e.g. 330 uF to stabilise the power supply? I read many things regarding spontaneous resets of the ESP... If I look at the datasheet of my LM3940 it says that tantalum 47 uF in input and output is enough...?
2. Do I need some kind of noice suppression (capacitor) on the mains input for the noise coming from the HiLink HLK-PM01 PUS ?
3. Is it a good idea to include the varistor and fuse on the input such as I did?
4. I am thinking of maybe also exporting all other unused pins of the ESP to some external header. But I do not have much room anymore in the casing. What would be the best option for this?
5. Should I include pull-up/down on any unused inputs of the ESP?
6. The attached picture is for europeans style plug. If I would want to make this a world-wide project I would need some case that can be ordered for all types of mains plugs (but with same internal structure/size/holes so I can use same PCB for all of them (PSU is universally supporting 110-240). After searching for 4 hours on the web, I could not find anything. Does anybody have any good reference for such a case?
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 2028
  • Country: au
Re: ESP8266 mains sensor switch project
« Reply #1 on: February 27, 2017, 08:16:49 am »
pin1 of jp2 should probably connect to ac2 of the power supply and MOV instead of pin2 of jp2.  Otherwise it wont turn on at all.
Should put fuse and relay contact both on the Active mains input.
IEC C13 and C14 would suit this IMO.
You are probably not allowed to sell into many countries without getting certification/approval.
C3 maybe 100nF.
(Always good to sprinkle 100nF everywhere in electronics.  ;) )

I think MOV is ok done like that.
Noise suppression depends on local rules, also psu manufacturer probably gives guidance on this.
I don't think you would want a big cap like that.

 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2587
  • Country: fr
    • kripton2035 schematics repository
Re: ESP8266 mains sensor switch project
« Reply #2 on: February 27, 2017, 08:31:19 am »
what about hacking a Sonoff device ?
https://www.itead.cc/sonoff-wifi-wireless-switch.html
 

Offline HixfieldTopic starter

  • Contributor
  • Posts: 21
  • Country: be
Re: ESP8266 mains sensor switch project
« Reply #3 on: February 27, 2017, 08:32:15 am »
Thx for feedback!

pin1 of jp2 should probably connect to ac2 of the power supply and MOV instead of pin2 of jp2.  Otherwise it wont turn on at all.
sorry for not explaining good enough, but the PSU is always on. The relay just switches the mains device plugged into the output (mains) socket.
So this should be ok

Should put fuse and relay contact both on the Active mains input.
I don't want to fuse the mains socket output, just the PSU (remember the PSU is always on, see answer above).

IEC C13 and C14 would suit this IMO.
Do you mean C1 and C2?

You are probably not allowed to sell into many countries without getting certification/approval.
I would sell it as a DIY kit, I guess this changes the rules and I don't need certifications...?

C3 maybe 100nF.
(Always good to sprinkle 100nF everywhere in electronics.  ;) )
increased to 100 nF

I think MOV is ok done like that.
OK

Noise suppression depends on local rules, also psu manufacturer probably gives guidance on this.
the psu supplier is vague, but I found some review here : https://skippy.org.uk/quick-look-at-the-hlk-pm01/

I don't think you would want a big cap like that.

looking at http://internetofhomethings.com/homethings/?p=396 I think I will include a 470 uF cap.
Think its a good idea, better safe then sorry?
 

Offline HixfieldTopic starter

  • Contributor
  • Posts: 21
  • Country: be
Re: ESP8266 mains sensor switch project
« Reply #4 on: February 27, 2017, 08:35:03 am »
@kripton2035 yes i have seen those Sonoff devices, but hey... I just like designing things from scratch :)
And I want a finished product with the right mains plugs and case and stuff :)
I will design a PCB for this too... there is always some thing that comes close to what one wants to do, but well I just like inventing and designing things from the ground up
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: ESP8266 mains sensor switch project
« Reply #5 on: February 27, 2017, 09:23:22 am »
You appear to be thinking of how it will work. So far so good.

But when you are dealing with mains voltages and low impedance supplies, you also have to consider safety and how it will fail. Which components can fail, how can they fail, and what will happen to equipment and people when they do fail?
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline HixfieldTopic starter

  • Contributor
  • Posts: 21
  • Country: be
Re: ESP8266 mains sensor switch project
« Reply #6 on: February 27, 2017, 09:36:35 am »
Well I included a fuse at the psu input and a surgeprotection using varistor. I believe that is the same thing that commercial devices do (and sono)?


Sent from my iPhone using Tapatalk
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: ESP8266 mains sensor switch project
« Reply #7 on: February 27, 2017, 09:58:24 am »
Well I included a fuse at the psu input and a surgeprotection using varistor. I believe that is the same thing that commercial devices do (and sono)?

That's necessary, but not sufficient. Start with how can the relay fail, the PCB fail, the varistor fail, the diode bridge fail, the connectors and interconnections fail.

It would be dangerous for me to use this forum to attempt to teach you how to avoid some dangers, since I would only teach you poorly.

Not all commercial devices are designed to appropriate standards. Some simply lie about whether they meet standards; there are videos on this website on that topic.

There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline HixfieldTopic starter

  • Contributor
  • Posts: 21
  • Country: be
Re: ESP8266 mains sensor switch project
« Reply #8 on: February 27, 2017, 10:00:37 am »
I dont understand. Could you give a few concrete examples based on my schematic?


Sent from my iPhone using Tapatalk
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf