HC12 with GPS Shield Project Problem

Thread Starter

sjp187

Joined Apr 12, 2018
4
Hi All,

I've just been trying out the project from @Mark Hughes , uploaded here, using a HC12 to transmit GPS locations.

I’m using a set up whereby I have one Arduino, GPS Shield and HC12, attempting to transmit to a HC12 connected to another Arduino. When using the GPS Shield in standalone mode, over Port Monitor I can see it successfully creating NMEA sentences with all the GPS locations on. Also, when I just get the HC12s to communicate (as per this project), that works fine. As soon as I try and upload Mark's code to the Arduino to send the GPS over the HC12, it seems to error. What I see in Port Monitor for the GPS is just maybe a line and a half of GPS sentences (not pre-fixed by the string "Local GPS" as the script should create), and then the PM goes blank. Nothing is received on the remote HC12. I've attached a screenshot of the local GPS Port Monitor.

Does anyone have any ideas as to how I could debug this?

My current set up:
Both Arduino's powered by external 10V DC adapter (although the same result occurs when boards are just powered by USB)
One 220 uF capacitor resistor on HC12

Any help or advice greatly appreciated!

Cheers,
Seb

ArduinoSS.PNG
 

ericgibbs

Joined Jan 29, 2010
18,766
hi 187,
This section of Code is supposed to test for 'GGA', your print out shows all the GPS messages.
It also appears to have not got a valid satellite lock.
Perhaps Mark can explain the problem.
E

if (GPSEnd) {
// Options include GPRMC, GPGGA, GPGLL, etc...
if (GPSReadBuffer.startsWith("$GPGGA")) { // Look for target GPS sentence
if (GPSLocal) {
Serial.print("Local GPS:"); // Send to local serial port
Serial.print(GPSReadBuffer); // Send local GPS
} else {
HC12.print("Remote GPS:"); // Local Arduino responds to remote request
HC12.print(GPSReadBuffer); // Sends local GPS to remote
}
GPSReadBuffer = ""; // Delete target GPS sentence
HC12.listen(); // Found target GPS sentence, start listening to HC12 again
} else {
GPSReadBuffer = ""; // Delete unwanted strings
}
GPSEnd = false; // Reset GPS
 

Mark Hughes

Joined Jun 14, 2016
409
Hi @sjp187,
Thanks for starting the thread! So, it looks like you have a couple of problems. As Eric Gibbs pointed out -- you don't seem to have a valid GPS lock. The satellite signal is quite weak and often times will not work indoors.
$GPGGA provides fix information
From freenmea.net:
1 2 3 4 5 6 7 8 9 10 | 12 13 14 15
| | | | | | | | | | | | | | |
$--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh
1) Time (UTC)
2) Latitude
3) N or S (North or South)
4) Longitude
5) E or W (East or West)
6) GPS Quality Indicator,
0 - fix not available,
1 - GPS fix,
2 - Differential GPS fix
7) Number of satellites in view, 00 - 12
8) Horizontal Dilution of precision
9) Antenna Altitude above/below mean-sea-level (geoid)
10) Units of antenna altitude, meters
11) Geoidal separation, the difference between the WGS-84 earth ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level below ellipsoid
12) Units of geoidal separation, meters
13) Age of differential GPS data, time in seconds since last SC104 type 1 or 9 update, null field when DGPS is not used
14) Differential reference station ID, 0000-1023
15) Checksum"
$GPGSA provides overall satellite data
" 1 2 3 14 15 16 17 18
| | | | | | | |
$--GSA,a,a,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x.x,x.x,x.x*hh
1) Selection mode
2) Mode
3) ID of 1st satellite used for fix
4) ID of 2nd satellite used for fix
...
14) ID of 12th satellite used for fix
15) PDOP in meters
16) HDOP in meters
17) VDOP in meters
18) Checksum
"
$GPRMC provides recommended minimum data
"
. 1 2 3 4 5 6 7 8 9 10 11 12
| | | | | | | | | | | |
$--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh
1) Time (UTC)
2) Status, V = Navigation receiver warning
3) Latitude
4) N or S
5) Longitude
6) E or W
7) Speed over ground, knots
8) Track made good, degrees true
9) Date, ddmmyy
10) Magnetic Variation, degrees
11) E or W
12) Checksum"

So -- the first thing I'd do is move outside -- work on a laptop where you have a clear view of the sky. Alternatively, string a USB cable out the window. You want to see those sentences properly populated with information. Sometimes it takes several minutes for the GPS antenna to achieve a lock.

As for the port monitor failure. My best guess at this point is that perhaps the current limits on the USB bus are being exceeded. I would always power the transmitting unit with external power

Do you happen to have an oscilloscope available to you?

Also -- do you mind photographing your wiring setup? I'd like to double check that the wires & capacitor are properly connected.

Thanks!
Mark

@Raymond Genovese @DickCappels Do you have any ideas why the port might shut down?
 

