UART sensor connection with Notecarrier F

Hi everyone. I’m trying to connect a sensor via UART to the Notecarrier F but it doesn’t seem to work properly. I followed the example N. 50 in app-accelerators where the Rx and TX wires of the sensor are connected to F_RX and F_TX and a serial connection is defined as:

#define txRxPinsSerial Serial1

I also tried with both positions of the DFU switch.

Can someone explain how to do this connection properly?

Thanks

Hi @carlosG welcome to the forums!

Here are some things you may want to check:

  • You will likely also need to connect GND to your sensor
  • Have you checked if your sensor runs at the same voltage as the Feather Board, 3.3 V?
  • Can you confirm which Feather Board you are using? Swan or Cygnet?
    • Could you also confirm which sensor you are trying to connect?
  • Your sensor likely should be connected using RX → F_TX and TX → F_RX
  • Have you checked the baud rate of both the sensor and the Feather Board?
  • The DFU switch should be set to NORMAL (it connects the Feather’s Serial pins to the Notecard’s AUX pins, which you don’t want for this scenario)

If you’re still having problems communicating with the sensor, it might make it easier if you can share a photo of how everything is wired up.

Thanks,

Alex

2 Likes

Hi @abucknall, many thanks for your help! I have checked all you have mentioned:

  • The sensor I am using is the ultrasonic sensor A01NYUB from DFrobot. It is connected to the GND of the Notecarrier. The VCC of the sensor connected to VMAIN of the Notecarrier.
  • The specs of the sensor says operating voltage 3.3-5V.
  • I am using a Swan.
  • The connection are indeed RX → F_TX and TX→F_RX.
  • The baud rate of the sensor is 9600. The UART connection in the code is txRxPinsSerial.begin(9600).
  • The DFU switch is set to NORMAL.

After all these checks, I get four bytes sent by the sensor via UART, but the code does not seem to extract the payload (bytes 1 and 2) properly. The Header byte should be 255, which I am getting as byte number 4… So, I am reviewing the code to try to find a solution. Attached a photo.

Thanks,

Carlos

2 Likes