Sonoff basic with touch switch problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Sonoff basic with touch switch problem

#1 Post by Genesys » 25 Mar 2017, 22:02

I made a touch wall switch using Sonoff basic and TTP223 (red) touch module on GPIO14 .I used ESPeasy and it also is controlled through openhab via Mqtt . Everything works perfect on the breadboard (connected to pc with ftdi) .

My problem . When i intall it with AC power i have a problem with the manual touch switch turning on and off from noise i guess . It flickers the touch switch on and off turning the light on and off randomly . Its not a wifi issue as its getting a good wifi signal and works from openhab,

I took it apart to play with the touch switch while on and if i hold the wire for the touch switch and can get it to stop flickering and not cause it to turn on /off .I thought maybe the touch switch was too close to the sonoff but if im holding the wire i can put it right up to the sonoff and not be a problem so thats not it. I think its getting noise introduces from the AC power .How do i fix this . Video below of the problem .


https://youtu.be/uHS793vKjGk

This is the touch switch im using which works great on the breadboard. In the video the red light is the light on the touchswitch which lights up when pressed.
TTP223-font-b-Touch-b-font-font-b-Key-b-font-Switch-Module-Touching-Button.jpg
TTP223-font-b-Touch-b-font-font-b-Key-b-font-Switch-Module-Touching-Button.jpg (143.6 KiB) Viewed 18251 times

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff basic with touch switch problem

#2 Post by Shardan » 25 Mar 2017, 22:42

Hello,

without seeing the set in real it's a bit of prophecy but I'll try to help out a bit.

i assume there might be two problems leading to that issue.

The first and most widespread one ist the power supply.

First, if you use cheap "wall plug" power suplies - do yourself a favour and dump them.
The output of some of these is quite noisy, good capacitors obviously are too expensive for cheap china productions.
For myself i use a Wall plug of a somewhat good quality and 5 Volts output at at least 1 Ampere.
To get the 3,3 V voltage for the ESP i use a separate regulator chip, usually a LF-33 type very near to the ESP. Other 3,3V regulators will work too.
Use linear regulators, not the "buck converter" types, they may add additional influences to the touch point.
This way i get a stable power supply even if there is some loss on the thin wires of the power supply.

Second, try to get rid of noise. Put a ceramic type capacitor of 100 ... 220 nF and an electrolytic capacitor of at least 220 µF in parallel to the 3,3V power supply pins of the ESP board.
If you use a bare ESP8266 with your own switch circuit, place another ceramic type 100...220 nF directly to the power pins of the chip, as near as possible.
Last but not least the third ceramic type should be placed directly on the switch breakout board.

The second reason for issues might be some interference from the WiFi or the chip itself influencing the Toiuch board.
It works on the breadboard - what does the ready switch look like? Is the TTP223 near the ESP chip?
I don't know the TTP223, from viewing the picture it looks like a contact or capacitive type. Both might be influenced by the high frequencies from the ESP.
Try just putting some breadboard wires between the TTP223 and the circuit itself to get some distance between the TTP and the ESP.
If that's the reason you might try a grounded metal plate under the touch board - keep some millimeters distance between touchboard and plate.
A pice of raw PCB will do the job.

Even if you put this into a metal case and the case gets very near to the touch point might cause that issue.

So some homework to do ;)

I hope you can find the issue with that.

Regards
Shardan
Regards
Shardan

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#3 Post by Genesys » 25 Mar 2017, 22:54

Its a Sonoff .Its has built in AC supply and esp8266 on one board. Very popular and common product.

https://www.itead.cc/smart-home/sonoff- ... witch.html

It is not the wifi signal i dont think because i can pretty much put the touch switch on top of the esp antenna and it works fine on the bread board. Also using the same wire in testing and finished product. Only thing i can think of is noise .The only thing that changed between testing and finished is connecting it to AC power. I believe the Sonoff has a linear regulator.
sonoff-parts-without-433.jpg
sonoff-parts-without-433.jpg (91.57 KiB) Viewed 18238 times

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff basic with touch switch problem

