Introduction: "With U Smart Sole" DIY GPS Embedded Smart Shoe Sole #MITBetterWorld

About: Brain of an Engineer, Heart of an Artist. I love building creative tech!

What do you do when someone is chasing you or you are lost? Cross your fingers? Don't.

When you are in trouble, just cross your feet [in a special way] and your location is sent to your family members. Wait there's more! Even the family can get your location just by calling the shoe. When you call the SIM in the shoe, the shoe automatically hangs up the call and reverts back its current GPS location via SMS.

The soles are so comfortable, the wearer doesn’t even notice that they are in there!

The ‘With U’ smart soles work on a special algorithm which features a unique gesture recognition pattern[to detect the crossed feet].When you cross your feet, that activates the process of sending the current GPS location to the remote server. And you can check the real-time updates on a Google Map.

My prototype is made of MDF wood and I’m looking forward to making the design in a more reliable material which suited to the organic shape of the human feet. I have the 3D CAD model ready. But due to lack of access to 3D printing technology nearby my place, I haven't printed it. I have also made a complete circuit using Atmega 328P and SIM 808 instead of using different ready modules. I am still improving the design. WIP.

~

Snapchat and Instagram: @chitlangesahas

I'd love to connect with you guys on Snapchat and Instagram, I document the experience, learning lessons and also answer questions on those platforms. Looking forward to connect! Here is my username for both: @chitlangesahas


Snapcode

~

What Impact can the "With U sole" will have on the world?
Think of these... Our Grandma and Grand pa's suffering from Mental disorders like Alzheimers, Thousands of Missing Children and adults. Not to forget the crimes against women. Pretty Much Every human on the planet can be helped to live a peaceful life.
Lets #MakeaDifference

I join the MIT mission. This is the MIT Campaign for a Better World #MITBetterWorld. Share this project with a #MITBetterWorld to show your support.

Would you please take a moment to Donate a Vote?

Just a few clicks away are the Vote buttons. Completely free for you but priceless to me. It motivates me to keep doing the stuff I do. Needless to say, It also helps be get some new tools [I really need the 3D printer and the Epilog Laser cutters :)] so I'll cook up more Instructables to share with you. Any suggestions or queries are welcome in the comments. Thanks for your support!
===================================================
Sorry Guys... We are experiencing technical difficulties with accepting Donations currently. Hopefully Paypal will fix it soon.

Step 1: Watch the Video!

The build video: This is like I am showing the 3.5 Month process in 10 mins. 9.50 to be precise.

The Intro Video. : The second video shows the features of the With U Smart Shoe sole.

Step 2: Cross Your Feet, Inform Your Family! Its That Simple :)

What do you do when you are in some trouble? Cross your fingers? Don't! Now cross your feet and you will be okay! HOW? Read on...

This is the most important feature of the With U smart shoe sole. A shoe with GPS and magnetic gesture recognition system.

What is that? Gesture recognition using magnetic field...?

In the early stages of the project, I had an idea to use a push button to act as a ACTIVATOR switch, which when pressed will start the location update process to the server. But there is a problem.

Manually pressing the pushbutton which is way down near your feet...? Seems a bit weird. So How do we make it handsfree?

More over, in some situatoins you may not be in a condition to reach your shoe and press the button somehow. [Your hands are tied...?!]

That is where HALL EFFECT sensor Changes the game. A hall effect sensor is a 3 leg electronic component which changes the voltage at its "sense" pin according to the magnetic field near it.

What is the plan? We are placing a dummy sole into the second feet which has the Rare earth neodymium magnet. When the shoe are oriented in such a way that the voltage at sense pin crosses a threshold value, the arduino promini recognises this and activates the location update process.

Step 3: Call the Sole Get the Location

Yep! This is an extra feature. What if in any situation you are not able to cross the feet?

Simplest solution is to add a communication channel that allows the family to retrieve your location if they need it.

The With U shoe is always with you!

That is what the figure explains.

Step 4: Is It Comfortable?

One question may haunt you...

Is the sole comfortable in the feet?

Absolutely!

HOW can I say this? I have seen some people wearing something called Height raisers. They are of the same size as our sole. So if one can wear that height riser, you can wear this too.:)

Step 5: Bill of Materials

The following is the list of materials you will need to make the project.

1) Arduino Pro Mini

2) FTDI 3.3V [to program the Pro Mini]

3) Adafruit FONA 808 [GPS + GSM Module]

4) Copper Clad PCB [Double Sided]

5) Active SIM Card with Some credit [Money!]

6) MDF 6 mm board to make the sole support

7) Aluminum foil for the antenna

8) A4 Sized plain paper

9) 3 inches shielded wire

10) Micro USB female charging port

11) 3.7 Volt 2100mAh flat battery.

12) Hall effect sensor

