Go Down

Topic: Hardware speedcam informer (Read 2871 times) previous topic - next topic


I use gps in my car. I have speedcams base installed and my gps warns me when the cam is in front of me and the distance is less than 1 km.
I do not need GPS all the time but I need permanent speedcam notification.
I would like to use old CF GPS Haicom HI-305III as GPS source together with arduino.
My goal is to have permanent speedcam notification hidden installed in the car.
I would like to have ability to update speedcams on arduino.
I would like arduino starts up when I turn the ignition on and works like independent device giving me notification by blips or better by voice. "Speedcam detected. Speedlimit is 60 km/h"
I am beginner so I kindly ask you for help.
I will try to open ?F GPS and find out how it could communicate with arduino so I hope I will connect it to arduino and get the coordinates but I am not sure about next step.
I would appreciate if you help me with the following steps. I believe that somebody already faced same problem.
CF GPS connect to arduino and get coordinates
Speedcam database (list of coordinates and directions of the cams) connect to arduino (SD card?) (Shield?)
Speedcam database is around 1000 waypoints so I need arduino to find out the closest point in front of the car - how to do it? (code)
Voice output - shield, module, code?
I understand that during the studying of the present forum and others I will find most answers but I would appreciate any help. I am in learning process but I will improve my experience day to day.
Thank you in advance.


So after many attempts I was able to conect my GPS using the solution from here - http://arduino.cc/forum/index.php/topic,8163.0.html
I can get NIMEA now
Next stage is to read coordinates from file and work with them.
I already tried many solutions but I am a beginner and I can't modify it for my purpose.
Would you help me please? What is wron in the following code? I need to read data from the file looking like IDX,X,Y,TYPE,SPEED,DirType,Direction
(all data is separated by comma)
And my goal is to have variables I can deal with (devide, multiply) - A=218894, X=37.8580207, Y=55.8196348

The code below can do it but only if I put the string into the code -  char * input = "$ÇÐÇÇÁ,175341.458,3355.7870,Ó,01852.4251,Å,1,03,5.5,-32.8,Í,32.8,Í,,0000*57";
If I use char * input = fh.read(); - it doesn't work

01   //IDX,X,Y,TYPE,SPEED,DirType,Direction //
02   //229981,37.3056626,55.6643281,1,60,1,29 //
03   #include <SD.h>
07   void setup() {
08     Serial.begin(9600);
09     pinMode(10,OUTPUT);
10     digitalWrite(10,HIGH);
12     //???????? ?? ??????
13     Serial.print("Starting SD...");
14     if(!SD.begin(8)) Serial.println("failed");
15     else Serial.println("ok");
16       File fh = SD.open("test.txt",FILE_READ);
17     if(!fh)
18     {
19       Serial.println("SD open fail");
20       return;   
21     }
22     //char * input = fh.read();
23   char * input = "$ÇÐÇÇÁ,175341.458,3355.7870,Ó,01852.4251,Å,1,03,5.5,-32.8,Í,32.8,Í,,0000*57";
24       char * garbage = strtok(input, ",");
25       char * firstNumber = strtok(NULL, ",");
26       char * secondNumber = strtok(NULL, ",");
27       double firstDouble;
28       sscanf(firstNumber, "%lf", &firstDouble);
29       printf("%f\n", firstDouble);
30       Serial.print(" C = ");
31        Serial.println(firstNumber);
32     fh.close();
33   }
34   void loop() {
35   }

Go Up