logo elektroda
logo elektroda
X
logo elektroda

Connecting the Plantower 5003 dust sensor to the ESP8266 12E via serial - technical issues

jurek.parus 603 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19088868
    jurek.parus
    Level 18  
    Hi I want to serialise a Plantower 5003 dust sensor to an ESP8266 12E and I'm having a problem because it works a bit weird and incomprehensible to me.
    1) The 12E has one and a half serials (I thought it had two) Serial = RXTX on Pins GPIO3 and 1; and Serial1 = samTX on GPIO2
    RX should be on GPIO0 but there is a FLASH input there
    2) on 12E there are also additional Serial - RXTX outputs on GPIO13 and 15 pins to which standard outputs can be transferred with Serial.swap() command

    And now what happens:
    (a) I connect the sensor to the standard Serial outputs GPIO3 and 1 - the sensor works and the debug on Serial also works (admittedly, it seems to me that I should see communication with the dust sensor in this terminal from Serial - and I don't see it - but it doesn't matter)
    Unfortunately, such connection blocks me from uploading a new program - simply Arduino doesn't detect the connected board in flashing mode
    b) OK, let's do Serial.swap() and connect to GPIO13 and 15 outputs. OK works - but it also switches debug and debug information is not shown on the computer terminal.
    (c) In playing with these, I noticed one inexplicable thing.
    Normal configuration without Serial.swap()
    - I connect the sensor to GPIO13 and 15 - doesn't work - OK understandable because communication is on standard GPIO3 and 1
    - switch "on the fly" the sensor to GPIO3 and 1 - works - OK
    - switch "on the fly" the sensor to GPIO13 and 15 - WORKS although it should not!
    - board reset
    - sensor does not work (OK)
    What such a strange thing happens when switching on the fly from GPIO3 and 1 to GPIO13 and 15 - looks like both outputs work!!! I don't understand.

    How do I get around this problem of using serial to communicate with devices and debugging at the same time - the device blocks me from changing the program - why? I can at least add some software serial, but I would like to understand what is happening.

    And a quick question from 12E - on the pine Vin shouldn't +5v from USB be derived? Is it derived somewhere because I don't see it (I wanted to power the sensor from USB)
  • ADVERTISEMENT
  • #2 19088906
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #3 19088916
    jurek.parus
    Level 18  
    khoam wrote:
    jurek.parus wrote:
    What's so strange about switching on the fly from GPIO3 and 1 to GPIO13 and 15 - looks like both outputs are working!!!! I don't understand.
    Not really. There are still buffers for UART0 that can cause such a transient effect when switching Serial - swap() does not clear these buffers.
    .
    I do not use Serial.swap in this case. The effect is not transient. I am not reading data from the buffer because the sensor is reading the correct data. After a reboot it returns to normal. Strange.
    I will connect SoftSerial as you advise.
  • ADVERTISEMENT
  • #4 19088929
    Anonymous
    Level 1  
  • #5 19089024
    jurek.parus
    Level 18  
    khoam wrote:
    Here was a similar topic:
    .
    Yes, it's a similar issue - I need to find that diode and bridge it.
ADVERTISEMENT