0

I am trying to communicate using XBee chips to a NodeMCU and for the NodeMCU to read that data and perform a function but I am having trouble with the NodeMCU not reading data from Serial.

I have the XBee router tx connected to the NodeMCU tx and rx to rx. The XBee coordinator is connected via a debug board to my pc.

I observe following:

When NodeMCU USB is connected and tx and rx pins are connected to XBee router serial console input is successfully transmitted and received by the XBee coordinator Serial data sent via the XBee coordinator is successfully received by the NodeMCU and output to the serial console. Note, it is not read via the Serial.Read() commands on the NodeMCU. That is:

NodeMCU Console -> NodeMCU TX -> XBee Router TX -> XBee Coordinator RX

XBee Coordinator TX -> XBee Router RX -> NodeMCU RX -> NodeMCU Console

When NodeMCU USB is connected and tx and rx pins are not connected Serial console input is read by NodeMCU serial.read commands and Serial.Write commands are output to the NodeMCU serial console. That is:

NodeMCU Console -> Serial.Read()

Serial.Write() -> NodeMCU Console

This all confirms that data is successfully be received and transmitted, However, when usb is not connected and I power the NodeMCU 5v on VIN (USB power only) and the tx and rx connected to the XBee router then Serial.Write commands on the NodeMCU are not received via the XBee coordinator and XBee coordinator transmitted data is not received (I have code that will set a pin high on receiving data).

I have verified that the XBee router is powered on and visible to the XBee coordinator and do not now why the Serial.Read will not read the data coming in on the RX pin, and the Serial.Write will not write data to the TX pin.

  • 1
    it is different to see the output in Serial Monitor then parse it in sketch. if you read only while available(), you stop reading at first gap between bytes. show your sketch – Juraj Jun 27 at 17:48
  • 1
    @Juraj, I managed to get this working with the XBee connected to the debug board attaching jumpers to 5V, G, TX, RX. This then is getting it's power direct from 5V supply, whereas before I was powering the XBee from the 3.3V pin on the ESP8266. So, I expect the issue may be that the XBee receiver was not getting enough power. I'm not sure if I should delete my question or answer it myself? – ptutt Jun 29 at 23:14
  • 1
    would it be an answer to this Question? the Question doesn't mention powering of the XBee – Juraj Jun 30 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.