To build a low cost tracking system without GPS for Animals and Human Animals.
I know I did not make the finals and have licked my wounds :C I am excited over the progress made. I have used node red and Dweet.io to calculate a Dynamic Threshold to determine if a step has been taken and so calculate distance. The video shows I have not yet incorporated this algorithm for distance for the next longitude or latitude. The path jumps all over my province. But the graph to determine if a step has been taken seems accurate. Yes Outside Weather conditions is accurate - Hurricane Matthew came to visit and the winds are brutal.
So IBM Blue Mix had issues with Red Node all weekend and my app would not connect. I spent Sunday building one from scratch and that would not connect. So time is up. I will continue with this. Guess the apps still are not running this morning:
The project will still continue. One of the challenges will be to test the code which I could not do this weekend. My backup nodes were on the Node Red page. Which I cannot reach. If I click on a route , I receive a message Page Cannot Be Displayed :C
But here is my initial calculations:
R = 6378.1 #Radius of the Earth
brng = 1.57 Math.ATAN(accelY/accelY)
d = Stepper Function
lat1 = math.radians(40.0132482)
log1 = math.radians(-63.772673)
lat2 = math.asin( math.sin(lat1)*math.cos(d/R) + math.cos(lat1)*math.sin(d/R)*math.cos(brng))
lon2 = lon1 + math.atan2(math.sin(brng)*math.sin(d/R)*math.cos(lat1), math.cos(d/R)-math.sin(lat1)*math.sin(lat2))
Convert back to degrees:
lat2 = math.degrees(lat2)
lon2 = math.degrees(lon2)
Stepper Function - Raw Data. I will be using Moving Average for the Threshhold.
(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {const float violence = 1.2;
static BOOL beenhere; BOOL shake = FALSE
if (beenhere) return;
beenhere = TRUE
if (acceleration.x > violence || acceleration.x < (-1* violence)) shake = TRUE;
if (acceleration.y > violence || acceleration.y < (-1* violence)) shake = TRUE;
if (acceleration.z > violence || acceleration.z < (-1* violence)) shake = TRUE;
if (shake) { steps=steps+1;} beenhere = false; }
step = step + 1
So distance would be steps * stride
I am not sure if I will complete this before Oct 3 deadline but I have made progress ! I have switched to Dweet.io to upload the latitude and longitude. If all goes well and the weather is nice I will be able to test my tracker today or tomorrow. I have cloned OpenXC dashboard from FreeBoard to use for this project. More info about OpenXC can be found here. The license can be found here. I have added Outside Weather info and used Dweet.io to upload my longitude and latitude calculations to Google Maps rather than DropBox. I changed the Google Map Alternative -test to Google Map . I also used their excellent speedometer to visualize wind speed. My goal is lean and mean coding and keeping it simple as possible.
Below is my revised Node-Red flow:
My first trial of the Dashboard:
The sensor tag includes MPU-9250 and a 3-axis gyroscope, 3-axis accerometer and a 3-axis magnetometer. This is sometimes referred to as 9 degrees of freedom. If given the initial latitude and longitude can the sensor with some trigonometry predict the next position ? Can you map a moving animals or human animals without GPS ? Can this system assist humans with indoor navigation ? Such a system is called an Inertial Navigation System or Dead Reckoning. A great source of information can be found on Wikipedia.
There are two variables in the algorithm. The first one is easy. We want to calculate bearing or the direction the animal is moving in. The second variable is more tricky. We need to calculate if a step has been taken in order to determine distance.
1. Determine Bearing from the Magnetometer
Here's a screenshot from my Blackberry showing the current position of my location.:
So to use the magnetometer from the sensor tag for bearing , I am using the calculation ATAN2 (Y,X).
Here's my calculation of bearing in Node Red:
If I convert the readings back to degrees than I receive : -63.772673.
2. Calculate Distance
I have used two white papers to try and determine when a step has been taken and then calculate distance .
http://www.eecg.utoronto.ca/~johns/nobots/theses/pdf/2014_hao_yan_masc.pdf
http://www.analog.com/media/en/technical-documentation/technical-articles/pedometer.pdf
My Node Red Flow needs to adjust the threshold to a moving average rather than a static number.
I am using IBM Bluemix , CC2650 Sensor Tag and Raspberry Pi 3 to deploy motion data to the IBM Cloud. I will be using Node Red to wire the data and calculate next Longitude and Latitude based on Motion data . I will also need to predict when a step has been taken for distance. Below is a nice visualization of the motion data from the Sensor Tag. I'm moving the sensor tag around for this demo.
I have installed iot-sensor-tag from Git Hub. Information can be found here. This code is licensed under Apache v2. I'm using the newest Sensor Tag and the Raspberry Pi 3 rather than a Beagle Bone. The program allows me to connect to IBM BlueMix.
My initial Node Red setup looks like this:
The Trigger ISS Distance Check is a flow available from the node red library and triggers a msg payload to tell you how far you from the International Space Station from your current location. It also is a great learning tool for using Math functions in Node Red. You can find the flow here. The rest of the setup is my work. I kept nodes with different calculations for testing. The debug tabs are used to check the output and also check for errors in the flow.
I will be using FreeBoard's Thingproxy to create a data source for the FreeBoard dashboard and map the output on Google Maps. More information on Thingproxy can be found here. The license info can be found here.
I recently upgraded to Raspberry Pi 3 and now I don't need a WIFI or Bluetooth dongle. I had no issues with the new Pi and was impressed with the speed. The only dongle I have installed is for my wireless mouse and keyboard. The Sensor Tag had no problems connecting to the onboard bluetooth.
You can find details of the sensor tag here. The Raspberry Pi 3 details can be found here.
My next log will explain more of the math behind the calculations and the Dashboard.
Hello Brenda
I am trying unsuccesfully to find a way to reply and send you messages. . but it is not working.
Please email me directly at Klein_T84 at GMX dot DE ( Klein_T84@gmx.de )
Try to send me messages even if I do not reply , eventually I will find the way to make the messages work.
I am also an animal lover and this attracted me to look into your project; but the project might also have many other applications which we should explore. Tracking in general is an interesting problem.
Cheers
Thomas
Yes I seem to have missed the first message. You can contact me at armour999@gmail.com. I check my email all the time.
Thanks
Brenda