13) Intermediate knowledge of electronics and programming Arduino [or similar]

14) Some experience in working with PHP [we will create our own web page that shows real-time updates]

15) Basic tools and a good amount of time :)

Let's get started!Start

Step 6: Special Auto-desk Circuit Simulation

Some people may find the normal schematic views tedious to follow and understand. Although in this project there only a PCB to be made and some components to be attached. I have included the circuit connections separately for you to look and understand how the part has been connected in the circuit.

It really helps to figure out if something does not work as expected, you can take a look at an internal circuit of the PCB in an engaging photo rather than having to manually trace the wires in the schematic!

Thank you Autodesk for such an awesome tool!

NOTE : I am new to the autodesk tool, and could not figure out how to make my own Parts like the FONA and MICRO USB so for that there are other pictures included.

Step 7: Take a Look at the Schematic

The schematic of the circuit could not be made in Autodesk Circuits[by me] so I am givig a Eagle Cad ScreenShot.

You don't need to understand this to make the project. The instructions ahead are easy for you to follow. This schematic is for those who want more details.

Step 8: Solder the Header Pins to the Arduino...

So, the Arduino has to be solder to the PCB later.. But to begin, we have to solder the male header pins to the pro mini.

To do this I found a special way. To make the circuit thinner, so that it fits in the sole comfortably, I found a special way to solder the pins to the Pro Mini.

The problem with the conventional way...

Normally, one would insert the pins directly in the holes and solder... But is this what you should do here? The plastic part [Black one..] eats up more space. Secondly, Our home-made PCB is double sided with no metallic vias which connect the two layers of the PCB. So what should we do..?

The solution: My way to solder the pins is to push the plastic part on one side, and then insert it into the Arduino pro mini. This way, much space is saved.:) The circuit is Slimer now.

Step 9: Print the PCB Artwork.

Here is the PCB file. I have designed the pcb in eagle CAD software.

Download and print the file on a glossy paper.

1) Download the file

2) Print it on a magazine paper

3) Clean the PCB on both the sides

3) Transfer the artwork to both sides of the double sided PCB.

4) make sure the alignment is right for both the layers

5) Move on..

Note: This instructable is not about how to make the PCB's. There are aewsome tutorials out there for you to follow.

Making double sided PCB requires more efforts that making one sided PCB. Because you also have to align the artwork so that they match up on both sides. So, if you are attempting this, I am assuming you know what you are doing!

And... one more thing, I lost the footage of Ironing the PCB. Apologies for that. No pictures:(

Step 10: Etch the PCB

So, once you got the artwork nicely on both the sides of the PCB, time to etch it.

1) Get your PCB

2) Mix adequate amounts of warm water and etching powder to make the etching solution

3) drop the PCB in the Etching

4) Leave it for sufficient time, let all the copper dissolve Maybe get yourself a cup of coffee! [I personally love sandwiches:P]

5) Get the PCB out of the etching tank.

6) Remove the masking toner using some acetone.

7) Well done! You got your PCB ready.

#TIP: I use a small DC waterproof motor to continuously circulate the etching solution around the Copper. I can say, this reduces the etching time and improves the quality of the outcome. Completely optional but worth it!

Step 11: Drill the PCB Holes

Now the fun part, Drill the PCB holes with a drill... I

I recommend using a Dremel kind of drill for this task. With a manual drill, you will take forever to complete. There are a lot of holes to drill!

Step 12: Drill Out the SIM Slot

Okay, so we have the PCB etched. Time for the next step.

Our project includes a SIM Card, which serves the communication purpose, providing GSM and GPRS capabilities to the project. We could add the SIM card in the FONA module and forget about it. But to make life easier, I chose to add an extra feature that facilitates the swapping of sim cards anytime needed. Handy in case you want to change your service provider!

1) There is a slot marked with a rectangle on the PCB. That is what is to be cut out.

2) I drilled out the entire area to remove the material from the PCB.

Note: There can be a better way to do the cut, but with the tools I had, this was the best I could figure out.

You don't want to be in a hurry to complete this step. While boring the area, you want to avoid chips and cracks to develop on the PCB, unless you are wanting to make the PCB again... :P

Step 13: Solder the SMD to the PCB

Before soldering any major, [by size], components to the PCB, we gotta solder the small, teeny weeny components to the PCB.

1) There are total FOUR SMD components to be soldered

2) Use a pin point tip to solder the parts to the PCB

3) Use small sized tools to manage the SMD's . It helps...

Why SMD? Here is what wiki has to say:

Surface-mount technology (SMT) is a method for producing electronic circuits in which the components are mounted or placed directly onto the surface of printed circuit boards (PCBs). ... An SMT component is usually smaller than its through-hole counterpart because it has either smaller leads or no leads at all.