#4 Post by paxi » 26 Mar 2017, 01:33

I had similar issues with a PIR module in a sonoff, it depends on where the wires run in the housing. I think it's stray EMI from the transformer - a 100nF cap between ground and signal should fix your problem, I just re-routed my wires. ;)

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#5 Post by Genesys » 26 Mar 2017, 03:33

paxi wrote: 26 Mar 2017, 01:33 I had similar issues with a PIR module in a sonoff, it depends on where the wires run in the housing. I think it's stray EMI from the transformer - a 100nF cap between ground and signal should fix your problem, I just re-routed my wires. ;)
Funny you should say that because i am having the same problem with a PIR sensor build turning on / off that im doing with a Wemos D1 , hi-link ac/dc module and Pir module. I will try a cap between the output pin and gnd and see how that works.I should have a .1uf cap laying around

All my ESP8266 builds work great when connected to dc but seems like everyone i power from ac has a noise issue

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#6 Post by Genesys » 26 Mar 2017, 04:08

Looking at the sonoff its using a AMS1117 3.3v regulator and i probed a 15uf cap off the output pin

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#7 Post by Genesys » 26 Mar 2017, 11:20

paxi wrote: 26 Mar 2017, 01:33 I had similar issues with a PIR module in a sonoff, it depends on where the wires run in the housing. I think it's stray EMI from the transformer - a 100nF cap between ground and signal should fix your problem, I just re-routed my wires. ;)
I just added a 100nf cap but its still doing the same thing

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff basic with touch switch problem

#8 Post by Shardan » 26 Mar 2017, 17:49

The Sonoff basic uses both: A switching power supply from mains down to 5V and a linear regulator from 5V to 3.3V

The transformer might produce some EMI as paxi said. This may influence the leads and the touch sensor itself.
I never tested the power suppy of the sonoff for noise or connected external devices.

I'd try a ceramic and an electrolytic capacitor directly at the touch board besides moving the leads to another position.

A direct influence to the sensor might need a shielding as described.
I've ordered some touch sensor samples as i'm interested in a similiar solution.... anyways it will take a while until they arrive.

PIR sensor:
The PIR is known for sensitivy to EMI and noises. You may solder a ceramic capacitor of 220 nF to pins 12 and 13 of the chip as chunter1
described in post #24 in this thread: https://www.letscontrolit.com/forum/vie ... ced#p14292

Regards
Shardan
Last edited by Shardan on 26 Mar 2017, 18:02, edited 1 time in total.
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff basic with touch switch problem

#9 Post by Shardan » 26 Mar 2017, 18:01

Sorry, double post
Regards
Shardan

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#10 Post by Genesys » 27 Mar 2017, 02:15

Shardan wrote: 26 Mar 2017, 17:49 The Sonoff basic uses both: A switching power supply from mains down to 5V and a linear regulator from 5V to 3.3V

The transformer might produce some EMI as paxi said. This may influence the leads and the touch sensor itself.
I never tested the power suppy of the sonoff for noise or connected external devices.

I'd try a ceramic and an electrolytic capacitor directly at the touch board besides moving the leads to another position.

A direct influence to the sensor might need a shielding as described.
I've ordered some touch sensor samples as i'm interested in a similiar solution.... anyways it will take a while until they arrive.

PIR sensor:
The PIR is known for sensitivy to EMI and noises. You may solder a ceramic capacitor of 220 nF to pins 12 and 13 of the chip as chunter1
described in post #24 in this thread: https://www.letscontrolit.com/forum/vie ... ced#p14292

Regards
Shardan
Today i tried a 220uf electrolytic cap right off the touch board between power and gnd and a 100nf ceramic cap right off the touch board between signal and ground but it doesnt seem to do anything to help the problem . If i hold the wires with my fingers it does improve the problem by about half . You can also adjust the sensitivity of the touch boards by changing the on board ceramic cap with values between 0 and 50nf .I tried removing the cap to make it the least sensitive as possible but again still having the issue. Im starting to think a Sonoff and touch sensor is not too compatible.

