SlideShare a Scribd company logo
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

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

PPTX
Arduino gps2 060314
Benjamin Freeth
 
PDF
Code
Bilal Atie
 
PPTX
robotics and embedded system ppt
Nilgiri publicity
 
DOC
Design and implementation of GPS Tracker
Vignesh Kannan
 
PDF
Birds of a Feather 2017: 邀請分享 IoT, SDR, and Car Security - Aaron
HITCON GIRLS
 
PPTX
Rust is for Robots!
Andy Grove
 
DOCX
Vehicle tracting system
UVSofts Technologies
 
KEY
Scottish Ruby Conference 2010 Arduino, Ruby RAD
lostcaggy
 
PDF
Making things sense-Day 2 (May 2011)
markumoto
 
PDF
maXbox starter 34 GPS Tutorial
Max Kleiner
 
PDF
Arduino A Technical Reference A Handbook For Technicians Engineers And Makers...
ozoezenesli
 
PDF
Sigfox Workshop with Akeru & TheThings.io
Nicolas Lesconnec
 
PPTX
IOT beginnners
udhayakumarc1
 
PPTX
IOT beginnners
udhayakumarc1
 
PPTX
underground cable fault location using aruino,gsm&gps
Mohd Sohail
 
PDF
Low-cost-LoRa-Collar for long range communication
ssuser47bdb5
 
PPT
Arduino Meetup with Sonar and 433Mhz Radios
roadster43
 
PDF
Arduino: interruptor de encendido controlado por Internet
SANTIAGO PABLO ALBERTO
 
PDF
Elegoo Super Starter Kit for UNO V1.0.2017.7.9.pdf
asdasdasd25145
 
PDF
MSI UI Software Design Report
Ashish Charan tandi
 
Arduino gps2 060314
Benjamin Freeth
 
robotics and embedded system ppt
Nilgiri publicity
 
Design and implementation of GPS Tracker
Vignesh Kannan
 
Birds of a Feather 2017: 邀請分享 IoT, SDR, and Car Security - Aaron
HITCON GIRLS
 
Rust is for Robots!
Andy Grove
 
Vehicle tracting system
UVSofts Technologies
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
lostcaggy
 
Making things sense-Day 2 (May 2011)
markumoto
 
maXbox starter 34 GPS Tutorial
Max Kleiner
 
Arduino A Technical Reference A Handbook For Technicians Engineers And Makers...
ozoezenesli
 
Sigfox Workshop with Akeru & TheThings.io
Nicolas Lesconnec
 
IOT beginnners
udhayakumarc1
 
IOT beginnners
udhayakumarc1
 
underground cable fault location using aruino,gsm&gps
Mohd Sohail
 
Low-cost-LoRa-Collar for long range communication
ssuser47bdb5
 
Arduino Meetup with Sonar and 433Mhz Radios
roadster43
 
Arduino: interruptor de encendido controlado por Internet
SANTIAGO PABLO ALBERTO
 
Elegoo Super Starter Kit for UNO V1.0.2017.7.9.pdf
asdasdasd25145
 
MSI UI Software Design Report
Ashish Charan tandi
 

Recently uploaded (20)

DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Ad

Easy GPS Tracker using Arduino and Python