These are chat archives for esp8266/Arduino

30th
Mar 2016
Mario Mikočević
@mozgy
Mar 30 2016 08:42
@tzapu I'm very busy atm .. no time for tinkering ..
tzapu
@tzapu
Mar 30 2016 11:23
i know how you feel @mozgy , my tinkering time has dwindled down in the last couple of weeks to almost nothing :|
Stavros Korokithakis
@skorokithakis
Mar 30 2016 15:17
oh, @tzapu i don't know enough to not bother with P-MOS, i just didn't get any :P
no real reason
tzapu
@tzapu
Mar 30 2016 15:17
:P
i know even less , didn t know anything about N MOS either :))
Stavros Korokithakis
@skorokithakis
Mar 30 2016 15:18
i don't know why you need a P in this case, did you get the why?
Martin Ayotte
@martinayotte
Mar 30 2016 15:28
The discussion about P-Chan/N-Chan is related to the fact that switching power supply. N-Chan is used for switch the GND side, while the P-Chan is used to switch the VCC side. A N-chan can not switch VCC ! so, if someone need to switch VCC of a SDCard for example, it requires a P-Chan.
tzapu
@tzapu
Mar 30 2016 15:38
and it s less reliable to switch ground of sd card than positive, from what i understood
Martin Ayotte
@martinayotte
Mar 30 2016 15:47
Yes ! this is because all data/control pins still connected, but without any reference to GND, since GND is switch off. This can lead to data corruptions during power off.
@tzapu , Did you got change to try the PNP option or the Relay option ?
Stavros Korokithakis
@skorokithakis
Mar 30 2016 15:57
@martinayotte oh oops, that's good to know! why is that, though? i would have thought that VCC and GND are the same, since you always connect things to the +3V3 side and the GND side
oh pff you just explained it, sorry :smile:
oh you explained about the SD
tzapu
@tzapu
Mar 30 2016 15:58
@martinayotte not yet, not time for playing :( i hope tomorrow
Stavros Korokithakis
@skorokithakis
Mar 30 2016 16:10
hmm, i'm still not sure why an N-Chan can't switch VCC
Martin Ayotte
@martinayotte
Mar 30 2016 16:19
@skorokithakis , N-Chan can not switch VCC simply because the Vgs is on the wrong side : the gate need to have 1 or 2 V above the source to turn ON, so it requires a higher voltage than VCC, ie : VCC + 2V.
Stavros Korokithakis
@skorokithakis
Mar 30 2016 16:19
ohhhh
that would explain why my sensor boards aren't working!
thanks martin, you saved me the second batch of boards
Martin Ayotte
@martinayotte
Mar 30 2016 16:20
P-Chan is the reverse. It can not switch the GND, because to turn on it need to be 2V below GND, ie : -2V.
ericklil
@ericklil
Mar 30 2016 16:21
Not meaning to interrupt however has anyone experience with using both serial UARTS at the same time...
Martin Ayotte
@martinayotte
Mar 30 2016 16:21
That's why it is good to have both in inventory, depending of the purpose, both brother/sister, AO3401/AO3402
@ericklil , personally, I've never used the second serial yet, especially that it is TX only.
ericklil
@ericklil
Mar 30 2016 16:23
@skorokithakis Thanks how about a softwareSerial?
Martin Ayotte
@martinayotte
Mar 30 2016 16:24
I've used that on other MCU, but not on ESP. But it should work, some other tried it, simply beware of limited baudrate, around 9600
ericklil
@ericklil
Mar 30 2016 16:25
ahh good to know the Max Baud rate, will try
@skorokithakis actually come to think of it I may only need Tx only to send commands to a RS485...
Martin Ayotte
@martinayotte
Mar 30 2016 16:27
The baudrate is limited because since WiFi tasks continue in background, the serial software decoding timing can suffer from some jitter. You can try it at 19200, but there are some chance of few garbage, bigger if higher rate.
ericklil
@ericklil
Mar 30 2016 16:29
these commenads only need to be send once every 45 sec to maintain a connection to a device, can the WiFi be "delayed"?
Martin Ayotte
@martinayotte
Mar 30 2016 16:30
(BTW, I'm not skorokithakis , I'm martinayotte ... :-) ) Yes, if TX only is Ok for you, than no issue about baudrate. BTW, is your RS485 a bus ? if Yes, don't forget to use a GPIO to enable/disable the transceiver.
What do you means by "WiFi be delayed" ? If it is connect and there something preventing the background tasks to run, the watchdog will bark ! :-)
ericklil
@ericklil
Mar 30 2016 16:32
@martinayotte Sorry about that...The Wifi is handling a connection to a MQTT server, the TX only would be good for now. any best suggetsion on GPIO
Stavros Korokithakis
@skorokithakis
Mar 30 2016 16:34
@martinayotte yep, i just ordered some AO3401s after your suggestion
@martinayotte wait, do you mean that N-MOS can only have GND at the source?
because i don't see why it would be a problem if I put the N-MOS before my component, with my component's VCC at the N-MOS's source
Martin Ayotte
@martinayotte
Mar 30 2016 17:57
@ericklil , do you means GPIO for the RS485 enable ? GPIO15 is good candidate since at RES, it needs to be pulldown, and the RS485 will be disable in that state.
@skorokithakis and @tzapu , for P-Chan (but I would personally replace the small 2N3904 by an N-Chan) : http://i.stack.imgur.com/AyyEB.png
Mario Mikočević
@mozgy
Mar 30 2016 18:33
got Wio Link today, nicely done board
Stavros Korokithakis
@skorokithakis
Mar 30 2016 19:18
@martinayotte in the first example, couldn't you switch lamp and MOSFET?
Gleb V
@glebv
Mar 30 2016 19:28
Hello, I'm worrying about non-blocking approach for pubsubclient lib. I prepared my program which is based on non-blocking example from the lib. But I discovered that if I try to watch a button changes in loop(), button state is not tracked while client.connect(…) is called. It can take 1-2 second. Do you know how it can be solved?
Gleb V
@glebv
Mar 30 2016 19:41
I asked it in knolleary/pubsubclient#147 as well
Martin Ayotte
@martinayotte
Mar 30 2016 20:15
@skorokithakis , what do you mean ? placing the MOSFET on top and the lamp to GND ? Not really, it would be completely different schematic. And don't forget that what turning On the MOSFET is still the Vgs voltage, so reference point won't be GND anymore, making it difficult to drive from ESP GPIO, unless if is done with an optocoupler for example, but that start becoming complex, better use an P-Chan ...http://3.bp.blogspot.com/-pOmRahqctMU/USpZwhgXlmI/AAAAAAAAAiM/cOoV5D9yfpY/s1600/fig2.png http://3.bp.blogspot.com/-fWHUojomEU8/USpaqdy5mnI/AAAAAAAAAic/sbTGB8IBmXU/s1600/isolated+ps.png
Stavros Korokithakis
@skorokithakis
Mar 30 2016 20:29
Ah, I see. Yes, that schematic was what I meant. Thank you. So an NMOS needs to always be connected to ground?
Martin Ayotte
@martinayotte
Mar 30 2016 20:59
Those previous N-Channel HIGH side schematics are working, but looking at the complexity of gate drive, I won't use them at all. I simply prefer using P-Channel for any HIGH side switching design ...