Yeah really, for me in this project , size matters, so I tried my best to minimize component footprints and choosing SMD was a part of that.

Many people will find soldering SMD electronics a daunting task, I agree, these little things are real pain to solder, but once you get used to them, it is not that difficult.


Step 14: Solder the Arduino Pro Mini to the PCB

I am not sure how I am going to explain this part. But trying my best. [Recommended: See the video for more insight]

You got your SMD assembled, [hopefully!] , now get your Arduino to be mounted.

1) Push the black plastic part of the header pins to One extreme. [Why and how? : Step 2]

2) Solder the header pins to the Arduino Pro Mini.

3) Push [Gently] the ProMini in the holes. Take your time.

4) Get it as far as possible, compressing it without ruining anything.

5) Solder the board

6) Done.. Pretty much

Step 15: Solder the Adafruit FONA to the PCB

The title says it all.

Time to solder the FONA 808 module to the PCB we just made.

Push the Header pins as further as possible. This saves space. Making the circuit compact.

Also remember to add solder from both sides, because our homemade PCB has no metal Via's as the Manufacturers do!

Note: You are working with static sensitive electronics. Any wrong step such as applying more pressure or handling it in a wrong way will take no time to ruin everything.

Step 16: Make the GPS Antenna... What?..

What..? Yes... you read it right. But why?

I found a GPS chip patch antenna. There were two main concerns with that. The first, the GPS antenna had a very low gain. Around -4dbi or so. This was so low that I had to go to the terrace to get a weak signal. Now, our shoe sole will have our body as an obstacle between the Satellites and the low gain crap could make the situation even worse.

Second, the antenna is very thick, we cannot afford that amount of space for such a ****! You know it!

So, I went on making my own antenna. It was not very intuitive. I searched online to know how they are made. But with very little relevant information, it was time to do some experiments.

Hunting for it, I discovered various types of antennas like chip antenna, the patch antenna, dipoles, monopoles etc. But how do you make one? That is what I am here to show you for this step.

First, let me introduce you to some terms:

1) Antenna Gain: In the simple terms antenna gain is the factor by which input power to the antenna will be multiplied to provide higher output power. It is this higher power output which will be transmitted over the air as EM waves.

2) Antenna radiation pattern: Electromagnetic waves emitted from the antenna is referred as antenna radiation pattern. It is made of a major lobe and more than one side lobes. The region near the antenna is referred as near field region and region far away is referred as far field region. It can be represented either in polar or in rectangular coordinates.

3) Antenna Impedance: In simple terms, it is the ratio of voltage to the current at the antenna input. If antenna impedance at the input is 50 Ohm means sinusoidal voltage amplitude is 1volt and current amplitude is 1/50 Amps. Based on this and transmission line impedance, balun may or may not require. Balun is also referred as an impedance transformer.

4) Active Antenna: It requires an external power supply to work.

5) Passive Antenna : It does not need an external power supply.

Note : This was just a short introduction to basic terminology. You don't need to memorize them, just an introduction was necessary, so that in future when I refer to some term, you won't say I'm talking Gibberish!

Please Read more about antennas on google if you want more insights into the subject.


Step 17: Make It... the GPS Antenna

Convinced? now let's build it.

We want to make two layers of tin...

We are making a sandwich of 3 things to complete the antenna build. One thin paper layer sandwiched between two layers of tin foil. No big deal. Tin foil __ Paper __ Tin foil. That's it.

1) Take an aluminum / tin box. The box should be very thin. We want thin tin foil strong enough to sustain wear and tears.

2) Flatten out the box to make a sheet

3) Now, take your sole and mark the front half [Not really half. but you get it. I hope!] on the foil

4) With scissors cut out the Markings.

5) Now, cut another shape of that ''first half'' with an offset of about 2 cms

6) Glue all pieces together

7) Now, punch a hole in the middle of the sandwich we just made. This is the place for wires to pass through,

Solder two wires, one to each layer. Top and bottom aluminum foil. The bottom part is what is called "Ground Plane" And the top is called the 'Patch'. Now you know why it's called the Patch antenna.

Note: Make sure that there is no short between the Ground plane and the Patch [Top]. Otherwise we may damage the internal circuitry of the FONA module.

Step 18: Make the Sole

Let us shift our focus a little and do some fun stuff. Make the Sole.

+++ Cutting the MDF +++

1) Take the 6 mm MDF sheet and mark the size of your Heel. [Getting it? Don't worry if you arent.. it will all get clearer:)]

2) Take the battery and using your intuition to find the approx center of the half heel...

3) Mark the battery outline.

4) Now Cut out the outer outline of the MDF Sheet to get the crude shape.

5) Repeat the above steps until you have 4 layers of heel shaped Pieces.

[Are you feeling like, What are you saying... Sahas!]

+++ Shaping the MDF +++

