2024-07-26 -

This commit is contained in:
Adolfo Delorenzo 2024-07-26 22:06:22 -06:00
parent ea6447c0d2
commit 31ae945885
5 changed files with 589 additions and 0 deletions

View File

@ -6309,3 +6309,185 @@ Timestamp,Latitude,Longitude
2024-07-26 21:14:01,9.939956,-84.104910 2024-07-26 21:14:01,9.939956,-84.104910
2024-07-26 21:14:16,9.939956,-84.104909 2024-07-26 21:14:16,9.939956,-84.104909
2024-07-26 21:14:31,9.939956,-84.104909 2024-07-26 21:14:31,9.939956,-84.104909
2024-07-26 21:14:46,9.939955,-84.104907
2024-07-26 21:15:01,9.939955,-84.104907
2024-07-26 21:15:16,9.939955,-84.104908
2024-07-26 21:15:31,9.939955,-84.104907
2024-07-26 21:15:46,9.939956,-84.104907
2024-07-26 21:16:01,9.939954,-84.104907
2024-07-26 21:16:16,9.939954,-84.104907
2024-07-26 21:16:31,9.939954,-84.104907
2024-07-26 21:16:46,9.939953,-84.104908
2024-07-26 21:17:01,9.939952,-84.104908
2024-07-26 21:17:16,9.939951,-84.104907
2024-07-26 21:17:31,9.939949,-84.104907
2024-07-26 21:17:46,9.939947,-84.104905
2024-07-26 21:18:01,9.939947,-84.104904
2024-07-26 21:18:16,9.939945,-84.104903
2024-07-26 21:18:31,9.939944,-84.104902
2024-07-26 21:18:46,9.939942,-84.104902
2024-07-26 21:19:01,9.939942,-84.104902
2024-07-26 21:19:16,9.939940,-84.104901
2024-07-26 21:19:31,9.939939,-84.104900
2024-07-26 21:19:46,9.939938,-84.104899
2024-07-26 21:20:01,9.939937,-84.104898
2024-07-26 21:20:16,9.939936,-84.104897
2024-07-26 21:20:31,9.939934,-84.104896
2024-07-26 21:20:46,9.939935,-84.104897
2024-07-26 21:21:01,9.939935,-84.104898
2024-07-26 21:21:16,9.939935,-84.104898
2024-07-26 21:21:31,9.939934,-84.104897
2024-07-26 21:21:46,9.939933,-84.104895
2024-07-26 21:22:01,9.939932,-84.104895
2024-07-26 21:22:16,9.939931,-84.104894
2024-07-26 21:22:31,9.939931,-84.104894
2024-07-26 21:22:46,9.939930,-84.104894
2024-07-26 21:23:01,9.939930,-84.104894
2024-07-26 21:23:16,9.939929,-84.104894
2024-07-26 21:23:31,9.939929,-84.104893
2024-07-26 21:23:47,9.939927,-84.104890
2024-07-26 21:24:02,9.939926,-84.104889
2024-07-26 21:24:17,9.939926,-84.104888
2024-07-26 21:24:32,9.939926,-84.104889
2024-07-26 21:24:47,9.939926,-84.104888
2024-07-26 21:25:02,9.939925,-84.104887
2024-07-26 21:25:17,9.939925,-84.104886
2024-07-26 21:25:32,9.939924,-84.104885
2024-07-26 21:25:47,9.939923,-84.104885
2024-07-26 21:26:02,9.939923,-84.104885
2024-07-26 21:26:17,9.939924,-84.104885
2024-07-26 21:26:47,9.939924,-84.104885
2024-07-26 21:27:02,9.939924,-84.104885
2024-07-26 21:27:32,9.939923,-84.104884
2024-07-26 21:27:47,9.939923,-84.104884
2024-07-26 21:28:02,9.939923,-84.104883
2024-07-26 21:28:17,9.939922,-84.104883
2024-07-26 21:28:32,9.939923,-84.104884
2024-07-26 21:28:47,9.939923,-84.104884
2024-07-26 21:29:02,9.939923,-84.104884
2024-07-26 21:29:17,9.939923,-84.104884
2024-07-26 21:29:32,9.939923,-84.104884
2024-07-26 21:29:47,9.939923,-84.104886
2024-07-26 21:30:02,9.939923,-84.104885
2024-07-26 21:30:17,9.939923,-84.104885
2024-07-26 21:30:32,9.939923,-84.104885
2024-07-26 21:31:02,9.939923,-84.104884
2024-07-26 21:31:17,9.939923,-84.104883
2024-07-26 21:31:32,9.939923,-84.104883
2024-07-26 21:31:47,9.939923,-84.104883
2024-07-26 21:32:02,9.939922,-84.104883
2024-07-26 21:32:17,9.939921,-84.104882
2024-07-26 21:32:32,9.939921,-84.104883
2024-07-26 21:32:47,9.939921,-84.104883
2024-07-26 21:33:02,9.939921,-84.104883
2024-07-26 21:33:17,9.939921,-84.104882
2024-07-26 21:33:32,9.939909,-84.104869
2024-07-26 21:33:47,9.939903,-84.104863
2024-07-26 21:34:02,9.939900,-84.104859
2024-07-26 21:34:17,9.939899,-84.104857
2024-07-26 21:34:32,9.939899,-84.104857
2024-07-26 21:34:47,9.939899,-84.104857
2024-07-26 21:35:03,9.939899,-84.104857
2024-07-26 21:35:18,9.939899,-84.104858
2024-07-26 21:35:33,9.939899,-84.104858
2024-07-26 21:35:48,9.939899,-84.104858
2024-07-26 21:36:03,9.939898,-84.104857
2024-07-26 21:36:18,9.939897,-84.104857
2024-07-26 21:36:33,9.939896,-84.104857
2024-07-26 21:36:49,9.939896,-84.104857
2024-07-26 21:37:04,9.939895,-84.104857
2024-07-26 21:37:19,9.939895,-84.104857
2024-07-26 21:37:49,9.939894,-84.104858
2024-07-26 21:38:04,9.939894,-84.104857
2024-07-26 21:38:34,9.939894,-84.104857
2024-07-26 21:39:04,9.939894,-84.104857
2024-07-26 21:39:19,9.939893,-84.104856
2024-07-26 21:39:34,9.939892,-84.104856
2024-07-26 21:39:49,9.939892,-84.104856
2024-07-26 21:40:19,9.939892,-84.104857
2024-07-26 21:40:49,9.939892,-84.104858
2024-07-26 21:41:19,9.939891,-84.104857
2024-07-26 21:41:34,9.939890,-84.104857
2024-07-26 21:42:04,9.939890,-84.104858
2024-07-26 21:42:19,9.939890,-84.104858
2024-07-26 21:42:34,9.939889,-84.104858
2024-07-26 21:43:04,9.939890,-84.104859
2024-07-26 21:43:19,9.939890,-84.104860
2024-07-26 21:43:34,9.939890,-84.104860
2024-07-26 21:43:49,9.939890,-84.104861
2024-07-26 21:44:04,9.939889,-84.104862
2024-07-26 21:44:19,9.939890,-84.104863
2024-07-26 21:44:34,9.939890,-84.104863
2024-07-26 21:45:04,9.939890,-84.104864
2024-07-26 21:45:34,9.939890,-84.104865
2024-07-26 21:45:49,9.939889,-84.104865
2024-07-26 21:46:04,9.939889,-84.104866
2024-07-26 21:46:19,9.939889,-84.104867
2024-07-26 21:46:34,9.939889,-84.104867
2024-07-26 21:46:49,9.939888,-84.104867
2024-07-26 21:47:04,9.939888,-84.104867
2024-07-26 21:47:20,9.939888,-84.104867
2024-07-26 21:47:35,9.939888,-84.104868
2024-07-26 21:47:50,9.939888,-84.104869
2024-07-26 21:48:05,9.939888,-84.104869
2024-07-26 21:48:20,9.939888,-84.104870
2024-07-26 21:48:35,9.939888,-84.104870
2024-07-26 21:48:50,9.939888,-84.104871
2024-07-26 21:49:05,9.939888,-84.104872
2024-07-26 21:49:20,9.939888,-84.104873
2024-07-26 21:49:35,9.939889,-84.104873
2024-07-26 21:49:50,9.939889,-84.104874
2024-07-26 21:50:05,9.939890,-84.104875
2024-07-26 21:50:20,9.939890,-84.104875
2024-07-26 21:50:35,9.939891,-84.104876
2024-07-26 21:50:50,9.939891,-84.104877
2024-07-26 21:51:05,9.939891,-84.104877
2024-07-26 21:51:20,9.939891,-84.104877
2024-07-26 21:51:35,9.939891,-84.104878
2024-07-26 21:51:50,9.939891,-84.104879
2024-07-26 21:52:05,9.939891,-84.104879
2024-07-26 21:52:20,9.939891,-84.104880
2024-07-26 21:52:35,9.939891,-84.104880
2024-07-26 21:52:50,9.939891,-84.104881
2024-07-26 21:53:05,9.939891,-84.104882
2024-07-26 21:53:35,9.939891,-84.104883
2024-07-26 21:54:05,9.939891,-84.104884
2024-07-26 21:54:35,9.939891,-84.104885
2024-07-26 21:55:05,9.939892,-84.104887
2024-07-26 21:55:20,9.939892,-84.104887
2024-07-26 21:55:35,9.939892,-84.104888
2024-07-26 21:55:50,9.939893,-84.104889
2024-07-26 21:56:20,9.939893,-84.104890
2024-07-26 21:56:35,9.939893,-84.104890
2024-07-26 21:56:50,9.939893,-84.104890
2024-07-26 21:57:05,9.939893,-84.104890
2024-07-26 21:57:35,9.939893,-84.104891
2024-07-26 21:57:50,9.939893,-84.104892
2024-07-26 21:58:05,9.939893,-84.104892
2024-07-26 21:58:21,9.939893,-84.104893
2024-07-26 21:58:51,9.939893,-84.104893
2024-07-26 21:59:21,9.939893,-84.104893
2024-07-26 21:59:36,9.939893,-84.104893
2024-07-26 21:59:51,9.939893,-84.104893
2024-07-26 22:00:06,9.939894,-84.104894
2024-07-26 22:00:21,9.939894,-84.104894
2024-07-26 22:00:51,9.939894,-84.104895
2024-07-26 22:01:06,9.939894,-84.104895
2024-07-26 22:01:21,9.939895,-84.104896
2024-07-26 22:01:51,9.939896,-84.104897
2024-07-26 22:02:21,9.939897,-84.104898
2024-07-26 22:02:51,9.939898,-84.104899
2024-07-26 22:03:06,9.939899,-84.104900
2024-07-26 22:03:21,9.939900,-84.104901
2024-07-26 22:03:36,9.939900,-84.104901
2024-07-26 22:03:51,9.939900,-84.104902
2024-07-26 22:04:06,9.939901,-84.104903
2024-07-26 22:04:21,9.939901,-84.104903
2024-07-26 22:04:36,9.939901,-84.104904
2024-07-26 22:04:51,9.939902,-84.104904
2024-07-26 22:05:06,9.939902,-84.104905
2024-07-26 22:05:21,9.939903,-84.104906
2024-07-26 22:05:36,9.939903,-84.104906
2024-07-26 22:05:51,9.939901,-84.104903
2024-07-26 22:06:06,9.939902,-84.104903
2024-07-26 22:06:21,9.939901,-84.104904

