SlideShare a Scribd company logo
1 of 24
Download to read offline
Introduction

Arduino

GPS

Maps

GUI

Python and Arduino
Easy GPS Tracker using Arduino and Python

Núria Pujol Vilanova
Unitat de Tecnologia Marina (CMIMA-CSIC)
npujol@utm.csic.es
nuriapujolvilanova@gmail.com

16. January 2014

Future
Introduction

Arduino

GPS

Maps

What is my spech about?

1

2

3

4

5

Arduino
Xbee communications
NMEA strings
Georefed image
GUI using PyQt

GUI

Future
Introduction

Arduino

GPS

Maps

GUI

What problem we want to solve?
Main objective
Looking for a low cost and wide range system to locate AUV.

GPRS systems coverage problems far from coast
Iridium satellite communication costs

Future
Introduction

Our Solution

Arduino

GPS

Maps

GUI

Future
Introduction

Arduino

GPS

Maps

GUI

Arduino Family
ARDUINO UNO
CPU Speed: 16MHZ
Analog IN: 6
Digital I/O: 14
UART: 1
Flash: 32Kb

ARDUINO MEGA
CPU Speed: 16MHZ
Analog IN: 16
Digital I/O: 54
UART: 4
Flash: 128Kb

Future
Introduction

Arduino

GPS

Xbee Devices
ZIGBEE
Freq: 2.4GHz
Power OUT: 63mW*
Max. Range: 3.2Km
RF Data rate: 250 Kbps

802.11bgn ("Wifi")
Freq: 2.4GHz
Power OUT: 16 dBm
Max. Range: 300m
RF Data rate: 65 Mbps

"PROPRIETARY"
Freq: 868MHz
Power OUT: 350mW
Max. Range: 40Km
RF Data rate: 24 Kbps
* 10mW limited in most EU

Maps

GUI

Future
Introduction

Arduino

GPS

Maps

How can I program my Arduino?
Arduino IDE
Classical way to program your Arduino

Using Python Libraries:
Python Arduino Prototyping, Pyduino, Pyfirmata,etc.
PyMite (Python-on-chip)

GUI

Future
Introduction

Arduino

GPS

Maps

How can I configure Xbee comunication?
Manufacturer software (X-CTU)
Moltosenso Network Manager
Serial Port (pyserial)

GUI

Future
Introduction

Arduino

GPS

Maps

GUI

Pyserial example using AT commands

>>> import serial
>>> ser = serial . Serial ( ’/ dev / ttyUSB0 ’ , baudrate =9600)
>>> ser . write ( ’ +++ ’)
>>> ser . write ( ’ ATID  r ’)
>>> ser . read (8)
’ OK  r7FFF  r ’
>>> ser . write ( ’ +++ ’)
>>> ser . write ( ’ ATID 7 FF1  r ’ ’)
>>> ser . read (8)
’ OK  r7FF1  r ’
>>> ser . write ( ’ +++ ’)
>>> ser . write ( ’ ATRE  r ’)
>>> ser . write ( ’ ATCN  r ’)

Future
Introduction

Arduino

GPS

Maps

GUI

Future

Programing example with Arduino IDE
# include < SoftwareSerial .h >
# define rxPin 9
# define txPin 8
SoftwareSerial gps = SoftwareSerial ( rxPin , txPin );
* VARIABLES *
void setup (){
pinMode ( rxPin , INPUT );
pinMode ( txPin , OUTPUT );
gps . begin (4800);
Serial . begin (9600);
delay (1000);
}
Introduction

Arduino

GPS

Maps

Programing example with Arduino IDE
void loop (){
byteGPS = 0;
byteGPS = gps . read ();
while ( byteGPS != ’$ ’ ){
byteGPS = gps . read ();
}(*)
byteGPS = gps . read ();
if ( byteGPS == ’G ’ ){ (*)
while ( byteGPS != ’* ’)
{
byteGPS = gps . read ();
GPS [ i ] = byteGPS ;
i ++;
}(*)
while (j < i ){
Serial . write ( char ( GPS [ j ]));
j ++;
}
Serial . println ();
}
}
(*) Missing lines of code