6) Get your bench vice ready.

7) Clamp all the 4 pieces in the Vice.

8) Get your Sander with 100 Grit paper put on.

9) Keep Sanding until you get the right Shape.

10) Done! ... [Watch the video for even more understanding.:) ]

Note: The final quality of the build depends on this step. So take your time, and get the best finishing and details possible.


Details matter, Its worth getting them right. - Steve jobs

Step 19: Make the Battery Compartment: Dig Out the MDF!

Bore a hole in the center of the battery outline you made earlier.

1) I first drill out a hole, big enough to let the jigsaw blade to make its way.

2) Get your jig saw and start sawing the material until you make a pocket.

3) Once the hole is big enough to be workable, get your file, and start filing the excess material to end up in a nice finish.

4) Test fit the battery in the pocket, it should be just fit enough, not too loose or it will fall out, and not too tight too.

That is it, Done! you made it.

Step 20: Slot for Antenna Wires

I wanted a nice transition of wires. here is my shot at passing the wires for the antenna.

1) On the 2nd Layer, I used my hobby knife to make a slot about 5 mm wide and 1 mm deep.

2) This acts as a channel to allow the wires to pass through without showing up.

Step 21: Charging Port

How do you charge this thing? Simple..

The Adafruit FONA 808 has an inbuilt lithium Ion battery charging system. The only thing we want to do is extend the charging port [MicroUsb] using another micro-port,

1) Solder the positive and negative supplies of the USB to the respective polarities.

2) Now connect this to the +5V expansion port on the PCB

3) Make the small slot for the female USB port to rest into.

3) Done:)

Charging port added. Now move on...

Wondering where to get the Micro USB port:? You know it! It's the most used port! Your mobile phone...

NO, I am not telling you to break into your phone for the port, but you can get it on a phone service center!

Step 22: Stack the Layers of MDF

We got our layers made, time to glue them together.

Add some glue to the layers and one by one, stack them one on one.

Let the glue dry.

You may want to clamp the piece for a better bonding, but I did not have clamps at that time so I just added a weight on it. It did the job.

Don't forget to stick in the Female USB port before sticking all the layers! It's difficult to do this once you stick all the Mdfs.

Step 23: Vibrator Motor.

In my design, I have added a little vibrator motor. What it does is, It notifies the user, when the user crosses the feet, [to seek help] the motor vibrates for one second.

This serves the purpose of notifying the wearer that 'Your message has been sent!'

I got the little motor from an old cell phone.

Wire up the motor to the Pin 13 of the ProMini.

Note: The motor draws a little current , I know, its not the Best Idea to hook it up directly to the atmega328 pins. But I did not have that time to add the extra components and went on to take the risk. Know what, it turned out pretty well.

Step 24: Hall Sensor

When you cross your feet, The circuit detects this gesture by detecting the change in magnetic field induced by the rare earth magnet in the second feet.

At the beginning I thought of using a Reed switch, but Reed switches are unreliable and too fragile for the job. So a more practical thing was a Hall Effect sensor. This sensor converts the magnetic field to analog values for our Arduino to detect.

Once the value goes above a threshold value, the Arduino gets to work, begins the uploading process.

1) Get the appropriate pinouts of the Hall effect sensors. from the Datasheet

2) Solder the jumper wires to the legs

3) The connections are as follows:

HALL SENSOR ===>> ARDUINO

+Vcc ===>> +3.3 V

GND ===>> GND

Sense ===>> Analog Pin 1

NOTE: The PCB connections for the Hall sensor are already wired for the necessary pins. The above connection chart is just for reference.

Add some heat shrink tubing to the connections to prevent the shorts.

Step 25: Solder the GPS Antenna.

Solder the GPS antenna to the FONA module.

Now, since there is no separate break out for this. I had to trace the GPS wiring. I found that the GPS pin number 35. The SIM808 Pin 35. The one near the corner. Dont get confused, its the one in the Picture.

Be careful not to short the adjecent pins by a solder splash, this would ruin the SIM 808 Chip. Take your time.

Step 26: Add the Battery Connector and Switch

I got a 3 pin battery connector from a local mobile shop.

This connector facilitates the removal of battery in case you need it. Making it even more functional.

1) Make the slot for the connector in the Sole

2) Solder the + and - wires to the battery connector. Note the polarity.

3) Glue the connector in the slot we made. That is it for the battery connections.

4) Add a switch for operation.

Like that:

Step 27: Failed Attempts to Make the Sole...

This is not a step to follow. These are some of my failed attempts while making the sole.

I wanted to try my luck with fiberglass molding. I tried making the [rough] shape of the sole. Planning to sand it to shape later once it sets. But later I discovered, the resin had turned so stubborn, it won't sand to shape. It was a miserable failure. But though, it was an amazing experience. No regrets.