1 Timestamp Latitude Longitude
6309 2024-07-26 21:14:01 9.939956 -84.104910
6310 2024-07-26 21:14:16 9.939956 -84.104909
6311 2024-07-26 21:14:31 9.939956 -84.104909
6312 2024-07-26 21:14:46 9.939955 -84.104907
6313 2024-07-26 21:15:01 9.939955 -84.104907
6314 2024-07-26 21:15:16 9.939955 -84.104908
6315 2024-07-26 21:15:31 9.939955 -84.104907
6316 2024-07-26 21:15:46 9.939956 -84.104907
6317 2024-07-26 21:16:01 9.939954 -84.104907
6318 2024-07-26 21:16:16 9.939954 -84.104907
6319 2024-07-26 21:16:31 9.939954 -84.104907
6320 2024-07-26 21:16:46 9.939953 -84.104908
6321 2024-07-26 21:17:01 9.939952 -84.104908
6322 2024-07-26 21:17:16 9.939951 -84.104907
6323 2024-07-26 21:17:31 9.939949 -84.104907
6324 2024-07-26 21:17:46 9.939947 -84.104905
6325 2024-07-26 21:18:01 9.939947 -84.104904
6326 2024-07-26 21:18:16 9.939945 -84.104903
6327 2024-07-26 21:18:31 9.939944 -84.104902
6328 2024-07-26 21:18:46 9.939942 -84.104902
6329 2024-07-26 21:19:01 9.939942 -84.104902
6330 2024-07-26 21:19:16 9.939940 -84.104901
6331 2024-07-26 21:19:31 9.939939 -84.104900
6332 2024-07-26 21:19:46 9.939938 -84.104899
6333 2024-07-26 21:20:01 9.939937 -84.104898
6334 2024-07-26 21:20:16 9.939936 -84.104897
6335 2024-07-26 21:20:31 9.939934 -84.104896
6336 2024-07-26 21:20:46 9.939935 -84.104897
6337 2024-07-26 21:21:01 9.939935 -84.104898
6338 2024-07-26 21:21:16 9.939935 -84.104898
6339 2024-07-26 21:21:31 9.939934 -84.104897
6340 2024-07-26 21:21:46 9.939933 -84.104895
6341 2024-07-26 21:22:01 9.939932 -84.104895
6342 2024-07-26 21:22:16 9.939931 -84.104894
6343 2024-07-26 21:22:31 9.939931 -84.104894
6344 2024-07-26 21:22:46 9.939930 -84.104894
6345 2024-07-26 21:23:01 9.939930 -84.104894
6346 2024-07-26 21:23:16 9.939929 -84.104894
6347 2024-07-26 21:23:31 9.939929 -84.104893
6348 2024-07-26 21:23:47 9.939927 -84.104890
6349 2024-07-26 21:24:02 9.939926 -84.104889
6350 2024-07-26 21:24:17 9.939926 -84.104888
6351 2024-07-26 21:24:32 9.939926 -84.104889
6352 2024-07-26 21:24:47 9.939926 -84.104888
6353 2024-07-26 21:25:02 9.939925 -84.104887
6354 2024-07-26 21:25:17 9.939925 -84.104886
6355 2024-07-26 21:25:32 9.939924 -84.104885
6356 2024-07-26 21:25:47 9.939923 -84.104885
6357 2024-07-26 21:26:02 9.939923 -84.104885
6358 2024-07-26 21:26:17 9.939924 -84.104885
6359 2024-07-26 21:26:47 9.939924 -84.104885
6360 2024-07-26 21:27:02 9.939924 -84.104885
6361 2024-07-26 21:27:32 9.939923 -84.104884
6362 2024-07-26 21:27:47 9.939923 -84.104884
6363 2024-07-26 21:28:02 9.939923 -84.104883
6364 2024-07-26 21:28:17 9.939922 -84.104883
6365 2024-07-26 21:28:32 9.939923 -84.104884
6366 2024-07-26 21:28:47 9.939923 -84.104884
6367 2024-07-26 21:29:02 9.939923 -84.104884
6368 2024-07-26 21:29:17 9.939923 -84.104884
6369 2024-07-26 21:29:32 9.939923 -84.104884
6370 2024-07-26 21:29:47 9.939923 -84.104886
6371 2024-07-26 21:30:02 9.939923 -84.104885
6372 2024-07-26 21:30:17 9.939923 -84.104885
6373 2024-07-26 21:30:32 9.939923 -84.104885
6374 2024-07-26 21:31:02 9.939923 -84.104884
6375 2024-07-26 21:31:17 9.939923 -84.104883
6376 2024-07-26 21:31:32 9.939923 -84.104883
6377 2024-07-26 21:31:47 9.939923 -84.104883
6378 2024-07-26 21:32:02 9.939922 -84.104883
6379 2024-07-26 21:32:17 9.939921 -84.104882
6380 2024-07-26 21:32:32 9.939921 -84.104883
6381 2024-07-26 21:32:47 9.939921 -84.104883
6382 2024-07-26 21:33:02 9.939921 -84.104883
6383 2024-07-26 21:33:17 9.939921 -84.104882
6384 2024-07-26 21:33:32 9.939909 -84.104869
6385 2024-07-26 21:33:47 9.939903 -84.104863
6386 2024-07-26 21:34:02 9.939900 -84.104859
6387 2024-07-26 21:34:17 9.939899 -84.104857
6388 2024-07-26 21:34:32 9.939899 -84.104857
6389 2024-07-26 21:34:47 9.939899 -84.104857
6390 2024-07-26 21:35:03 9.939899 -84.104857
6391 2024-07-26 21:35:18 9.939899 -84.104858
6392 2024-07-26 21:35:33 9.939899 -84.104858
6393 2024-07-26 21:35:48 9.939899 -84.104858
6394 2024-07-26 21:36:03 9.939898 -84.104857
6395 2024-07-26 21:36:18 9.939897 -84.104857
6396 2024-07-26 21:36:33 9.939896 -84.104857
6397 2024-07-26 21:36:49 9.939896 -84.104857
6398 2024-07-26 21:37:04 9.939895 -84.104857
6399 2024-07-26 21:37:19 9.939895 -84.104857
6400 2024-07-26 21:37:49 9.939894 -84.104858
6401 2024-07-26 21:38:04 9.939894 -84.104857
6402 2024-07-26 21:38:34 9.939894 -84.104857
6403 2024-07-26 21:39:04 9.939894 -84.104857
6404 2024-07-26 21:39:19 9.939893 -84.104856
6405 2024-07-26 21:39:34 9.939892 -84.104856
6406 2024-07-26 21:39:49 9.939892 -84.104856
6407 2024-07-26 21:40:19 9.939892 -84.104857
6408 2024-07-26 21:40:49 9.939892 -84.104858
6409 2024-07-26 21:41:19 9.939891 -84.104857
6410 2024-07-26 21:41:34 9.939890 -84.104857
6411 2024-07-26 21:42:04 9.939890 -84.104858
6412 2024-07-26 21:42:19 9.939890 -84.104858
6413 2024-07-26 21:42:34 9.939889 -84.104858
6414 2024-07-26 21:43:04 9.939890 -84.104859
6415 2024-07-26 21:43:19 9.939890 -84.104860
6416 2024-07-26 21:43:34 9.939890 -84.104860
6417 2024-07-26 21:43:49 9.939890 -84.104861
6418 2024-07-26 21:44:04 9.939889 -84.104862
6419 2024-07-26 21:44:19 9.939890 -84.104863
6420 2024-07-26 21:44:34 9.939890 -84.104863
6421 2024-07-26 21:45:04 9.939890 -84.104864
6422 2024-07-26 21:45:34 9.939890 -84.104865
6423 2024-07-26 21:45:49 9.939889 -84.104865
6424 2024-07-26 21:46:04 9.939889 -84.104866
6425 2024-07-26 21:46:19 9.939889 -84.104867
6426 2024-07-26 21:46:34 9.939889 -84.104867
6427 2024-07-26 21:46:49 9.939888 -84.104867
6428 2024-07-26 21:47:04 9.939888 -84.104867
6429 2024-07-26 21:47:20 9.939888 -84.104867
6430 2024-07-26 21:47:35 9.939888 -84.104868
6431 2024-07-26 21:47:50 9.939888 -84.104869
6432 2024-07-26 21:48:05 9.939888 -84.104869
6433 2024-07-26 21:48:20 9.939888 -84.104870
6434 2024-07-26 21:48:35 9.939888 -84.104870
6435 2024-07-26 21:48:50 9.939888 -84.104871
6436 2024-07-26 21:49:05 9.939888 -84.104872
6437 2024-07-26 21:49:20 9.939888 -84.104873
6438 2024-07-26 21:49:35 9.939889 -84.104873
6439 2024-07-26 21:49:50 9.939889 -84.104874
6440 2024-07-26 21:50:05 9.939890 -84.104875
6441 2024-07-26 21:50:20 9.939890 -84.104875
6442 2024-07-26 21:50:35 9.939891 -84.104876
6443 2024-07-26 21:50:50 9.939891 -84.104877
6444 2024-07-26 21:51:05 9.939891 -84.104877
6445 2024-07-26 21:51:20 9.939891 -84.104877
6446 2024-07-26 21:51:35 9.939891 -84.104878
6447 2024-07-26 21:51:50 9.939891 -84.104879
6448 2024-07-26 21:52:05 9.939891 -84.104879
6449 2024-07-26 21:52:20 9.939891 -84.104880
6450 2024-07-26 21:52:35 9.939891 -84.104880
6451 2024-07-26 21:52:50 9.939891 -84.104881
6452 2024-07-26 21:53:05 9.939891 -84.104882
6453 2024-07-26 21:53:35 9.939891 -84.104883
6454 2024-07-26 21:54:05 9.939891 -84.104884
6455 2024-07-26 21:54:35 9.939891 -84.104885
6456 2024-07-26 21:55:05 9.939892 -84.104887
6457 2024-07-26 21:55:20 9.939892 -84.104887
6458 2024-07-26 21:55:35 9.939892 -84.104888
6459 2024-07-26 21:55:50 9.939893 -84.104889
6460 2024-07-26 21:56:20 9.939893 -84.104890
6461 2024-07-26 21:56:35 9.939893 -84.104890
6462 2024-07-26 21:56:50 9.939893 -84.104890
6463 2024-07-26 21:57:05 9.939893 -84.104890
6464 2024-07-26 21:57:35 9.939893 -84.104891
6465 2024-07-26 21:57:50 9.939893 -84.104892
6466 2024-07-26 21:58:05 9.939893 -84.104892
6467 2024-07-26 21:58:21 9.939893 -84.104893
6468 2024-07-26 21:58:51 9.939893 -84.104893
6469 2024-07-26 21:59:21 9.939893 -84.104893
6470 2024-07-26 21:59:36 9.939893 -84.104893
6471 2024-07-26 21:59:51 9.939893 -84.104893
6472 2024-07-26 22:00:06 9.939894 -84.104894
6473 2024-07-26 22:00:21 9.939894 -84.104894
6474 2024-07-26 22:00:51 9.939894 -84.104895
6475 2024-07-26 22:01:06 9.939894 -84.104895
6476 2024-07-26 22:01:21 9.939895 -84.104896
6477 2024-07-26 22:01:51 9.939896 -84.104897
6478 2024-07-26 22:02:21 9.939897 -84.104898
6479 2024-07-26 22:02:51 9.939898 -84.104899
6480 2024-07-26 22:03:06 9.939899 -84.104900
6481 2024-07-26 22:03:21 9.939900 -84.104901
6482 2024-07-26 22:03:36 9.939900 -84.104901
6483 2024-07-26 22:03:51 9.939900 -84.104902
6484 2024-07-26 22:04:06 9.939901 -84.104903
6485 2024-07-26 22:04:21 9.939901 -84.104903
6486 2024-07-26 22:04:36 9.939901 -84.104904
6487 2024-07-26 22:04:51 9.939902 -84.104904
6488 2024-07-26 22:05:06 9.939902 -84.104905
6489 2024-07-26 22:05:21 9.939903 -84.104906
6490 2024-07-26 22:05:36 9.939903 -84.104906
6491 2024-07-26 22:05:51 9.939901 -84.104903
6492 2024-07-26 22:06:06 9.939902 -84.104903
6493 2024-07-26 22:06:21 9.939901 -84.104904

