Programming GPS Tracker to send Location to Adafruit MQTT | ESP32 Projects | IOT Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so in our last video we learned how to use this wealthtrack V4 to track our real-time location with the help of its built-in firmware and the velutron's own mobile application and in that same video I told you that this board is completely programmable as well so now in this video I'll let you know how to program this valtrek V4 using Arduino ID I'll let you know how to provide some 80 commands so that same model to do all the tasks and in the end I'll be making a complete code to send my real-time location to Adafruit i o dashboard using the amput protocol and I'll be sharing all those code files with you so that you can try the same project on your end as well so this video is for all those DIY enthusiasts and hobbies to watching my videos so let's just not waste any more time let's get straight into it but wait let me thanks my sponsors first this video is sponsored by LTM which is a PCB designer based software company now LTM is not just another PCB designing software rather it's a world class and award-winning PCB designing tool that has some features like Advanced interactive routing with autocomplet station any angle routing bus routing face and line tuning follow me more and much more which makes it's an ideal choice for PCB designing by a lot of companies along with this they do also have LTE 365 that not just covers the PCB designing part but also helps with design sharing via web sharing designs to Mechanical team for product design centralized cloud storage and a lot more and along with all this they do have a very useful search engine made just for electronic components called as octopart using octopart you can search for any components and you would be able to compare its price and availability around the globe not only that you can also get the details about the components like its specifications and data sheet all at one single place so LTM provides everything to make your production task a lot easier so do try out all these Services right now as you'll be getting a free trial version by just clicking the link match in the description happy making so now to upload the code into the Valtech V4 will first of all open up the Arduino IDE So currently I'm using the version 1.8.19 and the one thing which you need to be sure about is your board's package of esp32 board should be updated to the latest version so if I let you know the version which I'm using then it'll type out esp32 and currently I'm using the latest version which is 2.0.12 okay so make sure you have this version or higher order version than this click on the close button and after you update this boards package the new board will appear into the esp32 boards section which is well Trek V4 VTS esp32 C3 so this is the board which we need to select to upload the codon to the Val drug V4 so I'll select this board and now uh talking about the core part then here wealthtrack company has already provided one sample code with all the initializations and everything on their official website so I'll let you know where is that code so yeah here is that particular course I'll simply copy this code and I'll paste it here inside my Arduino IDE now here all the pinouts are defined here like the uart PIN for Sim module for like motion sensors and every pins are defined here so you can check that out here and till the setup part they did all the initialization so what I'll do is I'll keep the setup part as it is and for the loop part I will remove all these things because they are performing a particular uh you know task for connecting to a particular server and stuff like that but what what we need is we need to use this board this wealthtrack V4 using our own 80 commands and for that I removed this Loop part and in this Loop part I'll add this much line of code so this code was copied from the multi-serial example code in Arduino IDE so this will help us to send the 80 command and see its response onto our serial monitor okay so this is the code where I'll be providing this example code in my GitHub repository whose link is down in the description okay so I'll keep this code as it is and now I will select the right board which was already selected while track V4 and I'll select the right com Port which is showing here as esp32 S3 but yeah this is the board this is the C3 board I select this and I'll straight away hit the upload button now let's just wait till the code get uploaded okay so the code is successfully uploaded or open the serial Monitor and okay we are getting the response onto the serial monitor so let's just wait for all the setup part uh to be executed by this code okay so the setup process is now completed so I'll type 80 here and as you can see I got the response as okay so we are successfully able to communicate with the same module using the 80 commands I just try out a couple of more 80 commands so I'll type at 80 plus cops is equal to question mark which will let us know the available networks okay so we got the network so it says VI India so here I have attached the vi SIM card and it is getting the network from VI India and if I check out the signal strength by typing the command as 80 plus csq question mark okay it is 80 plus csq only okay so we are getting the received signal strength indicator as well so the SIM card is properly working it is properly connected with the uh cellular network and the 80 commands are also working now let us move ahead and see how to get the GPS location using the at command so for that the First Command which you need to enter is cgnss pwr so when I press question mark as you can see it is written as 0 comma 0 comma one now we need to make it to 1 comma one comma one so I'll type at uh type as 80 plus CG and SS pwr is equal to 1 comma 1 press enter it says okay but still we need to wait till uh the response cgns power ready let's just wait for that command okay so we got the cgns power ready so initially I was not getting so I reseted this uh using the command 80 plus react then again I provided this command and now I got czns power already now this is a very important important steps so until unless you don't get the czns power ready you won't be able to do all the GPS related tasks okay so once we got there now we are good to go to type and command to get the location so I'll type 80 plus cgps info okay and I press enter as you can see I'm getting the latitude and the longitude data here okay so that's how you can get the location coordinates using these two ad commands Okay so now I don't need to do the seasons power once again I can type CJ CG and cgps info and I will be getting the real time coordinates now this coordinates are of course not in the proper format to be sent to a Cloud Server so we need to do two steps now we need to convert this format to another format which is supported by the Cloud Server and secondly we need to embed the code uh about like impurity based code to send our data to Adafruit IO server so first of all let me show you how to set up the Adafruit IO account and then we'll move on to the code part okay so first of all you need to make the Adafruit IO account I'll leave its link down in the description so it's an mqt Cloud uh broker okay so I already made my account and after making your account go to uh feeds after that click on new feed and type as GPS loc which stands for GPS location click on the create button and we successfully created a feed after that you need to go to the dashboard click on the dashboard name which in my case the welcome dashboard and here I'll click on create new blog and here I will be adding the map widget and select the GPS loc as the feed name okay block title will be map and click on the create block okay so this is the map now here we can edit the map Lookout so I'll click on edit layout click on the edit button here edit block click on next and here let's select the street map and here also street map Okay click on update block and as you can see we got a street map view okay so I can click on the save layout button and I can know Zoom it in and I can see the location so with this we successfully created the feed and the location widget on our Ada from i o dashboard and that was it about the data for dial configuration now let's move on to the code part okay okay so here is the code I wrote for sending the location data to our Adafruit i o broker now there are a couple of changes in this code so let's just try to understand this code carefully so first of all all the necessary configurations for configuring are valtrek V4 device which I taken from the example code itself now here the APN name is written as www because I'm using the vi SIM card whose APN name is www you can search for the APN name of your network provider on Google and provide it here after hearing to write as io.datafruit.com so in case you are using the same broker the address will be the same now here we need to provide the topic name which in my case is Sachin underscore SMS forward style feeds forward slash GPS loc forward slash CSV now here Sachin underscore SMS is nothing but the username of my account which you can get it by clicking on this key icon and here is your username so you just need to replace this with your username then forward slash Fields will be the same then here is the name of the feed which we have set to GPS loc and forwards let's see yes we now here we need to provide as forward slash CSV whenever we need to use the map widget so this is a mandatory condition so this is the topic GPS after that again the necessary you know configurations the setting up of this valtrek V4 device so I just skip everything and let's just jump directly to mqd connect function here you need to do some changes according to your account so in this here you need to provide the username and here you need to provide the AIO key which you can get it from here itself okay this is the username this is the AIO key and you need to provide those credentials here to make it work in your account okay so that's the mandatory change then the setup part is same as before which we have tested in the example code of this and here what we are doing is along with all this uh basic commands we are also providing cgns power is equal to one comma one now I already told you before that we need to provide this command whenever we need to use the GPS related or location related or 80 commands Okay so once we get the confirmation like cgn is power ready then we are good to go for the locations okay so we are waiting for the response from the uh no this uh well track V4 and as soon as we get the response we are good to go to get the location so here we have made the function called as get location which is passing on the command C GP es info which will give us the response okay so after giving us the command we'll be waiting for the response and here is the tricky part so the response which we are getting is in the format called as ddmm.mmm now in case if you don't know what is this DD and mm let me make your family about all these things so GPS coordinates are given in way different formats so the format which is given through this wealthtrack V4 is in this format called as ddmm.mmm this is the decimal uh minutes format so this is the format which we are getting from the uh the Sim module but uh the Google Maps API or the Adafruit map widget doesn't accept this format rather it wants the format of decimal degrees which is here okay so we want this particular format of location so we need to convert those minutes into uh decimal degrees and it has couple of formal like you need to split the data divided by 60 and stuff like that okay so all those Division and splitting and you know combining all the strings is done here so we are you know converting the longitude value here and we are converting the latitude value here like the format conversion is happening here and after we convert the format we are creating a string which is which is containing a data of speed comma latitude comma longitude comma altitude now this format is accepted by the ew fruit map widget so we need to provide the data in this format only now here in our case speed and altitude value is not provided from this board so we are providing the value as by default zero okay and after that in between we are providing the latitude on the longitude value which are converted by these all formulas and finally we are sending like publishing the data to the topic GPS okay uh this whole coordinates are saved in the character pointer called temp in the end we are publishing that data and this data is published after every 10 seconds after every 10 seconds will be getting a new location data on our map widget like on our very own cloud without using the Valtrex own mobile application without paying to their services okay so that's the basic code okay and here also we are using the mqd connect function to establish the communication with the amput cloud which is called inside the main Loop only let me show you okay so here is the impurity send data which is responsible for me you know establishing the communication with the Adafruit mqd broker so that was all about the coding part of this whole our own tracker okay so what I'll do now is I'll select the right board which is hopefully selected and right on board is also selected I'll straight away hit the upload button now currently I have placed the tracker outside the window so that it can get the GPS coordinates as we know GPS doesn't Works indoor okay so let's just wait for the code to get uploaded okay it's done uploading I'll open the serial Monitor and let's observe what data we are getting here so here is the data location data coming from the Sim module and after that we are converting it to our required format so here is the longitude and here is the latitude which we are ultimately sending it to the Adafruit IO server and its status is published okay so it is publishing the data now let's just move on to the Adafruit IO server and let's just observe if we are getting the data or not okay so we got a DOT here okay so that means it is tracking a location so my device was turned on for quite a couple of time ago so it is constantly sending the data and it is making the track of the different different dots okay so basically here is the techies studio and I am getting the data from this model which is sent to my data flow dial server and now let me just you know fix this device like packed with the battery and let's just take it on a long ride and test it with our own Adafruit IO dashboard thank you foreign so that was the second part of this wealthtrack V4 where we tried to program this board to send its real-time location to a third-party platform in our case was Adafruit IO and similarly you can use this technique and use that code to transfer the location to maybe your own cloud as well in case you have well I'll be providing this mqtt based example code for this device down in the description of this video so do check them out and also we are selling this valtrek V4 Hardware through our website with both the options like with casing and without casing again its link is down in the description of this video so do check them out and yeah that was it about this video do hit the like button if you really like the product and also share your thoughts regarding this product or this video down in the comments of the video like will you be going for this product or rather you'll be preferring making your own GPS based product but share your thoughts down the comments of the video and we are definitely coming up with a more GPS tracker based DIY project that is coming soon on our channel so make sure to subscribe to channel to see something new in the field of GPS trackers and yeah that being said I am just ending this video here and now just wait for my next video Until Then explore learn share with me techie SMS [Music] foreign [Music]
Info
Channel: techiesms
Views: 10,936
Rating: undefined out of 5
Keywords: techiesms, electronics, electronics projects, Valtrack v4, Valetron, GPS tracker, 4g gps tracker, Adafruit io, Adafruit MQTT, ESP32 projects, ESP32 c3, Car tracker
Id: dtbMi1hgzao
Channel Id: undefined
Length: 15min 27sec (927 seconds)
Published: Sat Sep 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.