Failure is the condiment that gives success its flavor.” ... Well said.

Step 28: GSM Antenna.

Earlier we made a GPS antenna, now time for another important antenna we should want to make.

I know, you must be into thinking, What, GSM antenna? There are so many readymade antennas that we can use in here...

Well, that is what I tried at first. I am not saying they don't work, But in our application, there is a critical issue with using the ready made antenna Out of the box. In techie words, it's called 'Electromagnetic Interference'.

Electromagnetic Interference, in Maker's words, the circuit elements are talking to each other. Strange?! It is, but it happens.

1) Get some 'Shielded wire'. That is what locals call it here in my place.

2) Strip the wire.

3) The inner wire, the core, acts as the antenna.

4) Connect the outer shielding to GROUND. That shields our circuit.

Why does it happen? :

It happens! due to radio waves. That is all I currently know.

How do you avoid it?

Now that's the good question.

To reduce the ill effects of the EMI, a technique called, RF Shielding is used. It's based on the faraday cage effect.

Electromagnetic shielding that blocks radio frequency electromagnetic radiation is also known as RF shielding. The shielding can reduce the coupling of radio waves, electromagnetic fields, and electrostatic fields. A conductive enclosure used to block electrostatic fields is also known as a Faraday cage.

We use grounded metal to avoid the interference. Just like you use sweater in winter, we gotta shield the

circuit from the ''winds'' of the RF!!

I know what you are thinking... That was the worst explanation man! So...

For the curious bug: http://www.digikey.com/en/articles/techzone/2013/...

Step 29: Battery Cover Plate

You probably are wondering... "How the sole is going to take the weight of the Person" ? "Won't the battery get damaged by the weight force?" That is correct.

So to protect the battery, I made a small protector which stays over the sole, distributing the force all over the sole, protecting the battery

I used a strong fiberGlass PCB to make that.

Made a Notch for the GSM antenna to pass and that was it.

Step 30: An Intro to ''AT'' Commands

AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at".

That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones.

Besides this common AT command set, GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).

That is fair enough introduction to AT commands to use in our project. Hope you found it helpful.

Step 31: The CODE :)

Here is the code. Please don't paste this into the IDLE, there are formatting issues with the code editor. I have linked the .ino file for download.

// This Code is made by and for Sahas chitlange ONLY 
// Project >>>> GPS smart shoe sole
// A companion shoe sole that can Save Lives... 

#include SoftwareSerial FONA (2,5);

int state = LOW;                            // the current state of the output pin
int reading;                                // the current reading from the input pin
int outPin = 13;                            // master pin 
int previous = LOW;
long time = 0;                              // the last time the output pin was toggled
long debounce = 500;                        // the debounce time, increase if the output flickers
char storedLocation ;
int inTrouble = 4;                          // reed switch
int check;                                  // variable to store reading of digital pin...
int slavePin = 12;                          // slavePin for calling
int vibratorMotor = 11;
int IncomingCall = 3;                       // RI of fona to detect calls
int messageState = LOW;                     // initial state of state of pin 
int messagePin = 6;
int messageSlavePin = 7;
//int refPin = 9 ;                         // Pin to provide 3.3V ref to FONA
int mSensor = A1 ; 
int slavemSensor = 9;
  
int threshold = 525;             // variab;e to store Hall sensor reading...</p><p>void setup() {
  Serial.begin(9600);                       // begin the serial communications
  FONA.begin(9600);
                                            // declare the pinModes
  pinMode(inTrouble , INPUT);   
  pinMode(slavePin, INPUT); 
  pinMode(outPin, OUTPUT);     
  pinMode(11, OUTPUT);                      // Vibrator motor at pin 11
  pinMode(IncomingCall , INPUT_PULLUP);
  pinMode(messagePin,INPUT);
  pinMode(messageSlavePin , OUTPUT);
  //  pinMode(refPin , OUTPUT);                       Zener diode is better for reference voltage