103
gpsinfluxdb.py Normal file
View File

@ -0,0 +1,103 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import serial
import time
from datetime import datetime
import os
import signal
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
# GPIO configuration
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ser = serial.Serial('/dev/ttyUSB3', 115200)
ser.flushInput()
myhost = os.uname()[1]
# InfluxDB settings
INFLUXDB_URL = "http://100.64.0.24:8086"
INFLUXDB_TOKEN = "IPtqPXbaXuuMHvx_tUOt1cmIZfLHucd-9DcepXTVpQc-fNKBhp6pkhyTsq_XnoGXdxwILy5AFFgZ_QUZCE5Jhg=="
INFLUXDB_ORG = "juandiego" # Replace with your organization name
INFLUXDB_BUCKET = "gps_data"
# Initialize InfluxDB client
client = InfluxDBClient(url=INFLUXDB_URL, token=INFLUXDB_TOKEN, org=INFLUXDB_ORG)
write_api = client.write_api(write_options=SYNCHRONOUS)
# Global flag for graceful exit
running = True
def signal_handler(sig, frame):
global running
print('You pressed Ctrl+C! Stopping GPS tracking...')
running = False
signal.signal(signal.SIGINT, signal_handler)
def parse_gps_data(gps_string):
parts = gps_string.split(',')
if len(parts) < 4:
return None
lat = float(parts[0][:2]) + float(parts[0][2:]) / 60
if parts[1] == 'S':
lat = -lat
lon = float(parts[2][:3]) + float(parts[2][3:]) / 60
if parts[3] == 'W':
lon = -lon
return f"{lat:.6f}", f"{lon:.6f}"
def write_to_influxdb(lat, lon):
lat_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "latitude") \
.field("value", float(lat))
lon_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "longitude") \
.field("value", float(lon))
write_api.write(bucket=INFLUXDB_BUCKET, record=[lat_point, lon_point])
def send_at(command, back, timeout):
ser.write((command + '\r\n').encode())
time.sleep(timeout)
if ser.inWaiting():
time.sleep(0.01)
rec_buff = ser.read(ser.inWaiting()).decode()
if back in rec_buff:
gps_data = rec_buff.split('+CGPSINFO: ')[1].split('\r\n')[0]
parsed_data = parse_gps_data(gps_data)
if parsed_data:
lat, lon = parsed_data
print(f"GPS: Lat: {lat}, Lon: {lon}")
write_to_influxdb(lat, lon)
return 1
return 0
def get_gps_position():
send_at('AT+CGPSINFO', '+CGPSINFO:', 1)
def initialize_gps():
print('Starting GPS')
send_at('AT+CGPS=1', 'OK', 1)
time.sleep(2)
initialize_gps()
print("Starting continuous GPS tracking. Press Ctrl+C to stop.")
while running:
get_gps_position()
time.sleep(14) # Wait for 14 seconds before the next reading
ser.close()
GPIO.cleanup()
client.close()
print("GPS tracking stopped. Goodbye!")

103
gpsinfluxdb01.py Normal file
View File

@ -0,0 +1,103 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import serial
import time
from datetime import datetime
import os
import signal
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
# GPIO configuration
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ser = serial.Serial('/dev/ttyUSB3', 115200)
ser.flushInput()
myhost = os.uname()[1]
# InfluxDB settings
INFLUXDB_URL = "http://100.64.0.24:8086"
INFLUXDB_TOKEN = "IPtqPXbaXuuMHvx_tUOt1cmIZfLHucd-9DcepXTVpQc-fNKBhp6pkhyTsq_XnoGXdxwILy5AFFgZ_QUZCE5Jhg=="
INFLUXDB_ORG = "juandiego" # Replace with your organization name
INFLUXDB_BUCKET = "gpsdata"
# Initialize InfluxDB client
client = InfluxDBClient(url=INFLUXDB_URL, token=INFLUXDB_TOKEN, org=INFLUXDB_ORG)
write_api = client.write_api(write_options=SYNCHRONOUS)
# Global flag for graceful exit
running = True
def signal_handler(sig, frame):
global running
print('You pressed Ctrl+C! Stopping GPS tracking...')
running = False
signal.signal(signal.SIGINT, signal_handler)
def parse_gps_data(gps_string):
parts = gps_string.split(',')
if len(parts) < 4:
return lat, lon
lat = float(parts[0][:2]) + float(parts[0][2:]) / 60
if parts[1] == 'S':
lat = -lat
lon = float(parts[2][:3]) + float(parts[2][3:]) / 60
if parts[3] == 'W':
lon = -lon
return f"{lat:.6f}", f"{lon:.6f}"
def write_to_influxdb(lat, lon):
lat_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "latitude") \
.field("value", round(lat, 6))
lon_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "longitude") \
.field("value", round(lon, 6))
write_api.write(bucket=INFLUXDB_BUCKET, record=[lat_point, lon_point])
def send_at(command, back, timeout):
ser.write((command + '\r\n').encode())
time.sleep(timeout)
if ser.inWaiting():
time.sleep(0.01)
rec_buff = ser.read(ser.inWaiting()).decode()
if back in rec_buff:
gps_data = rec_buff.split('+CGPSINFO: ')[1].split('\r\n')[0]
parsed_data = parse_gps_data(gps_data)
if parsed_data:
lat, lon = parsed_data
print(f"GPS: Lat: {lat:.6f}, Lon: {lon:.6f}")
write_to_influxdb(lat, lon)
return 1
return 0
def get_gps_position():
send_at('AT+CGPSINFO', '+CGPSINFO:', 1)
def initialize_gps():
print('Starting GPS')
send_at('AT+CGPS=1', 'OK', 1)
time.sleep(2)
initialize_gps()
print("Starting continuous GPS tracking. Press Ctrl+C to stop.")
while running:
get_gps_position()
time.sleep(2) # Wait for 14 seconds before the next reading
ser.close()
GPIO.cleanup()
client.close()
print("GPS tracking stopped. Goodbye!")

103
gpsinfluxdb02.py Normal file
View File

@ -0,0 +1,103 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import serial
import time
from datetime import datetime
import os
import signal
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
# GPIO configuration
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ser = serial.Serial('/dev/ttyUSB3', 115200)
ser.flushInput()
myhost = os.uname()[1]
# InfluxDB settings
INFLUXDB_URL = "http://100.64.0.24:8086"
INFLUXDB_TOKEN = "IPtqPXbaXuuMHvx_tUOt1cmIZfLHucd-9DcepXTVpQc-fNKBhp6pkhyTsq_XnoGXdxwILy5AFFgZ_QUZCE5Jhg=="
INFLUXDB_ORG = "juandiego" # Replace with your organization name
INFLUXDB_BUCKET = "gpsdata"
# Initialize InfluxDB client
client = InfluxDBClient(url=INFLUXDB_URL, token=INFLUXDB_TOKEN, org=INFLUXDB_ORG)
write_api = client.write_api(write_options=SYNCHRONOUS)
# Global flag for graceful exit
running = True
def signal_handler(sig, frame):
global running
print('You pressed Ctrl+C! Stopping GPS tracking...')
running = False
signal.signal(signal.SIGINT, signal_handler)
def parse_gps_data(gps_string):
parts = gps_string.split(',')
if len(parts) < 4:
return None
lat = float(parts[0][:2]) + float(parts[0][2:]) / 60
if parts[1] == 'S':
lat = -lat
lon = float(parts[2][:3]) + float(parts[2][3:]) / 60
if parts[3] == 'W':
lon = -lon
return lat, lon # Return as float values, not strings
def write_to_influxdb(lat, lon):
lat_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "latitude") \
.field("value", round(lat, 6)) # Round to 6 decimal places
lon_point = Point("gps_location") \
.tag("host", myhost) \
.tag("coordinate", "longitude") \
.field("value", round(lon, 6)) # Round to 6 decimal places
write_api.write(bucket=INFLUXDB_BUCKET, record=[lat_point, lon_point])
def send_at(command, back, timeout):
ser.write((command + '\r\n').encode())
time.sleep(timeout)
if ser.inWaiting():
time.sleep(0.01)
rec_buff = ser.read(ser.inWaiting()).decode()
if back in rec_buff:
gps_data = rec_buff.split('+CGPSINFO: ')[1].split('\r\n')[0]
parsed_data = parse_gps_data(gps_data)
if parsed_data:
lat, lon = parsed_data
print(f"GPS: Lat: {lat:.6f}, Lon: {lon:.6f}") # Print with 6 decimal places
write_to_influxdb(lat, lon)
return 1
return 0
def get_gps_position():
send_at('AT+CGPSINFO', '+CGPSINFO:', 1)
def initialize_gps():
print('Starting GPS')
send_at('AT+CGPS=1', 'OK', 1)
time.sleep(2)
initialize_gps()
print("Starting continuous GPS tracking. Press Ctrl+C to stop.")
while running:
get_gps_position()
time.sleep(14) # Wait for 14 seconds before the next reading
ser.close()
GPIO.cleanup()
client.close()
print("GPS tracking stopped. Goodbye!")

