Hello, when i use pingviewer i can get the correct data from my Ping sonar but as stated in the title, when i try to read data trough serial monitor on Arduino IDE, it shows that sonar is not being initiliazed.I checked the pin connections and everything seems to be correct.Is there anyway i can fix this problem?
This is usually caused by having the RX and TX wires the wrong way around, or from the serial baud-rate being incorrect between the Arduino and the Ping device. Can you confirm which Ping1D firmware version you’re using? It’s possible our guide and/or code are outdated - I’ve asked internally and am trying to find out what the latest information should be.
In this recent thread I connected successfully to our latest firmware (Ping-v3.28_auto) by changing the baud rate from 9600 to 115200 (e.g. change from pingSerial.begin(9600) to pingSerial.begin(115200)), which you may wish to try. Otherwise you should be able to roll back your firmware to Ping-v3.27_9600 using PingViewer (as specified in the guide you linked to), after which the example code should work as-is assuming your wires are connected to the correct ports.
Thank you very much. I just change “pingSerial.begin(9600)” to “pingSerial.begin(115200)” and it works. Please update your download version from the website. Its example still writes 9600. Thank you very much for your wonderful product.
Looking forward to obtaining more products from your company.
I’ve spoken with our software team and apparently the reasoning for using 9600 baud is that Arduino Software Serial can have issues going much faster than that, especially when there’s much other code running. We’re planning to update our Arduino examples to work correctly with our latest Ping_V3.28_auto.hex firmware (enabling both 9600 and 115200 baud without needing to change firmware), and change our documentation to say that 115200 baud is possible, but not recommended unless on Hardware Serial.
See the following GitHub Issue for progress:
In the meantime, if 115200 is working without issues for you then you’re welcome to continue using it, but if it is having some problems then I’d recommend either
changing to an Arduino with additional hardware serial ports (e.g. Arduino Mega), and using hardware serial instead of software serial OR
connecting your Ping to your computer via a BLUART (or some other USB to TTL Serial converter), and updating the firmware to Ping_V3.27_9600b.hex, after which you should be able to use 9600 baud software serial in your Arduino script. (Detailed instructions with screenshots here)