I do have one other thought . The material i am using for the housing is 3dprinted PLA .This is not supposed to be a conductive material.I searched and cant find anything on it conducting at all however it seems i can take like a 5" pieces of printed pla and touch the sensor and cause it to go on . I dont think this should be able to conduct through 5" long of plastic and turn on. I did a test with another unknown type of plastic and it didnt react .This leads me to believe the PLA has some conductivity to it and its laying right on the touch board. is this possible ? Although i tested it while in the housing on the breadboard and it was fine

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#11 Post by Genesys » 27 Mar 2017, 02:19

btw what touch sensors did you order . I have tried both the red ttp223 and the blue ttp223 boards . The blue i couldnt get to work correctly even on the breadboard .The only way i could get it to turn on is by directly putting my finger on the TTP223 chip itself.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff basic with touch switch problem

#12 Post by Shardan » 27 Mar 2017, 10:40

Hello Genesys,

These sensors do not work on contact but by capacity.
Even if you touch the sensor itself you usually won't get in electrical contact,
there is a lacquer coat on the copper.
Your finger and the sensor build a capacitor, small but big enough to trigger the sensor chip.
I don't know the dielectric constant of PLA, it might be good enough to make the sensor work even through the PLA.
Pure PLA is classified as "Isolating" if i remember right. That says it has around 10^12 Ohm.
But there are variants that are classified "AntiStatic" or "conductive", says they have a lower resistance.

I've ordered samples of several types as they are a dime a dozen:
https://www.aerial.net/shop/imageslarge ... 23_top.jpg
http://img.dxcdn.com/productimages/sku_434360_1.jpg
https://4.imimg.com/data4/PM/EH/MY-1833 ... 00x500.jpg
Anyways it will take a while due to the well known hyperspeed of chinese snailmail ;)
If i get some i'll take one of my sonoffs and check.

Due to the datasheet you should not remove the ceramic capacitor, use the biggest possible (50pF) instead:
The value of Cs use smaller, then the sensitivity will be better. The sensitivity adjustment must
according to the practical application on PCB. The range of Cs value is 0~50pF.

Datasheet: http://www.tontek.com.tw/download.asp?sn=475
(Always fun to read english from chinese translators ;) )

Regards
Shardan
Regards
Shardan

Genesys
New user
Posts: 8
Joined: 07 Mar 2017, 06:39

Re: Sonoff basic with touch switch problem

#13 Post by Genesys » 30 Mar 2017, 09:40

Would changing the sensitivity help any? Right now i can get it to turn on with my finger about 6mm off of the board . Theres only one capacitor that comes on the board which i probed to be a 90nf ceramic cap and its the C1 cap as per datasheet between VCC and GND . The board does not come with a cap on the sense pin. Shouldnt there be a cap on the sense pin with a value between 0 - 50pf as per the datasheet? Im guessing they just dont put a cap(0 value) so the sensor is at max sensitiviy . Could adding a 50pf NPO ceramic cap off the sense pin help my problem?

The blue boards are different from the red boards . The blue board doesnt have a C1 cap at all and come with a 50pf cap off the sense pad pin .

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff basic with touch switch problem

#14 Post by Shardan » 30 Mar 2017, 13:40

Hello,

the pictures a Google and AliExpress show some differences, maybe soe not... that's why i ordered several different ones ( and hope i'll get the same with the enxt order :evil: )

Just give a 50pf at the sensing pad a try. Worst that might happen is it stops working and you have to remove it. 6mm seems very sensitive to me.

Regards
Shardan
Regards
Shardan

MaleBuffy
New user
Posts: 1
Joined: 13 Sep 2017, 10:41

Re: Sonoff basic with touch switch problem

#15 Post by MaleBuffy » 13 Sep 2017, 10:42

Hello,

have you made it work with AC to DC power?

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests