Goal
--Location information can be obtained by GPS
--GPS receiver kit with 1PPS output "MICHIBIKI" 3 receivers supported
Since I had all the parts at hand, I assembled it with the circuit diagram of the manual posted on the Akizuki-sama site. It seems that the switching diode is actually unnecessary, but I connected it because it also provides insurance so as not to break it.
http://akizukidenshi.com/download/ds/akizuki/AE-GPS_manual_r1.06_s.pdf
The breadboard is vertical because the GPS antenna had to point straight up by default. By the way, it took about 30 minutes for the LED to blink in the initial operation test. I put it by the window, but maybe the place I put it was bad.
To execute the following sources, it is necessary to make UART connection related settings on Raspberry Pi. Please google there: pray: Once that's done, I haven't done much.
I used nmea_plus for NMEA format analysis. SourceDecoder
Maji convenience: point_up:
require 'serialport'
require 'nmea_plus'
sp = SerialPort.new('/dev/serial0', 9600, 8, 1, 0) # see: https://rubydoc.info/gems/serialport/SerialPort#set_modem_params-instance_method
trap 'SIGINT' do
sp.close if sp
exit
end
source_decorder = NMEAPlus::SourceDecoder.new(sp)
source_decorder.each_complete_message do |message|
# see: https://github.com/ianfixes/nmea_plus/blob/master/lib/nmea_plus/message/nmea/rmc.rb
if 'GPRMC' == message.data_type
puts message.utc_time
puts message.active? # false:Data invalid
puts message.latitude
puts message.longitude
#puts message.speed_over_ground_knots
#puts message.track_made_good_degrees_true
#puts message.magnetic_variation_degrees
puts message.faa_mode # A:Independent positioning(Accuracy about 3m), D:Relative positioning(Accuracy 0.About 4m)
puts
end
end
# sp.close <=You won't get here ...
Below is the execution result.
2020-07-15 12:35:37 +0000
true
33.725575
131.64382333333333
A
2020-07-15 12:35:38 +0000
true
33.72558166666666
131.64381833333334
A
By the way, with Google, if you enter latitude and longitude in the search keyword, Goole Map will be displayed at that point. Himeshima Village Office: grinning:
――The pins of the GPS receiver kit are aligned with the pins of the Raspberry Pi (it seems), so I didn't get lost when connecting. ――You can usually find a useful Gem by searching. Let's use Ruby even if we don't mind. ――Ah, I forgot to play even though I connected the 1PPS terminal.
Recommended Posts