Asset Tracker Library Issues


#21

Hello Everybody,

I have some results finally :smile: and I am pretty happy with it. But before I show you the results a little refresher on what I was trying to achieve and why this thread was created because there have been quite a few posts in between so it might not be clear for a new reader what I am talking about.

Alright, I am working on an application that requires tracking users trips on vehicles accurately. I was using publishing location updates on fixed time intervals but this was resulting in lot of data consumption. I then moved to distance based approach where asset tracker shield would publish a location update every 200 meters. This was much better than time based approach because now if vehicle stopped there would be no publish events. Still I felt that I am publishing more than what was needed. For example, if I just sent a location update whenever vehicle steered onto a new road I will be able to trace the trip route perfectly and with minimum location updates thus saving lots of data.

I was having trouble detecting steering angle or vehicle heading delta so that I can publish an event. I was trying to extract this information from accelerometer readings but these were not reliable and were instantaneous so being able to read the right data at right time was a challenge. Lot of different ways were discussed here, but one from @harrisonhjones seemed simple enough.

So I went ahead and added a $2 HMC5883L magnetometer to the asset tracker shield and like always there was a library from Ada Fruit already available in Particle libraries section to use it. Adding both hardware and software was very simple. The firmware is now using a mix of distance based and heading angle based approach and the results are pretty amazing. Below are some screenshots of a route I traced and visualized on an android app using Google Maps.

Blue dots represent location update on heading angle change.
Green dots represent location update after 200m from last update.

Now I get very good location update on the corners. On roundabouts as you can see it does not publish all the eligilble points. I guess this has got something to do with the way I have setup the loop() code. I am pausing for a second between every iteration and I think while on a roundabout the angle is changing continuously and I miss some updates during the wait period. I might lower that interval to something like 200 ms or so and see if it improves the granularity. Overall I think it still gives a very good idea of what path was taken. Had it been just distance based, the route line segment would have cut through the roundabout on to the next road.

I hope this is useful for others who are dealing with similar problems.

Thanks everybody for your help and valuable suggestions. Particle community rocks !!!


#22

Ohh I forgot to mention that I was also concerned about the space my final hardware design would take up because I am also using other components (relays and buck regulators) with asset tracker shield. The HMC5883L is a very small sensor (smaller than a postage stamp) and can easily be soldered into the prototyping are made available on the shield. So all in all it is a good fit for my problem in every aspect :smile:


#23

@noumanh, perhaps I don’t understand but it seems that you are publishing MORE data with the magnetometer than with the 200m rule. Was the goal not to publish so much data?


#24

200m rule alone would not produce accurate path as it would cut through roads and if you are taking a u-turn it would not mark points at the right place and the distance calculations would be very different from actual distance traveled.

With heading change rule, you not only produce accurate path but also lesser points. On a route with smaller distances this may not seem obvious like the examples above. But imagine if each road in the example above were few hundred kms long, heading rule would have produced same number of points as it has produced for a shorter path. Number of location points published with heading rule are independent of the length of the route. On the other hand with 200m rule the number of published points would increase linearly with the length of the route plus inaccuracies in calculating actual distance traveled and tracing actual route path.


#25

@noumanh, great explanation, thanks!


#26

Happy to see you found a hybrid solution for this problem.

How did the metal filled vehicle affect the accuracy of the digital compass? I have a digital compass before for a solar panel tracking design and anything metal threw the readings off big time. Not sure if you care if the readings are accurate or if you’re just looking for the changes in the compass reading regardless if the compass direction is right or not?

Did you ever calibrate the compass chip?


#27

You guessed it right, I am not concerned about the accuracy of the compass and I haven’t calibrated it as well. My only concern was to detect the delta change in heading and it is working fine for this. I tested putting the sensor in different orientations as well and it was still able to detect change in horizontal delta.


#28

@noumanh I am playing with HMC5883L but I cannot find the Paricle library you mentioned. Can you pont it to me please?

Thank you
G.


#29

Is it pheraps Adafruit_HMC5883 1.0.8 ?? :slight_smile:

(I could not find it bevcause I was looking for HMC5883L with the final L)


#30

Yes thats the one. Sorry for the late reply, I was on Holiday. Did you manage to get it working?