Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

How to pull up a pin to power a GPS
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to pull up a pin to power a GPS

by pierrot10 on Tue Apr 21, 2020 3:01 pm

Dear All

I am new with cirucit python and I am trying to use the pin 18, to turn on or off a GPS.
The PGS (GP-735) is powered with the 5V of my Raspberry Zero W.


Here is what I uderstand

Code: Select all | TOGGLE FULL SIZE
from digitalio import DigitalInOut, Direction, Pull
inport board

gps_power = DigitalInOut(board.D18)
gps_power.direction = Direction.OUTPUT
gps_power.value = False # Putt LOW to turn OFF

gps_power.value = True # Putt HIGH to turn ON
# take the vlaue
# turn off the GPS
gps_power.value = False # Putt LOW to turn OFF


It look like the GPS is never powered.

I also saw, there is
Code: Select all | TOGGLE FULL SIZE
switch.pull = Pull.UP


Should I not do

Code: Select all | TOGGLE FULL SIZE
gps_power.pull = Pull.UP
gps_power.pull = Pull.DOWN


What the differences?

Many thnak

pierrot10
 
Posts: 304
Joined: Tue Nov 17, 2015 4:34 pm

Re: How to pull up a pin to power a GPS

by dastels on Tue Apr 21, 2020 4:38 pm

No, gps_power is an output, pullup/downs are only relevant on inputs (ok, on open collector outputs, but I do not believe that is the casue with the GPIO lines).

Since you're powering the GPS with 5v, I suspect it needs a 5v logic signal on the control line. The Pi's GPIO signals are 3.3v. There's a good chance that a logic High (3.3v) isn't getting recognized as a logic High by the GPS. You will need a level shifter to convert the PI's 3.3v logic to the SPS's 5v logic. See https://www.adafruit.com/product/757 for one possible level shifter that would work.

Dave

dastels
 
Posts: 2846
Joined: Tue Oct 20, 2015 3:22 pm

Re: How to pull up a pin to power a GPS

by pierrot10 on Tue Apr 21, 2020 5:53 pm

Hello, That's a good point.
I was powering my GPS (GP-735) with 5V but I moved the power wire to 3V of the Raspberry Zero as, it work from 3.1V to 5.5V

I figured out how to control the power of the GPS with a pin 12

Code: Select all | TOGGLE FULL SIZE
gps_power = DigitalInOut(board.D12)
gps_power.direction = Direction.OUTPUT
gps_power.value = False
gps_power.value = True


Apparently it turn on/off the GPS.

The things I do not understand, when I disconnect PWR_CRTL (the GPS connection to power on/off)
LOW => OFF
HIGH or disconnect => ON

The GPS return me NMEA sentence.
When the 12 is LOW, GPS does not return any things on the Serial and when is HIGH is return uncomplete sentence, like if I am into a bulding. However, it works fine when the PWR_CTRL is disconnected.