// digitalWrite(refPin , HIGH);
                                           // Interrupt for messageAfterCall
  attachInterrupt(digitalPinToInterrupt(IncomingCall), incomingCall, CHANGE);
  pinMode(slavemSensor , OUTPUT);
    
  //=========================================      // Turn on GPS 
  delay(10000);
  FONA.print("AT+CGNSPWR=1");
  FONA.println("");
  Serial.print("IS GPS TURNED ON? ==> ");
  delay(1000);
  toSerial1();
  FONA.print("ATE0");FONA.println("");
  Serial.print("IS ECHO OFF? ==> ");
  delay(1000);
  toSerial1();
  FONA.print("AT+CMGF=1"); FONA.println("");
  Serial.print("IS SMS MODE SET TO TXT ==> ");
  delay(100);
  toSerial1();
  
  // ===========================================
 
  FONA.print("AT+CGATT=1"); FONA.println(""); // Turn on GPRS SERVICE
  Serial.print("IS GPRS ATTACHED ==> ");
  delay(100);
  toSerial1();</p><p>  // bearer settings
  FONA.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");FONA.println("");
  Serial.print("BEARER SET? ==> ");
  delay(2000);
  toSerial1();
  </p><p>  // bearer settings
  FONA.print("AT+SAPBR=3,1,\"APN\",\"imis/internet\"");FONA.println("");
  Serial.print("APN SETTINGS ARE DONE? ==>");
  delay(2000);
  toSerial1(); </p><p>  // bearer settings
  FONA.print("AT+SAPBR=1,1"); FONA.println("");
  Serial.print("IS INTERNET ACTIVATED (may return ERROR if already on) ==>");
  delay(2000);
  toSerial1();
  //=============================================
  }</p><p>void loop() {
  Serial.println("Checking the switch states to decide further actions");
  while (FONA.available()>0){
  Serial.println(FONA.read());}
  hallSensor();
  checkState();
  messageAfterCall();
 }
 void Inform(){
   String content = "";
   char c;
   FONA.print("AT+CGNSINF");FONA.println("");
   delay(1000);
  while (FONA.available()){
        c = FONA.read();
        if (c == 0x0A || c == 0x0D)
        {          ;        }
          else{
            content.concat(c);
          }
        }
        Serial.println(content);
  FONA.print("AT+CMGS=\"+************\""); FONA.println("");               // The Phone number to be Informed///
  Serial.print("SMS INITIALIZED");
  digitalWrite(9 ,LOW);
  delay(100);            
  //toSerial();
  FONA.print("I am in trouble. Please help.");FONA.println("");
  FONA.print("Following String is my location");FONA.println("");
  FONA.print(content);
  delay(1000);
  FONA.println((char) 26); // Terminate
  delay(10000);
  toSerial1();
  delay(1000);
  Serial.println ("Message Sent Successfully!");
  digitalWrite(messageSlavePin , LOW);
 }</p><p>void ServerSubmit(){
   String content = "";
   char c;
   FONA.print("AT+CGNSINF");FONA.println("");
   delay(1000);
   while (FONA.available()){
        c = FONA.read();
        if (c == 0x0A || c == 0x0D)
        {          ;        }
          else{
            content.concat(c);
          }
        }
        //CGNSINF: 1,1,20160411112045.000,19.863687,75.352990,581.700,4.33,116.4,1,,2.2,2.3,1.0,,11,4,,,19,,OK   <== sample location...
        String Lat = content.substring(33,42); Serial.println(Lat);
        String Lon = content.substring(43,52); Serial.println(Lon);
     delay(100);
     FONA.print("AT+HTTPINIT");FONA.println("");                                                              // Initialise HTTP
     Serial.println("HTTP INITIALISED");
     toSerial1();
     delay(3000); </p><p>     FONA.print("AT+HTTPPARA=\"URL\",\"http://data.sparkfun.com/input/ZGoQyQGdzbFwpxnpp79W?private_key=2mMwnwmZWpTMNVDNNrGP");  // BUILD URL
     FONA.print("&location=");FONA.print(content);FONA.println("\"");
     toSerial1();
     delay(100);
     Serial.print("Location coordinates Submitted! => ");Serial.println(content); 
     toSerial1();
     delay(2000);</p><p>     FONA.print("AT+HTTPACTION=0");FONA.println("");
     Serial.println("Response from Server ONE");
     delay(6000);
     toSerial1();                                                                // Submit location
     delay(1000);
     toSerial1();
     
    // FONA.print("AT+HTTPREAD");fonaSS.println("");
    // Serial.println("Response (READ) from Server ONE"); 
    // toSerial();                                             // No need to read from server ... saves time
    // delay(3000);
     
     FONA.print("AT+HTTPPARA=\"URL\",\"http://data.sparkfun.com/input/YGYQnoywpMCov11AZKRN?private_key=RbP9RdG4EMUPVrr2lA8z");
     FONA.print("&latitude=");FONA.print(Lat);FONA.print("&longitude=");FONA.print(Lon);FONA.println("\"");
     toSerial1();// BUILD URL
     delay(2000);</p><p>     FONA.print("AT+HTTPACTION=0");FONA.println("");
     Serial.println("Response from Server TWO");
     delay(6000);
     toSerial1(); 
     delay(100);
     toSerial1();
    
     
     //fonaSS.print("AT+HTTPREAD");fonaSS.println("");
     //Serial.println("Response (READ) from Server TWO");                           // No need to read from server ... saves time
     //toSerial();
     //delay(3000);</p><p>     FONA.print("AT+HTTPTERM");FONA.println("");
     Serial.print("HTTP TERMINATED");
     toSerial1();
     delay(500);
     toSerial1();
     delay(100);  
   }</p><p>void toSerial(){
 while (FONA.available())
 Serial.print((char)FONA.read());
 //Serial.println();
   }
  
