I am pretty new to the Arduino/electronics world but like to learn through giving things a try.
The project I am working on is to measure the airflow, temperature and pressure of the air under a race car (the oil cooler that is mounted under the boot floor is not very effective so I want to see if the cooler fan is stalling, whether the air is too hot or if there just isn't enough air flowing). The airflow is being measured by mounting a PC cooler fan in a PVC pipe and using the third wire hall effect sensor to measure RPM and thus airflow. I have an MS5611 to take care of the pressure and temperature.
So far I have the airflow, temperature and pressure displaying on a 3.2" TFT (mounted to a Mega) but I am now trying to introduce a GPS module in order to display the car speed.
I have broken the GPS component out as a separate project for now and am using a UNO rather than the MEGA. I have a GY-GPS6MV2, which I believe is also referred to as a NEO-6 u-blox. I have tried several libraries but am currently trying TinyGPS.
The issue;
Inside the house the green LED on the GPS module does not blink so I realise that I am not connecting with any satellites and getting a signal. I am connected to a PC so cannot use the serial monitor as the code requires when outside. This code is borrowed from
although I have removed the references to the LCD screen.
In order to be able to connect to a wall charger and move outside I have further modified the code to illuminate an LED once the gpsSerial.available() is true i.e. it starts receiving a signal. This is a quick and dirty to just make sure a signal is received.
My code:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
float lat = 28.5458,lon = 77.1703; // create variable for latitude and longitude object
SoftwareSerial gpsSerial(3,4);//rx,tx
TinyGPS gps; // create gps object
void setup(){
Serial.begin(9600); // connect serial
//Serial.println("The GPS Received Signal:");
gpsSerial.begin(9600); // connect gps sensor
//myadded bit
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
}
void loop(){
while(gpsSerial.available()){ // check for gps data
if(gps.encode(gpsSerial.read()))// encode gps data
{
gps.f_get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("Latitude:");
Serial.print(lat,6);
Serial.print(";");
Serial.print("Longitude:");
Serial.println(lon,6);
//Serial.print(lat);
//Serial.print(" ");
//myadded bit
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
}
}
String latitude = String(lat,6);
String longitude = String(lon,6);
Serial.println(latitude+";"+longitude);
delay(1000);
}
Picture of my wiring attached.
When I am inside the serial monitor only ever shows 28.5458;77.1703 i.e. the variable values of latitude and longitude as defined at the beginning of the code. I presume it is not getting a signal so the "while(gpsSerial.available())" is failing.
Outside the LED does NOT light also meaning no signal yet the green LED on the GPS unit is flashing.
I am at a loss. As far as I can see I have everything correct. I am inexperienced at this so I could easily have overlooked something!!!!
While I have you helping, ultimately I want to grab the GPS speed (not interested in lat and long) so is there a simple function (gps.speed()???) to grab that without additional maths?