bluetooth module to send gps data (latitude,longitude) with other sensor data

can any one help me?
(i am using a arduino promini (small size) to be fit inside the car with other sensors.)

My project is about smart road to prevent accidents in which i am developing a toy car with a dummy inside it.the dummy is connected with a adxl 345 accelerometre so that if any irregular movement of head occurs it may sense it and also if piezo electric sensor(for vibration purpose) value greater than threshold then accident detected it will activate my gps module and send the data to my app(prepared using mit app inventor i will add the screenshot later) throgh hc 06 bluetooth module .it has four levels i,e lattitude,longitude,date and time.

Also i have attached other sensor like alchohol sensor(mq3) ,16*2 lcd display ,a led and a buzor to test whether the driver is drunk or not.if the sensor detect it then the led will glow and buzor will make sound and alert the driver through lcd pannel that the driver is drunk please stop.

i

what i have achieved - :

(i)when i am using bluetooth module, with gps only i am getting the output on phone but using with other sensor i am not getting any data on phone.(my first language is not english so please bear with my arrogance ).

"data on phone means" i have developed an app with will shows the data on any android phone.

what my problem -:
(i) i am not getting any output on phone as soon as i connect a third sensor like accelerometre or alchohol sensor.( indivisually all sensor work like charm together my gps module not sending any value to phone).

(ii) i am using tiny gps plus library (one problem i notice that if the accelerometere/piezo value is greater than thershold the the loop is not entering inside gps.encode function (may be it returning false). whatever please help me.

below is my code please help me i am stuck here.(THIS CODE IS NOT COMPLETED BUT WORKS ).

#include <TinyGPS++.h>//importing libraries (gps)
#include<LiquidCrystal.h>//       
#include <SoftwareSerial.h>//  
float lath;   //to store latitude value
float longh;  //to store longitude value
#include <Wire.h>                          //importing libraries (accelerometer library)
#include <Adafruit_Sensor.h>           
#include <Adafruit_ADXL345_U.h>   

/* Assign a unique ID to this sensor at the same time */
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); //

float x,y,z;  //to store the x,y,z axis value of accelerometre.

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  // define rs,rw,enable pin of lcd

/* various pin assigned to pro mini */
const int buzr_pin=6,alcohole_pin=A6, led_pin=7 ,pizo_pin=A3, theshold=100;   


SoftwareSerial softserial(8, 9); // using this as rx(8) tx(9) for bluetooth.



int GPSBaud = 9600;

// Create a TinyGPS++ object called "gps"
TinyGPSPlus gps;



void setup()
{
 pinMode(led_pin,OUTPUT);
 pinMode(buzr_pin,OUTPUT);
 pinMode(alcohole_pin,INPUT);
  softserial.begin(9600);

 // Start the Arduino hardware serial port at 9600 baud
 Serial.begin(9600);

lcd.begin(16,2);
 // Start the software serial port at the GPS's default baud
 Serial.begin(GPSBaud);
 lcd.setCursor(0,0);
/* to print message on screen of LCD(ignore it)*/
 lcd.print("Welcome To");
 lcd.setCursor(0,1);
 lcd.print("Tracking System");
 delay(5000);
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Project By");
 lcd.setCursor(0,1);
 lcd.print("XYZ");
 delay(2000);
 lcd.setCursor(0,1);
 lcd.print("ABC");
 delay(2000);
 lcd.clear();
 
/* Initialise the  accelerometer sensor( it digital and using i2c protocol) */
  
//to check whether acelerometre is sendind data or not 
 if(!accel.begin())
{
   
   Serial.println("Ooops, no ADXL345 detected ... Check your wiring!"); //to check whether aceler
   while(1);
}

}

void loop()
{
 /* to store and print accelerometre value to serial monitor */
 sensors_event_t accelEvent;  
   accel.getEvent(&accelEvent);
   x=accelEvent.acceleration.x;
   y=accelEvent.acceleration.y;

/* alchohol sensor work starts*/
    float adcValue=0;
 for(int i=0;i<10;i++)    // it will loop 10 times and return a value(int) to check with thershold. 
 {
   adcValue+= analogRead(alcohole_pin);
   delay(10);
 }
   float v= (adcValue/10) * (5.0/1024.0);
   float mgL= 0.67 * v;
   Serial.print("Alcohol_val :");// print alchohol value on screen
   Serial.println(mgL);

  /* print accelerometre  value on screen for checking purpose.*/ 

   Serial.print("Accel_x :");Serial.print(x); Serial.print(" ");Serial.print("Accel_y :"); 
   Serial.print(y); Serial.print(" "); Serial.println();Serial.println();

/* condition to check the value of accelerometre and and alchohol sensor*/
   
if((x>=0.1 && x<=0.5) || (x>=-0.1 && x<=-0.5) ||(y>=0.1 && y<=0.5) || (y>=-0.1 && y<=-0.5)||mgL>2.5)
 {
    lcd.print("driver is drunk"); // prints on LCD
   digitalWrite(buzr_pin,HIGH);
  digitalWrite(led_pin,HIGH);
   delay(900);
   digitalWrite(buzr_pin,LOW);
   digitalWrite(led_pin,LOW);
   delay(100);
   lcd.clear();
       
 }
   else
   {
     lcd.print("Normal  ");
     Serial.println("    Normal");
     digitalWrite(buzr_pin, LOW);
     digitalWrite(led_pin, LOW);
     delay(500);
     lcd.clear();
   }
 int pizo_value=analogRead(pizo_pin); // read the piezo value.
  Serial.print("Piezo_val :");
  Serial.println(pizo_value); //print piezo value
  Serial.println();
  Serial.println();
   if(pizo_value>=theshold) // i have given thershold as 100 if greater than it will enter the loop.
   {
   while (Serial.available() > 0)
   {
  //THIS IS WHERE THE PROBLEM IS OCCURS HERE THE LOOP DOES NOT ENTER.
   if (gps.encode(Serial.read())) 
     displayInfo();
   }
 if (millis() > 5000 && gps.charsProcessed() < 10)
 {
   Serial.println(F("No GPS detected"));
   while(true);
 }  
}
}