GUI

Future
Introduction

Arduino

GPS

Maps

Programing example with Python
from arduino import Arduino
import time
b = Arduino ( ’/ dev / ttyUSB0 ’)
pin = 9
# declare output pins as a list / tuple
b . output ([ pin ])
for xrange (10):
b . setHigh ( pin )
time . sleep (1)
print b . getState ( pin )
b . setLow ( pin )
print b . getState ( pin )
time . sleep (1)
b . close ()
https://github.com/vascop/Python-Arduino-Proto-API-v2/

GUI

Future
Introduction

Arduino

GPS

Maps

GUI

Future

After programing what we get?

>>> import serial
>>> from serial . tools import list_ports
>>> for port in list_ports . comports ():
...
print port
...
( ’/ dev / ttyUSB0 ’ ,... , ’ VID : PID =0403:6001 SNR = A9014UV2 ’)
( ’/ dev / ttyACM0 ’ ,... , ’ VID : PID =2341:0043 SNR = 8 5 2 3 5 3 5 3 1 3 7 3 5 1 1 1 8 1 1 2 ’)
>>> ser = serial . Serial ( ’/ dev / ttyUSB0 ’ ,9600)
>>> ser . inWaiting ()
243
>>> ser . readline ()
’ $GPGGA ,203156.000 ,4122.5905 , N ,00208.1725 , E ,...*5 r  r  n ’
Introduction

Arduino

GPS

Maps

GUI

NMEA Strings

GPGGA,203156.000,4122.5950,N,00208.1621,E,1,05,1.7,-21.8,M,51.0
NMEA to Decimal conversion
LAT: 4122.5950 N(41o 22.5950’ N)→41+(22.5950/60)=41.376583 N
LON: 00208.1621 E(2o 08.1621’ E)→2+(0.81621/60)=2.136035 E
Decimal to UTM conversion
def from_latlon ( latitude , longitude )
def LLtoUTM ( ReferenceEllipsoid , Lat , Long )

Future
Introduction

Arduino

GPS

Maps

Georefed images formats

TIFF + TFW ⇐⇒ GeoTIFF
Using a .tif file and a .tfw
Geotiff (embedded georeferencing information)
Where to obtain this files for free?
Institut Cartogràfic de Catalunya
Centro Nacional de Información Geográfica

GUI

Future
Introduction

Arduino

GPS

Georefed images formats
exemple.tfw
0.93 187659192 3412
0.00 000000000 0000
0.00 000000000 0000
-0.931876591923412
41 4 6 8 5 . 6 8 3 8 9 8 5 8 0 1 4 0 0 0 0
4570442.677152497700000

Maps

GUI

Future
Introduction

Arduino

GPS

Maps

GUI

Future

How to plot a GeoTIFF?
from osgeo import gdal
import matplotlib . pyplot as plt
gtif = gdal . Open ( ’ canal . tif ’)
gtif . G et P r o j e c t i o n R e f ()
gtif_array = gtif . ReadAsArray ()
tfw = gtif . G et G eo Tr a ns f or m ()
A ,D ,B ,E ,C , F = tfw [1] , tfw [2] , tfw [4] , tfw [5] , tfw [0] , tfw [3]
L = gtif . RasterXSize
H = gtif . RasterYSize
BLX , BLY , TRX , TRY =C , F , C +( L * A ) , F +( H *( E ))
extent =[ BLX , TRX , TRY , BLY ]
fig = plt . figure ()
axes = fig . add_subplot (111)
axes . t i c k l a b e l _ f o r m a t ( useOffset = False , axis = ’ both ’)
plt . imshow ( gtif_array [:3 ,: ,:]. transpose ((1 ,2 ,0)) , extent = extent )
plt . show ()
Introduction

Arduino

GPS

Maps

GUI