b'$GPGSV,2,2,08,16,,,17,18,,,17,32,,,40,50,,,28*75\r\n'
b'$GPGLL,,,,,214901.00,V,N*45\r\n'
b'$GPRMC,214902.01,V,,,,,,,210420,,,N*75\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214902.01,,,,,0,00,99.99,,,,,,*6B\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,4,1,13,01,,,26,04,,,26,06,,,17,07,,,09*75\r\n'
b'$GPGSV,4,2,13,14,,,36,22,,,29,23,,,29,24,,,28*70\r\n'
b'$GPGSV,4,3,13,25,,,26,26,,,26,27,,,27,32,,,40*7A\r\n'
b'$GPGSV,4,4,13,50,,,28*74\r\n'
b'$GPGLL,,,,,214902.01,V,N*47\r\n'
b'$GPRMC,214903.00,V,,,,,,,210420,,,N*75\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214903.00,,,,,0,00,99.99,,,,,,*6B\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,5,1,17,01,,,25,04,,,25,06,,,11,07,,,28*75\r\n'
b'$GPGSV,5,2,17,09,,,22,14,,,35,22,,,27,23,,,27*73\r\n'
b'$GPGSV,5,3,17,24,,,23,25,,,25,26,,,25,27,,,26*7C\r\n'
b'$GPGSV,5,4,17,28,,,27,30,,,27,31,,,36,32,,,40*75\r\n'
b'$GPGSV,5,5,17,50,,,27*7F\r\n'
b'$GPGLL,,,,,214903.00,V,N*47\r\n'
b'$GPRMC,214904.00,V,,,,,,,210420,,,N*72\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214904.00,,,,,0,00,99.99,,,,,,*6C\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,5,1,17,01,,,24,04,,,24,06,,,08,07,,,27*72\r\n'
b'$GPGSV,5,2,17,09,,,22,14,,,36,22,,,26,23,,,25*73\r\n'
b'$GPGSV,5,3,17,24,,,24,25,,,24,26,,,24,27,,,24*79\r\n'
b'$GPGSV,5,4,17,28,,,25,30,,,25,31,,,36,32,,,40*75\r\n'
b'$GPGSV,5,5,17,50,,,26*7E\r\n'
b'$GPGLL,,,,,214904.00,V,N*40\r\n'
b'$GPRMC,214905.00,V,,,,,,,210420,,,N*73\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214905.00,,,,,0,00,99.99,,,,,,*6D\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,4,1,15,01,,,23,04,,,24,07,,,26,14,,,36*79\r\n'
b'$GPGSV,4,2,15,22,,,25,23,,,24,24,,,25,25,,,24*7B\r\n'
b'$GPGSV,4,3,15,26,,,24,27,,,23,28,,,25,30,,,24*74\r\n'
b'$GPGSV,4,4,15,31,,,36,32,,,40,50,,,29*71\r\n'
b'$GPGLL,,,,,214905.00,V,N*41\r\n'
b'$GPRMC,214906.00,V,,,,,,,210420,,,N*70\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214906.00,,,,,0,00,99.99,,,,,,*6E\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,6,1,21,01,,,23,02,,,26,03,,,24,04,,,24*7C\r\n'
b'$GPGSV,6,2,21,06,,,26,07,,,26,09,,,26,10,,,26*77\r\n'
b'$GPGSV,6,3,21,11,,,25,14,,,36,22,,,25,23,,,24*78\r\n'
b'$GPGSV,6,4,21,24,,,25,25,,,23,26,,,24,27,,,23*79\r\n'
b'$GPGSV,6,5,21,28,,,24,30,,,25,31,,,36,32,,,40*73\r\n'
b'$GPGSV,6,6,21,50,,,27*7A\r\n'
b'$GPGLL,,,,,214906.00,V,N*42\r\n'
b'$GPRMC,214907.00,V,,,,,,,210420,,,N*71\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214907.00,,,,,0,00,99.99,,,,,,*6F\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,6,1,21,01,,,23,02,,,26,03,,,20,04,,,24*78\r\n'
b'$GPGSV,6,2,21,06,,,25,07,,,25,09,,,25,10,,,25*77\r\n'
b'$GPGSV,6,3,21,11,,,25,14,,,35,22,,,25,23,,,24*7B\r\n'
b'$GPGSV,6,4,21,24,,,24,25,,,23,26,,,25,27,,,23*79\r\n'
b'$GPGSV,6,5,21,28,,,24,30,,,25,31,,,37,32,,,40*72\r\n'
b'$GPGSV,6,6,21,50,,,27*7A\r\n'
b'$GPGLL,,,,,214907.00,V,N*43\r\n'
b'$GPRMC,214908.00,V,,,,,,,210420,,,N*7E\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214908.00,,,,,0,00,99.99,,,,,,*60\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,6,1,21,01,,,24,02,,,26,03,,,28,04,,,24*77\r\n'
b'$GPGSV,6,2,21,06,,,25,07,,,26,09,,,25,10,,,25*74\r\n'
b'$GPGSV,6,3,21,11,,,25,14,,,36,22,,,25,23,,,24*78\r\n'
b'$GPGSV,6,4,21,24,,,25,25,,,24,26,,,24,27,,,23*7E\r\n'
b'$GPGSV,6,5,21,28,,,24,30,,,25,31,,,37,32,,,40*72\r\n'
b'$GPGSV,6,6,21,50,,,26*7B\r\n'
b'$GPGLL,,,,,214908.00,V,N*4C\r\n'
b'$GPRMC,214909.00,V,,,,,,,210420,,,N*7F\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214909.00,,,,,0,00,99.99,,,,,,*61\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,6,1,21,01,,,23,02,,,24,03,,,26,04,,,24*7C\r\n'
b'$GPGSV,6,2,21,06,,,24,07,,,25,09,,,24,10,,,24*76\r\n'
b'$GPGSV,6,3,21,11,,,24,14,,,36,22,,,24,23,,,23*7F\r\n'
b'$GPGSV,6,4,21,24,,,24,25,,,23,26,,,23,27,,,23*7F\r\n'
b'$GPGSV,6,5,21,28,,,23,30,,,24,31,,,37,32,,,40*74\r\n'
b'$GPGSV,6,6,21,50,,,27*7A\r\n'
b'$GPGLL,,,,,214909.00,V,N*4D\r\n'
b'$GPRMC,214910.00,V,,,,,,,210420,,,N*77\r\n'
b'$GPVTG,,,,,,,,,N*30\r\n'
b'$GPGGA,214910.00,,,,,0,00,99.99,,,,,,*69\r\n'
b'$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30\r\n'
b'$GPGSV,5,1,20,01,,,23,02,,,24,03,,,24,04,,,23*7B\r\n'
b'$GPGSV,5,2,20,06,,,24,07,,,24,09,,,24,10,,,23*72\r\n'
b'$GPGSV,5,3,20,11,,,24,14,,,35,22,,,23,23,,,22*78\r\n'
b'$GPGSV,5,4,20,24,,,23,25,,,28,26,,,24,27,,,22*77\r\n'
b'$GPGSV,5,5,20,28,,,22,30,,,23,31,,,36,32,,,39*7F\r\n'
b'$GPGLL,,,,,214910.00,V,N*45\r\n'


Do you really things is because the pin12? But now my GPS is powered with the Raspberry 3V pin.

pierrot10
 
Posts: 304
Joined: Tue Nov 17, 2015 4:34 pm

Please be positive and constructive with your questions and comments.