Thread Starter

sjp187

Joined Apr 12, 2018
4
Hi @Mark Hughes and @ericgibbs ,

Thanks both for engaging with my question.

I have rectified the GPS fix issue (I had assumed that because the GPS was kicking out NMEA sentences anyway it wouldn't matter in terms of testing the code), but this problem still seems to persist.

I have included a photo of the wiring below. I was prototyping and therefore the capacitor is not permanently affixed, but is in constant contact with the 5V and Gnd lines.

I've tried powering the HC12 from an entirely separate Arduino hooked up to to DC power also, but to no avail!
ArduinoWiring.jpg
 

Thread Starter

sjp187

Joined Apr 12, 2018
4
I don't have a multimeter but happy to get one - should I simply be checking the volatage across the VCC and GND pins?
 

Mark Hughes

Joined Jun 14, 2016
409
@sjp187,
Seb -- this is a tough one. (Intermittent problems are always the worst problems to solve in my opinion). Usually in a situation like this, I always start with the low hanging fruit -- in this case, it's the capacitor. Even though the metal is touching, doesn't mean it's doing it's job. Oxidation on the leads of the cap and the HC12 male-header can provide enough resistance to render the cap useless. That capacitor needs to have it's leads cleaned (to remove oxidation that acts like a resistor) and then soldered as close to the HC12 as possible. It also looks like you're tapping the 5V line -- in which case you need a diode to drop the voltage (so you don't burn up the HC12 on transmit -- which you might have already done -- I believe I mentioned it in the first article). You can get a small piece of 0.1" stripboard and solder on a 5-pin female header, a 5-pin male header, the capacitor, and the diode and put it in line with the HC12 and the wires. While you're at it -- throw in the smallest ceramic capacitor in your toolkit -- place it in parallel with the electrolytic capacitor.
Is that a legitimate Arduino board (if so which version)? It looks it might be a knock off (which could be a problem). Can you remove the shield and take a pic of the board by itself? Do you have a legitimate Uno R3 you could use or a Sparkfun Redboard?
Is there any chance you can get your hands on an oscilloscope for a short period of time? I don't think this is necessarily a problem that a multimeter can solve.
You tried the codes leading up to this one and had success, yes?
We'll get the problem solved -- but it might be a bit.
Best,
Mark
 

Thread Starter

sjp187

Joined Apr 12, 2018
4
Hi @Mark Hughes ,

Thanks again for a comprehensive reply - I'll start exploring those options and get back to you after trying a few. Pretty sure the HC12 is ok - I keep periodically going back to your original standalone HC12 project to test it, and it's both transmitting and receiving ok, so I don't think it's burnt out. I'd been switching between the 3.3 and 5 V pins, just trying to debug, but will get a resistor fitted. I'll also ask around for an oscilloscope.

It's not a genuine board, but it is one supposedly compatible (link here). My project requires around 15-20 of the Arduino/GPS/HC12 configurations, very few of which I'm likely to be able to retrieve after deployment so I was hoping to keep it really low cost, but if I need genuine Arduino boards then I'll have to rethink!

I'll try some of your suggestions, including getting hold of a genuine board, and get back to you! Thanks for your time again!

Cheers,
Seb
 

ericgibbs

Joined Jan 29, 2010
18,766
hi sjp,
I am using clone Arduino's UNO and NANO in combination with the GPS module and HC12's, no problems.
Arduino's 5V, 9600 Baud.
Also using the PIC MCU range with those same modules, OK.
As Mark points out good decoupling/smoothing is required on the modules.

E
 

Mark Hughes

Joined Jun 14, 2016
409
@sjp187,
I've also had success with the sparkfun Redboard. I have used other clones with mixed success. I remember one didn't work because the female header was missing pins -- I don't even know how that happens during manufacture!
I'll look forward to hearing from you!
Best,
Mark
 

Mark Hughes

Joined Jun 14, 2016
409
I don't have a multimeter but happy to get one - should I simply be checking the volatage across the VCC and GND pins?
@sjp187,
Any updates? I see that I missed a few of your previous questions. It's not a matter of just looking for a voltage. When you put a scope on a power line, you're looking for changes and irregularities -- glitches, etc... Glitches on the USB line, glitches on the HC12 power line, glitches on the Arduino input, glitches on the Arduino output.
What you're looking for on the signal pins is that the digital transitions look square-enough -- indicating that the logic levels are properly transitioning for the proper amount of time. Sometimes you see that you're not approaching logic high as you should (see my attached graphic). Anyhow, an oscilloscope shows you things that a multi-meter won't. I have both, but my goto on low-voltage circuits is the scope.
I haven't ever used one of these -- but they look like they'd do the job just fine: https://www.seeedstudio.com/DSO-Nano-v3-p-1358.html

Once you learn how/when to use an oscilloscope, you'll wonder how you ever got by without one.
Best,
Mark
 

Attachments

Top