void checkState(){
  reading = digitalRead(inTrouble);          // Check State of pin 4
    if (reading == HIGH && previous == LOW && millis() - time > debounce) {     // Debouncing to avoid errors...
      delay(100);
      digitalWrite(11, HIGH);
      delay(500);
      digitalWrite(11, LOW);
      delay(1000);
      Inform();
      
    if (state == LOW)
      state = HIGH;
    else
      state = LOW;
      digitalWrite(11, HIGH);
      delay(1000);
      digitalWrite(11, LOW);
    
    time = millis();    
  }
      digitalWrite(outPin, state);
      check = digitalRead(slavePin);
       if (check == HIGH){
        ServerSubmit();                                      // Submit data to HTTP server until reset.// 
        
      }
      previous = reading;
}
void toSerial1(){                                            // function to save the  response of serial as a string and print it to monitor
  String content = "";
   char c;
   while (FONA.available()){
        c = FONA.read();
        if (c == 0x0A || c == 0x0D)
        {          ;        }
          else{
            content.concat(c);
            
          }
        }
        Serial.println(content);
}
void incomingCall(){                                                
  FONA.print("ATH"); // disconnest the call immediately
  FONA.println("");                                                  // Interrupt stuff ,,, If call is detected , 
                                                                     // the program pulls the messageSlavePin HIGH and function messageAfterCall() 
                                                                     // is called in the loop to send sms.
  digitalWrite(messageSlavePin , HIGH);  // <<<< this is it>>>
   }
void messageAfterCall(){
    messageState = digitalRead(messagePin);
    if (messageState == HIGH){
      digitalWrite(messageSlavePin , LOW); // turn of message service  i.e. send a message only once...//
      delay(1000);
      Serial.println(FONA.read()); // Flush everything clear
      delay(100);
      Inform();
      }
  }</p><p>void hallSensor(){
int analogValue = analogRead(mSensor);</p><p>  // if the analog value is high enough, turn on the LED:
  if (analogValue > threshold) {
    digitalWrite(9, HIGH);
  } else {
    digitalWrite(9, LOW);
  }</p><p>  // print the analog value:
  Serial.println(analogValue);
  delay(1);        // delay in between reads for stability
 }</p>

Step 32: Set Up the Phone Number in the Code

Our sole uses the GSM service of the SIM to send SMS to the required phone number, The required phone here is the one on which you want the notifications to arrive.

NOTE: You have to get a SIM card with enough credit in it. Aka [working sim].

1)Note down the number of the sim card.

2)Open the code.

3)Find the lines in the code...

...
Serial.println(content);<br>  FONA.print("AT+CMGS=\"+************\""); FONA.println("");               // The Phone number to be Informed///
  Serial.print("SMS INITIALIZED");
  digitalWrite(9 ,LOW);
...

Replace the **********'s with your number in the format: +(country code) (your number)

example: if your number is 0000000000 and the country code is 11 then you do the following:

...
Serial.println(content);<br>  FONA.print("AT+CMGS=\"+110000000000\""); FONA.println("");               // The Phone number to be Informed///
...

Step 33: Set Up the BEARER of Your SIM Provider

In telecommunications, Bearer Service or data service is a service that allows transmission of information signals between network interfaces. These services give the subscriber the capacity required to transmit appropriate signals between certain access points, i.e. user network interfaces. ... WIKI

Each SIM operator has their BEARER, APN Settings, you need these settings in order to activate the GPRS services.

You can find your settings online by providing your sim operator name.

To do this:

1) FIND the following lines in the code:

// bearer settings<br>  FONA.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");FONA.println("");
  Serial.print("BEARER SET? ==> ");
  delay(2000);
  toSerial1();
  
  // bearer settings
  FONA.print("AT+SAPBR=3,1,\"APN\",\"******\"");FONA.println("");
  Serial.print("APN SETTINGS ARE DONE? ==>");
  delay(2000);
  toSerial1();

Paste your APN in place of the ''***''

This is your APN settings done.

Step 34: PHP Intro

We will be using a new language called PHP to build the tracking web page that can then be used to view the real-time location of the wearer, from any corner of the world.

PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.

What is PHP?

PHP is an acronym for "PHP: Hypertext Preprocessor"

PHP is a widely-used, open source scripting language

PHP scripts are executed on the serverPHP is free to download and use.


What Can PHP Do?

PHP can generate dynamic page content

PHP can create, open, read, write, delete, and close files on the server

PHP can collect form data

PHP can send and receive cookies

PHP can add, delete, modify data in your database

PHP can be used to control user-access

PHP can encrypt data