How to plot a TIFF?
import matplotlib . pyplot as plt
twf_values =[]
file = open ( ’ c a na l_ E TR 89 _ H3 1 . tfw ’ , " r " )
for line in file :
twf_values . append ( float ( line ))
A , D , B , E , C , F = twf_values
file . close ()
file_im = plt . imread ( ’ ca na l _E T R8 9_ H 31 . tif ’ , " r " )
L = len ( file_im [1 , :])
H = len ( file_im [: , 1])
BLX , BLY , TRX , TRY =C , F , C +( L * A ) , F +( H *( E ))
fig = plt . figure ()
axes = fig . add_subplot (111)
axes . t i c k l a b e l _ f o r m a t ( useOffset = False ,

axis = ’ both ’)

plt . imshow ( file_im , extent =[ BLX , TRX , TRY , BLY ])
plt . show ()

Future
Introduction

Obtained Plot

Arduino

GPS

Maps

GUI

Future
Introduction

Arduino

GPS

Maps

Adding GUI
Eric Python IDE

GUI

Future
Introduction

Arduino

GPS

Maps

Adding GUI
Qt 4 Designer

GUI

Future
Introduction

Final Result

Arduino

GPS

Maps

GUI

Future
Introduction

Arduino

GPS

Future plans

Optimization
Coverage range testing
Field Tests
Get range and bearing
AUV utilities using Xbee

Maps

GUI

Future
Introduction

Arduino

GPS

Maps

QUESTIONS?

GUI

Future

More Related Content

Viewers also liked (7)

Simply arduino
Simply arduinoSimply arduino
Simply arduino
 
Python and the internet of things
Python and the internet of thingsPython and the internet of things
Python and the internet of things
 
Basics of Insulin
Basics of InsulinBasics of Insulin
Basics of Insulin
 
Insulin
InsulinInsulin
Insulin
 
Mechanisms of insulin action
Mechanisms of insulin actionMechanisms of insulin action
Mechanisms of insulin action
 
Gettiing Started with IoT using Raspberry Pi and Python
Gettiing Started with IoT using Raspberry Pi and PythonGettiing Started with IoT using Raspberry Pi and Python
Gettiing Started with IoT using Raspberry Pi and Python
 
Insulin presentation
Insulin presentationInsulin presentation
Insulin presentation
 

Similar to Easy GPS Tracker using Arduino and Python

Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
Naoki (Neo) SATO
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
Introduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU RadioIntroduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU Radio
Albert Huang
 
VLSI experiments II
VLSI experiments IIVLSI experiments II
VLSI experiments II
Gouthaman V
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
Tom Paulus
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
Moriyoshi Koizumi
 

Similar to Easy GPS Tracker using Arduino and Python (20)

Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGIS
 
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
 
Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
Deep Learning, Microsoft Cognitive Toolkit (CNTK) and Azure Machine Learning ...
 
Python grass
Python grassPython grass
Python grass
 
Using Deep Learning (Computer Vision) to Search for Oil and Gas
Using Deep Learning (Computer Vision) to Search for Oil and GasUsing Deep Learning (Computer Vision) to Search for Oil and Gas
Using Deep Learning (Computer Vision) to Search for Oil and Gas
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
SICP勉強会について
SICP勉強会についてSICP勉強会について
SICP勉強会について
 
Introduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU RadioIntroduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU Radio
 
Lrz kurs: gpu and mic programming with r
Lrz kurs: gpu and mic programming with rLrz kurs: gpu and mic programming with r
Lrz kurs: gpu and mic programming with r
 
VLSI experiments II
VLSI experiments IIVLSI experiments II
VLSI experiments II
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
GNU Radio
GNU RadioGNU Radio
GNU Radio
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruz
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Porting and optimizing UniFrac for GPUs
Porting and optimizing UniFrac for GPUsPorting and optimizing UniFrac for GPUs
Porting and optimizing UniFrac for GPUs
 
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
 
VHDL Design and FPGA Implementation of a High Data Rate Turbo Decoder based o...
VHDL Design and FPGA Implementation of a High Data Rate Turbo Decoder based o...VHDL Design and FPGA Implementation of a High Data Rate Turbo Decoder based o...
VHDL Design and FPGA Implementation of a High Data Rate Turbo Decoder based o...
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Easy GPS Tracker using Arduino and Python