I have Windows 10 with Arduino IDE ver 2.3.2.
I am running an ESP8266 board (LOLIN WEMOS D1 R2) connected to a Beitian BE-280 GPS. The Vcc for the GPS is 3.3 V from the 8266 board. The code is standard GPS Test from the example, modified to 38400 BAUD per the BE-280 data sheet.
The BE-280 blue LED blinks until satellites are acquired and then the red (PPS) and blue (TX) LED's both blink about 1 flash per second. The serial monitor indicates no data being received.
When I connect the BE-280 Rx (pin4) wire to Tx (Pin 3) of the 8266, all is fine. When I connect the BE-280 Tx (pin3) wire to Rx (pin4) of the 8266, the blue LED stops flashing and only the blue LED flashes. Still no data. Is it possible that the BE-280 data sheet is wrong and Tx & Rx are swapped?
Swapping the Tx $ Rx wires results in both red and blue LED's flashing, although somewhat weaker, and still no data.
The spec for the BEE-280 Vcc is 3.6-5.5V. Could this be the problem? I hope to run this from a LIPO battery and will not have 5V readily available.
Thanks in advance for any assistance.
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
38400-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
Board LOLIN WEMOS D1 R2
*/
TinyGPS gps;
SoftwareSerial ss(4, 3);
void setup()
{
Serial.begin(115200);
ss.begin(38400);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
char c = ss.read();
// Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
if (chars == 0)
Serial.println("** No characters received from GPS: check wiring **");
}
I got the GPS working with both 8266 boards. My problem was selecting the Rx and Tx pins. I found this works. I have it set up to measure the distance E-W from the end of my driveway. Apparently one of the I/O pins I was using had a pull-up resistor built in that was causing problems. The GPS seems to work fine on 3.3 volts also.
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = D2, TXPin = D1; // pins for ATGM336H GPS device
static const uint32_t GPSBaud = 38400; // default baudrate of ATGM336H GPS device
double street = 105.110815; //longitude of end of driveway
double dist_feet = 0;
TinyGPSPlus gps;
SoftwareSerial ss(TXPin, RXPin);
void setup() {
Serial.begin(112500); // start serial monitor for debugging
ss.begin(GPSBaud);
}
void loop() {
while (ss.available() > 0){
if (gps.encode(ss.read()) && gps.location.isValid() && gps.date.isValid() && gps.time.isValid()){
double longit = String(gps.location.lng(),8).toDouble();
// Serial.println(longit,8); //longitude as a double
dist_feet = (longit+ street)*360000; //dist from end of driveway
Serial.println(dist_feet,1);
}
}
}
With a voltage range of 3.6volt to 5.5volt it must have it's own built-in voltage regulator.
You will get a longer runtime, and maybe fewer problems, if you power it straight from the LiPo battery.
Leo..
It was working, but now when I try to compile I get an error:
Any idea why this would have changed?
FQBN: esp8266:esp8266:d1_mini
Using board 'd1_mini' from platform in folder: C:\Users\bbutc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2
Using core 'esp8266' from platform in folder: C:\Users\bbutc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2