mm0tjr
Posts: 2
Joined: Wed May 22, 2019 1:01 pm

georeferencing a voltage

Wed May 22, 2019 1:16 pm

I am considering a recreational project to survey a fairly wide area. I have a magnetometer-type instrument whose output is a variable voltage, and I would like to automatically map that voltage as I walk around the area. to do this, I need to record the voltage, and the latitude and longitude every n seconds.
I am envisaging a device (rPi) which is connected to a GPS for simple position fixing, and my magnetometer. it will write a line of data on each cycle to as ascii file so that I end up with something like:

time,lat,lon,value <crlf>
time,lat,lon,value <crlf>
ad infinitum.

this (or something very like) must have been done before, please can anyone give any pointers?

whilst I am not averse to making this my own project, the main drive behind the idea is to give some treasure-hunting objective to a family camping expedition. (rather than spending some quality time in the workshop!)

on reflection it seems not unlikely that this may be achievable with a smartphone and some existing app. the GPS accuracy does not need to be great.
would be interested to read any comments.

PhatFil
Posts: 1197
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: georeferencing a voltage

Thu May 23, 2019 2:12 am

i too have never done anything like what you suggest but it should be fairly straight forward.
Sounds like a system to Log data from 2 different sources in a single record,,,

Lots of ways to do it too you could use sophisticated tools like node red and databases like mysql

But its probably easier to find a road map if you look for python scripts to read your data inputs and write data out to a text file in csv format, providing you with a spreadsheet friendly data set,

You can attach a gps module to a pi easily enough either via the usb, gpio, or even bluetooth and google should supply you with lists of projects to browse to get the idea and select one to perhaps clone and modify.
"Pi GPS diy" should generate a reasonable starting list from a search engine.

to use your phone and its gps capacity perhaps IFTTT could provide the glue to take your gps data and publish it via wifi/mqtt to subscribers on your pi?? However latency may be an issue in matching a position with a voltage reading? you may need to consider which metric drives the logging?

perhaps the most challenging aspect will be taking a good voltage reading??? my very limited experience with metal detectors is that the needle bounces all over the range, so perhaps timing and sampling strategies could need investigating/testing ?? and if so have an impact on how frequently you can generate voltage data to pair with a gps reading?

And you will need to interface additional h/w to read an analog input, but again its well documented and if you have unexpected and undocumented problems when cloning a project you found online .. Post back detailing the issue for support.

I suspect there will be a couple of gotchas involved in your development probably not those i have guessed either but if so dont let them phase you..

Also when selecting a web project to copy and experiment with be mindful that the Pi and its OS have been updated and upgraded over the years and projects written a couple of years ago may well reference software and perhaps h/w that has been replaced or upgraded and is different from the guide your following. SO try and find guides published in 2019, Or have been updated to include any changes needed to keep upto date and current, (a changelog should be evident if a guide is maintained to remain current).

hippy
Posts: 5165
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: georeferencing a voltage

Thu May 23, 2019 11:58 am

Can't help with doing it but I would recommend splitting the output to separate files, closing one then continuing with another. That way, if anything goes wrong, you won't lose everything.

It might also be worth storing your data as changes from previous readings to reduce storage space, with a raw data sample every so often, also 'just in case'.

PiGraham
Posts: 3530
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: georeferencing a voltage

Thu May 23, 2019 1:58 pm

What sort of magnetometer do you have? What are you hoping to detect? Geological features? Hidden magnets? 'Ley lines'?

If a mobile phone sensor might work for what you have in mind take a look at this.
https://play.google.com/store/apps/deta ... eter&hl=en

It doesn't display a geographical map but it might be useful as prrof of concept and it can export data as CSV which you may be able to plot on a map.

There are some significant advantages to using a mobile phone for something portable like this since they have good battery systems, power management, sensors and display all built in ready to go. Given your priorities maybe you can connect your megnetometer to your phone and create an app that paints an overlay on Google Maps. At its cruest that could be an ATTiny85 Arduino (e.g. Digistump/digispark) configured as a USB HID device to the phone's USB port. Use the ADC to measure the voltage and send the value as keystrokes that the app decodes.
Last edited by PiGraham on Tue May 28, 2019 5:23 pm, edited 1 time in total.

mm0tjr
Posts: 2
Joined: Wed May 22, 2019 1:01 pm

Re: georeferencing a voltage

Mon May 27, 2019 5:20 pm

I thought the phone idea was a good one too, I cannot BELIEVE that there is not already something to do this.
I have a Whites TM808 metal detector and the idea is to search a little offshore islet for "pirates treasure". we could just search it and put in flags where the hot spots are. but the objective is less the actual treasure and more the interest in the islet. I wanted to make a heatmap of the islet.

just cant believe that I seem to have identified a gap in the market: a phone app that could georeference let's say a 0-10V level every n seconds. and paint the data in.
you could choose how often you want to poll, and choose how wide the "paintbrush" is
you could sell an array of "adapters" for the phone.... seems quite marketable to me.

I mean, the phone can already digitise sound, magnetic field.... other things, and it has GPS, a screen, maps batteries, is completely mobile..... seems a no brainer.

think I might get along faster by programming an android app. where to start with that?
(a more experienced friend has advised me that phones are difficult to program)

PiGraham
Posts: 3530
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: georeferencing a voltage

Tue May 28, 2019 10:38 am

mm0tjr wrote:
Mon May 27, 2019 5:20 pm

think I might get along faster by programming an android app. where to start with that?
(a more experienced friend has advised me that phones are difficult to program)
You could check out https://appinventor.mit.edu/explore/ for something easy to get into but I don't know of would be any use for what you want.
Buttons and common GUI elements are easy.
There is a 2D map component http://ai2.appinventor.mit.edu/referenc ... s.html#Map

and that supports adding markers as pins or graphics.
There is a location component that can give you GPS coordinates, accelerometer.There is an extension to access the magnetometer and read x,y,z or abs magnitude of magnetic field.

You could try Kivy, which runs on RPi, Android and others. Code in Python.
https://kivy.org/doc/stable/guide/android.html

Maybe something like Godot https://www.google.co.uk/search?q=godot+android is an option for displaying objects and moving around a map.

Return to “Other projects”