SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By karl
#33890
Hi Guys,

Does anyone have any comment on the speed of the Python interpreter in the GM862-GPS?

I've noticed that my scripts (not terribly complicated - just warm up the GPS, read a position and send it by SMS) take about 3.5 minutes to run - is this what everyone else has found?

I ask because if this is the case, I'm going to stop using Python and use a microcontroller to send AT command directly.

K.
By maokh
#34385
This is all in the telit python document....but...here's the jist of it..

If you write a program, and upload it, and execute it, it must first compile the python script into a .pyo (basically python object code). Depending on program size, this can take a while. Infact, 10kB can take over a half hour to compile in some cases.

So, we're all screwed right? well, not without a couple tricks..

the main program specified in ESCRIPT is always compiled, and the .pyo is never kept on the device flash. However, it will compile and permanently save any python includes. From then on, it will just execute the python include's .pyo almost immedately.

This is what i do..

write a very small program like so:

---main.py-------------------------

#my program

import therealprogram
import SER

SER.set_speed("9600")
SER.send("Hello World\r\n")
therealprogram.main()

---therealprogram.py--------------

# this is the real program
# it could take forever to compile this once
# but afterwards, this entire program will start in seconds

def main():
SER.send("I have started\r\n")
..bla bla bla...


---------------------------------------

The program will not print "Hello world" until therealprogram.py finishes compiling. A python script will only execute once all of its imported scripts compile. If you were to import additional modules in "therealprogram.py", it would print "Hello World" and pause until those compiled.

You can use a microcontroller if you wish...but i have found that this method (recommended by telit) does the trick.
By velocet
#34443
You can download the latest version of Pythonwin http:/www.roundsolutions.co.uk/techdocs

You can compile the files prior to download. So you only download the .pyo not the py.

You should also checkout the new 'Easy Script' version 3 as this goes into some of the limitations of the module. There are many.


Although I still use python I only use it for some basic functions and use an AVR to do all the real work, storage to Micro SD, 3 axis accelerometer, Bluetooth module.

If you are thinking of larger projects I would certainly consider adding a controller.
By karl
#34475
maokh wrote:This is all in the telit python document....but...here's the jist of it..
Thanks - I actually had already read the Telit documents, but had not realised the implications of them. I hope this thread saves someone else some time.
maokh wrote: You can use a microcontroller if you wish...but i have found that this method (recommended by telit) does the trick.
I ended up using a combination of the two. My ATmega8 provides the power-on pulse, and then loops reading GPS and putting it on a 16x2 LCD screen (basically so that I can verify that the thing is working without incurring GPRS costs). The 862-GPS does the main work of sending GPRS packets every minute.

Quite a neat solution, but it took me a couple of gos to get it right. When I've finished it all (and tidied it up a bit) I'll post the details here.

Thanks for your help

K.
By maokh
#34540
Sounds good. Its highly suggested to at least have the most basic of uC's handle the power up/power down. Otherwise, you are stuck with grounding the ON/OFF pin for permanent power up.

This is okay sometimes, unless you are under battery power. In this case, you could easily implement some sort of low battery routines, make use of the alarm clock (good way to put the silly thing to sleep for lengths of time without drawing any measurable power), etc.

velocet's advice is good, however, i wasn't able to get the damn thing to compile .pyo's so i gave up. it just errors out. If you can get it to work, this makes development time almost instant as your compile will compile the .pyo's millions of times faster than the Telit would.