Introduction: CarTracker
Have you come out of a store and said to yourself, where did I park my car? Well, I have. Now, there are a lot of smartphone applications that can help you locate your car but smartphones are expensive.
So this Lazy Old Geek (L.O.G.) decided to make my own.
HowItWorks:
When you park your car, you press the button, car tracker calculates the car location GPS coordinates and stores them in EEPROM so the car tracker can be turned off. When you’re leaving a store looking for your car, the car tracker reads the new GPS and displays how far from your car you are and points in the direction of your car.
Step 1: Car Tracker Module
NOTE: This PCB was also used in MonkeyDogTracker Instructable:
https://www.instructables.com/id/MonkeyDogTracker/
It does not need an nrf24L01+ module and uses a different sketch.
The display module consists of several major components(purchased on ebay):
A Ublox NEO-6M GPS(see picture)
An LSM303DLHC magnetometer (see picture)
An LCD5110 display (see picture)
A custom Arduino PCB
A Lithium battery (see pictures)
For the battery, I selected a 3.7Vdc Lithium Ion battery also bought on ebay. This is a common type for replacement batteries for some smartphones and tablets. These come in various sizes and capacities. I had to solder a JST2.0 connector to the batteries. I hadn’t really decided on which one to use.
You can also use 18650 batteries.
I also purchased a USB Li Ion 1A battery charger and added a JST2.0 connector to charge these batteries (see picture).
Warning: The standard USB port on a computer will often only put out 0.5A. While this will work, it will take longer. The charging will be faster if a 1 or 2A source is available, such as a USB 2A AC adapter.
Arduino PCB schematic is attached. Power is regulated with a 3.3Vdc regulator. S1 is the pushbutton. U$1 is a pushbutton on/off switch:
Buz1,2 are pads for a buzzer, not used.
There is a connector labeled nrf24L01+, also not used.
There is a USB-BUB type connector for loading Arduino sketches.
The two pictures with displays shows an ‘arrow’ pointing in the direction of the collar and the distance to it.
HowItWorks:
The GPS continuously reads the latitude and longitude of the CarTracker. When the button is pressed, the coordinates are saved to the EEPROM. E.g., this would be the location of your car.
Now, let’s say you walk out of a store and are looking for your car. Power up the CarTracker. Do not push button. The GPS will read the coordinates of the store and will calculate distance and direction from there to the stored location (of the car). The compass will orient the display so the display will point to the car and will display the distance.
Step 2: Arduino Sketches
Car tracker sketch: ArduinoCarTracker.zip
Remember: In the Arduino environment, this a Pro Mini 8MHz 3.3V Board and Processor. But I’m using the ‘standard’ USB-BUB pinout so you need a USB-BUB or equivlaent (PL2303).
GPS: TinyGPS++ library
http://arduiniana.org/libraries/tinygpsplus/
LSM303DLHC: Unfortunately, I can’t remember where I got this Arduino library. I think it was from Pololu. Anyway, I’ve attached the library.
So the Pololu library has a Calibrate sketch to ‘calibrate the LSM303DLHC. Here is the description:
CALIBRATE: This program is similar to the Serial Calibrate example, but instead of printing the most recent readings, it prints a running minimum and maximum of the readings from each magnetometer axis to the LCD5110 display. These values can be used to calibrate the heading() functions and the Heading example after moving the LSM303 through every possible orientation.
I modified it so that the Mins and Maxs will display on the LCD5110. Run this sketch on the CarTracker module. Run sketch, slowly, twist and turn the module in all orientations. Record the Mins and Maxs on the display, then plug them into CarTracker sketch, replacing the values in the following lines:
compass.m_min = (LSM303::vector){-433, -600, -546};
compass.m_max = (LSM303::vector){+570, +488, +579};
This should improve the compass accuracy.
WARNING: When I updated to Arduino to 1.6.1, I had to update Adafruit_GFX and Adafruit_PCD8544 libraries. Here's the latest:
https://learn.adafruit.com/adafruit-gfx-graphics-library
https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library
CarTracker Sketch Summary:
Besides setup() and loop(), I wrote six functions:
void setSetPoint(); // set SetPoint, stores latitude and longitude to EEPROM
void getGPS(); // get current GPS data
void calculate(); // calculate distance and heading
int getHeading(); // get heading using compass
byte getPostion(int); // get position using heading
void displayDirection(); // display info
setup() reads EEPROM set point coordinates, starts GPS, compass, sets up LCD5110
loop() gets current GPS, calculates distance and heading to set point. Displays direction to set point and distance.
if button is pushed, GPS coordinates are stored to EEPROM as set point.
Other Arduino software:
Compass: Simple compass that points North and shows heading on LCD. (Compass.zip)
GPStoLCD: GPS coordinates to LCD5110 (GPStoLCD.zip)
Step 3: Improvements - Conclusions
Possible Improvements:
Some people use parking garages with several levels. The GPS should be able to display the difference in height.
Enclosure for the CarTracker module.
TIP: When first starting, the GPS modules take a while to start receiving. There’s a green LED on the module that will start blinking when it is running but it may take a couple of minutes for the coordinates to settle.
Getting it all to work:
Not Easy.
CarTracker module: The GPS module should blinking. This means it is working. When I’m developing code, I leave the computer connected and send serial messages to the serial monitor like GPS coordinates to make sure they’re working. Then you can send the distance and direction to the serial monitor to make sure that’s working correctly. Once that’s okay, then send it to the LCD5110 display.
Battery life: Battery life can be extended by removing blinking LED from GPS.
Conclusions: Well, it seems to work well. I don’t really use it as it’s rather bulky and requires that I remember to push the button when leaving my car.
By the way, it could be used for other purposes like starting a hike so you can find your way back to the starting point.
22 Comments
7 years ago
Hi again
The resultat of Gps :
Do you think that the reason is the slow pace of the Internet?
In addition that the result starts about 5 minutes marked *.
Thanks for your help.
Reply 7 years ago
Sorry, I don't know what this is?
LOG
Reply 7 years ago
I have a problem in Gps.
I use the same code and the same pins and worked from the same place, but It takes a half hour to begin to show results.
Is the problem in piece of bad GPS ?
Reply 7 years ago
I would guess it's a bad GPS but I've never seen one do anything like that.
LOG
7 years ago
First,Great work.
I have a question, Do you have any idea about how to send location from gps to compass in arduino ?
Thanks for you.
Reply 7 years ago
I'm guessing this is regards to your robot project. What my project does is takes two GPS locations, the desired location and the present location. It calculates the direction between the two and the distance. The magnetometer is uses as an electronic compass and points in the direction that I want to go to find the desired location. I hope this is helpful for your project.
LOG
Reply 7 years ago
Yes, thank you very much
8 years ago
I really like it, but could you make a smaller one because my dad always loses his glasses, haha.
8 years ago on Introduction
I think this is your module:
http://www.aliexpress.com/item/Free-Shipping-Ublox...
I have a 5338 compass module will see if that one is usable...... after all my other projects are finished
Reply 8 years ago on Introduction
Yes, that's the one I'm using. I do not have a case for it. I just used some double stick tape to stick the GPS antenna to the GPS PCB. When the GPS is receiving, a green LED flashes. but it takes another minute or two to really lock it down but this is from a cold start. "Accuracy" isn't that great especially indoors. But for this application, 10-20 feet should be close enough to spot your car.
LOG
Reply 8 years ago on Introduction
Tnx :-)
8 years ago on Introduction
nifty. just a question, the USB connection doesnt really take usb signals i presume? it is a TTL FTDI connection
Reply 8 years ago on Introduction
That is correct. For al of my custom Arduino PCBs, I don't add the FTDI type device but use something I call USB-BUB:
https://www.instructables.com/id/Arduino-USB/
This is the same connector/pinout used by the RBBB:
http://moderndevice.com/product/rbbb-kit/
LOG
Reply 8 years ago on Introduction
Thanks. I use one of those USB-TTL modules that now cost less than a dollar in china and that has the standard FTDI (6-pin), that sort of looks like the connector you have. One with the DTR ofcourse. dont want to keep pushing the reset during uploads :-)
Reply 8 years ago on Introduction
That should work. I'm using some of the older PL2303 with 5 pin but I add another pin for DTR. It's a lot harder to do for this OLD guy.
LOG
Reply 8 years ago on Introduction
have one of those older ones as well. didnt even try to add the dtr pin. super smd and old eyes.I use it for software serial on e.g. attinyUse the newer one with 6 pins for the rest. The pin lines up perfectly with e.g. the pro mini
Reply 8 years ago on Introduction
I just smoked one of my PL2303s. I still think I have 3-4 more around somewhere. But it would be nice not having to solder that SMD DTR pin.
LOG
Reply 8 years ago on Introduction
yes, i can imagine :-)
but the ones with the dtr pin broken out arent that expensive
8 years ago
Nice idea!
How big is this device?
What's the battery consumption?
Reply 8 years ago on Introduction
It's about 4" x 2". Battery consumption would depend on the battery but I never did any long term testing.
LOG