/* predefined function of tiny gps*/
void displayInfo()
{
  
 if (gps.location.isValid())
 {
   lath=gps.location.lat();
   longh=gps.location.lng();
   softserial.println(lath,5); // SENDS LATITUDE VALUE APP
   
  
 }



 
}

san1122:
when iam using bluetooth module, with gps i am getting the output on phone but using with other sensor i am not getting any data.

Look at your code, the GPS data is being sent to softserial (Bluetooth presumably) but where are you sending the other sensor data ?

thanks for reply but i am using other sensor for other purpose accident detection .

Please edit you post to add code tags, as described in the "How to use this forum" post.

sure sir this is my first time in this forum and new to arduino so kindly bear with me and please some one help me i am stuck for weeks.

Then take two minutes and fix your post.

I have uploadede my app look.

My circuit diagram

/* various pin assigned to pro mini */
const int buzr_pin=6,alcohole_pin=A6,led_pin=7,pizo_pin=A3,theshold=100;

If your actually using a UNO, it does not have a pin A6, as your 'circuit diagram' shows.

Did you write this code yourself, and if so did you build and test it in stages to see if each individual part, GPS and the sensors worked, before making on combined program ?

SIR
I have done the project on PROMINI not UNO so PRO MINI has 7 ANALOG pins. I have checked indivisual components it worked like charm but only i am using it along GPS it shows problem .Other component work together with no problem.

I have done the circuit diagram and the pin of PROMINI is small so i use UNO please ignore that.

Stop shouting and fix your post.

sir,
i have added code tags please check it.

SIR I have done the project on PROMINI not UNO

The picture you posted was of a UNO.

Can you post a circuit diagram of the actual layout you are using ?

Posting a circuit diagrams of layouts and connections you are not actually using is not very helpful.

Post links to the exact modules you are using.

If you are using a 5V Arduino with 3.3V modules, you must have level shifters, or you will destroy the 3.3V modules.

You need to fix seriously misleading comments like this:

 // Start the software serial port at the GPS's default baud
 Serial.begin(GPSBaud);

sir,

(i) My arduino is Geekcreit® Pro Mini ATMEGA328P 5V / 16M.

14 digital input/output port RX and TX, D2 ~ D13
8 analog input port A0 ~ A7
1 pair of TTL level serial port transceiver port RX / TX
6 PWM port, D3, D5, D6, D9, D10, D11
Using Atmega328P - AU microcontroller
Support serial download
Support for external 5 V ~ 12 V dc power supply
Support 9v battery powered
16 MHZ clock frequency
Size: 33.3 x 18 mm

(ii) My gps is GPS Module with Ceramic Antenna GPS Receiver TTL9600 for APM PIX PX4 CC3D Naze32 F3.

     [Description:
Interface:UART Serial TTL 3.3V Level
Default Baud Rate:9600
The Default Rate: 1Hz
Default Data Protocol: NMEA0183
The Default Output Statement:GPRMC,GPVTG,GPGGA,GPGSA,GPGSV,GPGLL
Power Input:DC 3.3-5V,35-50mA
Size:30*25*7mm ]

(iii) GY-291 ADXL345 3-Axis Tilt Digital Gravity Acceleration Sensor Module For Arduino.

Adxl345 digital three-axis acceleration of gravity tilt module Ar code iic / spi
Name: three-axis acceleration of gravity module
Chip: the adxl345
Power supply: 3-5V
Communication: the IIC / SPI communication protocol
Measuring range: ± 2g ± 16g
Schematics, manuals and reference documentation of relevant data
51, the avr, the Ar microcontroller test code
3-axis, ± 2g / ± 4g / ± 8g / ± 16g

(iv) MQ3 Alcohol Ethanol Sensor Breath Gas Ethanol Detection Gas Sensor Module For Arduino.

Size: approx. 32 x 22 x 27mm
Main chip: LM393, ZYMQ-3 gas detector
Working Voltage: DC 5V
With signal output instructions.
Two-way signal output (TTL level output and analog output).
TTL output effectively signal for low level(when the output low level signal lights, can directly connected microcomputer).
Analog output 0 ~ 5v voltage, the higher the concentration, the higher the voltage.
Has a high sensitivity and good selectivity.
Has long service life and reliable stability.
Rapid response recovery features.
For motor vehicles and other prohibition drunken drivers homework personnel on-site testing, also used in other places of ethanol vapor detection.
Color is shown as pictures.

(v) Bluetooth Serial Port Wireless Data Module Compatible SPP-C With HC-06 Arduino Bluetooth 2.1 Modules For 51 Single Chip BT06.

Bluetooth V2.1+EDR
Bluetooth Class 2
Built in PCB radio frequency antenna
Support UART interface
3.3V power

my updated circuit diagram.

The Bluetooth module, the accelerometer module and the GPS have 3.3V I/O and require level shifters for connection to a 5V Arduino.

If the modules aren't dead already, they will be soon, and they might take the rest of the circuitry with them.

ok i will add a voltage devider of 1k and 2k series resistor to make it 3.3v. But thats not my problem my problem is why i am not getting the value gps parameters on my phone when using multiple sensors.

Fix the level problem first.

ok i will add a voltage devider of 1k and 2k series resistor to make it 3.3v

This won't work for I2C connections.

Will fixing the voltage level will fix my problem.