98
gpsinfluxdb03.py Normal file
View File

@ -0,0 +1,98 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import serial
import time
from datetime import datetime
import os
import signal
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
# GPIO configuration
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ser = serial.Serial('/dev/ttyUSB3', 115200)
ser.flushInput()
myhost = os.uname()[1]
# InfluxDB settings
INFLUXDB_URL = "http://100.64.0.24:8086"
INFLUXDB_TOKEN = "IPtqPXbaXuuMHvx_tUOt1cmIZfLHucd-9DcepXTVpQc-fNKBhp6pkhyTsq_XnoGXdxwILy5AFFgZ_QUZCE5Jhg=="
INFLUXDB_ORG = "juandiego" # Replace with your organization name
INFLUXDB_BUCKET = "gpsdata"
# Initialize InfluxDB client
client = InfluxDBClient(url=INFLUXDB_URL, token=INFLUXDB_TOKEN, org=INFLUXDB_ORG)
write_api = client.write_api(write_options=SYNCHRONOUS)
# Global flag for graceful exit
running = True
def signal_handler(sig, frame):
global running
print('You pressed Ctrl+C! Stopping GPS tracking...')
running = False
signal.signal(signal.SIGINT, signal_handler)
def parse_gps_data(gps_string):
parts = gps_string.split(',')
if len(parts) < 4:
return None
lat = float(parts[0][:2]) + float(parts[0][2:]) / 60
if parts[1] == 'S':
lat = -lat
lon = float(parts[2][:3]) + float(parts[2][3:]) / 60
if parts[3] == 'W':
lon = -lon
return lat, lon
def write_to_influxdb(lat, lon):
point = Point("gps_location") \
.tag("host", myhost) \
.field("latitude", round(lat, 6)) \
.field("longitude", round(lon, 6))
write_api.write(bucket=INFLUXDB_BUCKET, record=point)
def send_at(command, back, timeout):
ser.write((command + '\r\n').encode())
time.sleep(timeout)
if ser.inWaiting():
time.sleep(0.01)
rec_buff = ser.read(ser.inWaiting()).decode()
if back in rec_buff:
gps_data = rec_buff.split('+CGPSINFO: ')[1].split('\r\n')[0]
parsed_data = parse_gps_data(gps_data)
if parsed_data:
lat, lon = parsed_data
print(f"GPS: Lat: {lat:.6f}, Lon: {lon:.6f}")
write_to_influxdb(lat, lon)
return 1
return 0
def get_gps_position():
send_at('AT+CGPSINFO', '+CGPSINFO:', 1)
def initialize_gps():
print('Starting GPS')
send_at('AT+CGPS=1', 'OK', 1)
time.sleep(2)
initialize_gps()
print("Starting continuous GPS tracking. Press Ctrl+C to stop.")
while running:
get_gps_position()
time.sleep(3) # Wait for 14 seconds before the next reading
ser.close()
GPIO.cleanup()
client.close()
print("GPS tracking stopped. Goodbye!")