GPS Module not sending data on Puck.js

Posted on
  • Hello,
    I bought the GPS Module Ublox Neo 6m (GY-NEO6MV2).
    Then I connected it the following way to the Puck.js:
    GPS Module -> Puck.js
    RX -> D28
    TX -> D29
    VCC -> 3V
    GND -> GND

    The red LED on the GPS module is lighting.

    After that I wrote a small program:

    Serial1.setup(9600,{tx:D29,rx:D28});
    var gps = require("GPS").connect(Serial1, function(data) {
      console.log("DATA"+data);
    });
    

    Unfortunately there is no output in the console. Doe you have any idea what could be wrong? Are there methods to check what might cause this problem?

  • Is RX connected to TX and vice-versa? Always worth checking :)

    However I've noticed that some GPS modules don't output anything at all until they get a lock - so it might be worth leaving the GPS in a window for 10 minutes just to make sure?

    Otherwise maybe detach the RX and TX wires and put a scope (or even just a LED) on them to see if any data is being sent?

  • After some time I get this in the console <- Serial1. I also tried changing the wires. It also does not work. The waiting does not help as well.

  • Are you trying the GPS out while connected to Bluetooth?

    <- Serial1 means that Bluetooth disconnected and the JS console moved over to Serial1, which is the default - then it moved back to Bluetooth when you reconnected. Using Bluetooth.setConsole(1) would fix that - but it shouldn't be your issue.

    If you disconnect the GPS, then short RX and TX together, I bet you'll find that Serial1.println("Hello") will cause data to be printed to the console.

    I'd try the LED thing - but if that's flashing about the only other thing could be that the GPS is using a different baud rate (even if 9600 is the default for most GPS systems)

  • Use this piece of code to check on GPS's output. Upload and start with entering onInit() in the console.

    // monitorPin.js
    var led = LED1;
    var pin = B7;
    var debounce = 5;
    var watchId = null;
    pinMode(pin,"input_pullup");
    function out(evt) { digitalWrite(led,evt.state); }
    function startWatching() {
      setWatch(out,pin,{ repeat:true, edge:"both", debounce: debounce });
      led.set();
    }
    function stopWatching() {
      if (watchId) watchId = clearWatch(watchId);
    }
    function onInit() {
      startWatching();
    }
    

    The red LED - LED1 - comes on. Then you can probe with a wire connected to the pin the GPS output (TX). If GPS sends something, TX is going low for the start bit and the LED goes out. You can play with the debounce value. Espruino is not fast enough to catch all 9600 baud changes and the event buffer may overflow... but you will get for sure some reaction when the GPS actually sends something.

    You may also use some other methods of recording what's going on at a pin, such as the way to record the IR remote control signal (see []()):

    // recordOnPin.js
    pinMode(D28,"input_pullup");
    var d = [];
    var w = null;
    c = 2000; // number signal changes to catch / record
    function record() {
      w = setWatch(function(e) {
        d.push(e.time-e.lastTime);
        if (!(--c)) stop();
      }, D28, {edge:"both",repeat:true});
    }
    function stop() {
      clearWatch(w);
      console.log(d.map(a=>(a*1000).toFixed(1)­).toString()); // display recorded times
    }
    onInit() {
      record();
    }
    

    Looking at the times you may even determine the baud rate.

    (I'm sure you came across my posts about GPS:

    Third one - I guess - is not what you are heading for, because this lead me to this question:

    How do you power the GPS? ...are you using puck's power? ...this could be a reason that the GPS module does not get enough power and puck may even brown out... (when button cell is not fresh anymore). After all, GPS is a bit power hungry when starting... as you can read in the post about powering the GPS by pins in order to be able to shut it down completely...

  • The power might be a problem. If the red LED on the GPS module is lighting constantly, the Puck.js delivers Battery level 0. If the GPS module is not connected it delivers a Battery level of 80. So does the puck not have enough power to use a gps module? What is the recommended battery for it? Maybe Varta?

  • Puck's CR2032 has an average capacity of 225mAh. Capacity is measured with (usually) 10% load, which means, if you draw 22.5mA, it will last 10 hours. In low power / energy context as with Puck, load is even much less and jsut pulsed in order to have a battery last very very long.

    After capacity is exhausted, voltage collapses practically completely (see datasheet).

    Since the GPS needs about 60..70mA peak - you may check this with the data sheet of your GPS module - this is way too much to keep power up. You may get 2 (fresh) alkaline AA / AAA batteries and power with them the GPS. This way puck is the only one sitting on the button cell...

    NOTE: With the GPS powered separately, you need then only three (3) wires between Puck and GPS: GND, RX, TX.

    To use the code snippets in my previous post - #5 - you need only to connect the GNDs; and the wire on the watching / recording pin you connect to TX of the GPS module.


    1 Attachment

    • CR2032.png
  • You may get 2 (fresh) alkaline AA / AAA batteries and power with them the GPS. This way puck is the only one sitting on the button cell

    Thank you. I am quite new at working with electronic components. Do you have a tutorial how to power the GPS module by a battery? I guess that I have to solder something to the VCC pin? Is there something that I should notice?

  • If the modules do not have female or male pin headers and there is enough space, I solder those on. then I use a bread board and some wires with combination of female and male connecters on both sides to connect the components and modules. If there is not enough space I cut a wire with pins in half solder the cut end onto the module. The other end of the wire I plug into the bread board...

    It is also very practical to have a power supply for the board that delivers - in your case 3.3V. Using a DC-DC (buck step down) converter with a USB plug that takes 5V from a USB and produces 3.3V output.

    On many posts you can see how it's done, for example: Breadboard friendly PICO.

    If you have not soldered yet, take some scrap things and practice on them. Go to youtube and search for some instructional videos.


    2 Attachments

    • breadboardWithPowerSupply.png
    • duPontFemaleToMaleBreadboardJumperWire.png
  • The module (if it's this one? https://www.openimpulse.com/blog/product­s-page/product-category/gy-neo6mv2-gps-m­odule/) says it supports input voltages of between 3 and 5v - so you could attach:

    • 3x AA batteries
    • A single cell LiPo battery

    Just be careful not to connect VCC to Puck.js as well - Puck.js only supports input voltages between 2 and 3.6v.

    If you want to connect both to the same power supply you'd do best to use a regulated 3.3v supply that you can then power from anything within the power supply's input range.

  • Just to add to this, if you use something like the MDBT42 Breakout or Pixl.js then those have 3.3v regulators inside already - so you could wire them up and they could power the GPS from whatever power source you decided to use for them.

  • That works well... I have one of these too... and the ON/OFF switch is a great bonus. I do not know the purpose of your project and the overall setup... but "Gehaeuse mit AA Batteriefach" could work as well... or a plain box and simple batterie holder for 3 batteries so you can all fit in a single box (w/ or w/o cutout for accessing/exposing puck.

  • After connecting the GPS module to a battery box the connection to the puck works.
    Unfortunately I only get this data (from inside a room):

    {
      "time": "::",
      "lat": NaN, "lon": NaN, "fix": 0, "satellites": 0, "altitude": NaN 
    }
    

    Any idea how to fix that?

  • Just put it near the window and wait a few minutes. GPS can take a while to get a lock.

    The GPS on your phone gets helped along a bit my the cellular network (providing time & rough location), but a standalone one can't assume anything, so it takes a bit longer.

  • If you cannot find an enclosure with separate battery compartment, you may us a battery box for more cells than you need and use the superfluous for your electronics... similar to what you find in this publication.

    Regarding the time to find first and subsequent fixes / satellites, you may even need to move the GPS antenna/receiver close to a window/onto the window sill with free sight of some sky. When had my GPS 6M receiver not on the window sill/somewhere in the middle of the, it sometimes did not even find a single satellite.


    1 Attachment

    • smartUseOfBatteryBox.jpg
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

GPS Module not sending data on Puck.js

Posted by Avatar for MobiTech @MobiTech

Actions