Why PHP?

PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

PHP is compatible with almost all servers used today (Apache, IIS, etc.)

PHP supports a wide range of databases

PHP is free. Download it from the official PHP resource: www.php.netPHP is easy to learn and runs efficiently on the server side.


Step 35: MY PHP CODE

The following is the PHP script I wrote for the With U Sole project.

Bear with me... I will guide you through the process. For now, just download this code into notepad++ editor.

Step 36: Get the Google Maps JavaScript API Key [Don't Worry, Its Free :D]

In our project, we are using Google Maps.

So in order to make it work, we need an API KEY.

Don't worry it is not that hard to get one... And it's free too...

And the following is the easiest method to get one...

1) Go to the google developer link : https://developers.google.com/maps/documentation/j...

2) You will see a box named : GET KEY

3) Hit that.

4) Enter your project name: Example : With U Shoe

5) Hit on Enable API

6) You will be shown some API key... Copy and paste it somewhere...

What to do with it? I will show you in a few steps.

Step 37: Add the KEY to the PHP Code

You just got the key.

Now add it to the code,

1) Find the code lines in the code:

<script src="http://maps.googleapis.com/maps/api/js?key=<your key here>&sensor=false">

and ...

2) Replace the with Your API key you just got from google.

That is it.

Step 38: Set Up the Whole Website

Now, we want a host computer where we store this code and run it. One option is to get a old spare computer, set up the Apache server on it, add external access to it Port forwarding. and store the code there.

But that is a lot of pain to do... I have tried it..!

So what is the simplest solution?

Get a FREE web hosting solution!

Yeah, a free web hosting solution :) [I love FREE stuff! :P]

1) Go to https://www.000webhost.com

2) Create your account for free.

3) Log into your account.

You are probably saying ... Oh man, go ahead, we know that...

ok so...

4) Create your domain... any name will do. its free.

5) Go to the CPanel by clicking "Go to CPanel" .

6) Find the FILE MANAGER Section: and choose any of the file manager options [3 are there]. All work same.

7) Now it will direct you to an FTP server page. Log into it.

8) Once your page loads, create a new file and paste the PHP code into it.

9) Save the file as " .php " extension.

NOW NOW NOW......................... go back to the same directory where you saved the earlier PHP file [In the file manager itself]

10) and create a blank file named "gps.php" THIS IS Important. Pplease DONT Change the file name. because this file will store the coordinates it recieves from the shoe and use them to plot the Map.

DONE :)

Save all the files and you can now exit.

Step 39: Set Up the Server in the Arduino Code:

Because we are updating the coordinates to the Server, and your server address is different than mine, you will have to make the appropriate change to the code.

1) Find the code lines:

FONA.print("AT+HTTPPARA=\"URL\",\"http:///<your_domain_here>/<PHP_file_name>.php?");

and replace the with the one you got earlier. and

with the name which you saved the PHP code earlier step.

Don't change the code anywhere, unless you know what you are doing, or else you are going to mess up with it.

Step 40: Upload the Code to the Arduino Pro Mini

You just have to upload the code I have written.

1) Get an FTDI chip, [3.3V]

2) Open the Arduino code Environment

3) open the sketch

4) Do the settings for your Arduino pro mini

5) Hit upload.

6) Done,

You just flashed your code to the Arduino pro mini.

NOTE: Please be sure to check the voltage settings of the FTDI chip. It should be set to 3.3V otherwise you will be cooking your CHIPS!

https://learn.sparkfun.com/tutorials/using-the-arduino-pro-mini-33v

Step 41: Test the Server...

Now when you have set up the page on webhost.

Type a URL into your browser:

<Your_Domain>/<PHP_file_name>.php?latitude=0.00&longitude=0.00&satellites=10

You should see a page that says that your data has been saved. This means the server works.

Something like this::

DATA recieved: Latitude: 0.00 Longitude: 0.00 Time: Satellites: 10 Data saved Succesfully!

Step 42: What Next?

There is a lot that can be done to add more features to the With U shoe. I would list my priorities as follows

1) Make a efficient code. : Yeah, when I started coding the With U shoe, I had a very little experence doing it. You must have probably guessed it while reading my code. So first thing will be that.

2) Build an Android App. :Smartphones are everywhere. Why not make a With U shoe app where one can track realtime? Get location updates and stuff like setting geofencing etc.

3) Making the circuit from Chip Level: For the prototyping, Using arduinos and FONA was okay. But going further, I have made the chip level circuit to make a custom PCB. The schematic is in the picture.]

4) 3D printing the sole : That will be exciting...!

Epilog Contest 8

First Prize in the
Epilog Contest 8

Circuits Contest 2016

Grand Prize in the
Circuits Contest 2016

IoT Builders Contest

First Prize in the
IoT Builders Contest