A DIY Smart Insole to Check Your Pressure Distribution


Three FSR’s (with voltage dividers) and an accelerometer.
Wiring xrvswdjvln


Full code of this tutorial
#define _DEBUG_  //Make sure this comes before any other includes or your board might crash

/*Please find the tutorial here: https://www.hackster.io/projects/a5ceae*/
#include <WiFi101.h> //Thinger
#include <ThingerWifi101.h> //Thinger
#include <Wire.h> //Accelerometer
#include <Adafruit_Sensor.h> //Accelerometer
#include <Adafruit_ADXL345_U.h> //Accelerometer

#define USERNAME "yourUsername"
#define DEVICE_ID "yourDevice"
#define DEVICE_CREDENTIAL "yourCredential"
#define SSID "yourSSID"
#define SSID_PASSWORD "yourSSIDPassword"

Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); //Accelerometer

int x = 0; //Reset to 0 
int y = 0;
int z = 0;  

//*FSR sensors*/
#define noFSRs 3 // Number of FSRs connected
#define FSR1 A1  //Analogue ports
#define FSR2 A2 
#define FSR3 A3 

float fsrVoltageArray[3];       // The analog reading converted and                                      //scaled to voltage as a floating point                                  //number
float fsrForceArray[3];         // The force in Newton
float fsrWeightInGramsArray[3]; // Weight converted to grams

int   pinArray[3]       = {FSR1, FSR2, FSR3};    // The pin ID for the                                                    //three devices
float forceMaxArray[3]  = {100.0, 100.0, 100.0}; // Maximum forces                                                        //supported

float million = 1000000.0; // Unit for "1/micro
float conversionToKgrams = 1.0/9.80665;

long K       = 1000;
long R       = 10*K;    // R in K Ohm
long Vcc     = 5000;    // 5V=5000mV, 3.3V = 3300 mV
float voltageMax = 0.98 * Vcc; // Maximum voltage set to 95% of Vcc. Set                               //the force to the maximum beyond this                                 //value.

//Call to set up WiFi function

void setup(void) {
  thing.add_wifi(SSID, SSID_PASSWORD); 
  if(!accel.begin()) {   //Initialise the sensor 
    Serial.println("No ADXL345 detected.");
  } else {
    accel.setRange(ADXL345_RANGE_16_G); //Range for this sensor 
    thing["accelerometer"] >> [](pson& out){
        sensors_event_t event; 
        out["x"] = event.acceleration.x;
        out["y"] = event.acceleration.y;
        out["z"] = event.acceleration.z;

   /*FSR sensors*/  
  thing["pressure"] >> [](pson & out) {
    out["FSR1"] = analogRead(FSR1);
    //    Serial.print("FSR1:");
    //    Serial.println(analogRead(FSR1));
    out["FSR2"] = analogRead(FSR2);
    //    Serial.print("FSR2:");
    //    Serial.println(analogRead(FSR2));
    out["FSR3"] = analogRead(FSR3);
    //    Serial.print("FSR3:");
    //    Serial.println(analogRead(FSR3));      

  thing["voltage"] >> [](pson & out) {

    for (int FSR = 0; FSR < noFSRs; FSR++) {   

      fsrVoltageArray[FSR] = 0.0; //Reset values upon entry
      fsrForceArray[FSR]   = 0.0;
      int fsrPin   = pinArray[FSR];     
      int fsrReading = analogRead(fsrPin); 
      fsrVoltageArray[FSR] = (float) map(fsrReading, 0, 1023, 0, 5000);
    } //End of loop over FSR's

    out["FSR1voltage"] = fsrVoltageArray[0];
    out["FSR2voltage"] = fsrVoltageArray[1];
    out["FSR3voltage"] = fsrVoltageArray[2];

  thing["newton"] >> [](pson & out) {
    for (int FSR = 0; FSR < noFSRs; FSR++) {  
         // The value of the force F as a function of the voltage V is           ///computed as: F(V) = (Fmax/Vmax) * V

         float force_value = (forceMaxArray[FSR]/voltageMax) * fsrVoltageArray[FSR];

         // Three situations are distinguished:
         // 1. If V is too close to the maximum (as defined by voltageMax          // ), the force can
         //    go to infinity. This is avoided by setting it the maximum          //value as soon as it is higher than our threshold voltageMax.
         // 2. If the computed force F is too small, we set it to zero to          // avoid noise effects.
         // 3. In all other cases, we take the logarithmic value to 
         //reduce the sloop and better distinguish small changes.

         if ( fsrVoltageArray[FSR] < voltageMax ) {

           // V is not too high in this branch

           if ( force_value <= 1.00 ) {
              fsrForceArray[FSR] = 0.0; // Force is too small, set it to                                        // zero
           } else {
             fsrForceArray[FSR] = log10(force_value); // Value is okay,                                                       //take the log of                                                       //this

        } else {

           // Cap the force if the voltage is too close to Vcc (for Vcc            //it would be infinity)

           fsrForceArray[FSR] = log10(forceMaxArray[FSR]);

           Serial.print("Cut off activated for FSR = "); Serial.println(FSR);
   } // End of loop over FSRs
      out["FSR1newton"] = fsrForceArray[0];
      out["FSR2newton"] = fsrForceArray[1];
      out["FSR3newton"] = fsrForceArray[2];
  }; //End of thing 

    thing["weight"] >> [](pson & out) {

    //Straightforward computation to convert the force in Newton to the weight in grams

    for (int FSR = 0; FSR < noFSRs; FSR++) {  
      fsrWeightInGramsArray[FSR] = fsrForceArray[FSR] * conversionToKgrams * 1000.0;
      out["FSR1weight"] = fsrWeightInGramsArray[0];
      out["FSR2weight"] = fsrWeightInGramsArray[1];
      out["FSR3weight"] = fsrWeightInGramsArray[2];
  }; //End of thing
} //End of setup

void loop(void) {

Ref: https://goo.gl/ekVXYy

Comparing Mesh, Star & Point-To-Point Topology In IoT Networking

There are several types of IoT topologies for networking, the most common being mesh topology, star topology, and point-to-point topology. To decide which network is best for your smart application, you need to know the advantages and disadvantages of each. We’ve simplified that process for you below.

Mesh Topology
Mesh topology is a type of networking where all nodes cooperate to distribute data in a network. This topology is typically used for things like home automation, smart HVAC control, and smart buildings. The industry standards that rely on mesh network topology include Zigbee, Z-Wave, and Thread.

Read More: What Is Mesh Topology?

The primary advantage of mesh topology is that it has low transmit power and shorter links (< 100 ft), which allows for a fairly long battery life and enables you to move a lot of data around the network.

The primary disadvantage of mesh topology is that the range between two mesh nodes is quite limited. This means you may have to add additional nodes into your network that aren’t strictly necessary—like an extra IoT-enabled thermostat that you don’t actually need for temperature—just so you can keep your mesh connected. Additionally, because of the interconnected nature of a mesh network, if one node goes down in a “choke point,” an entire piece of the network can fail.

Star Topology
Mesh networks are not the only way to solve low power network needs for IoT applications. In fact, a majority of low power, wide-area network (LPWAN) technologies, in addition to WiFi and cellular networks, use a star network topology. A star network has a router or access point in the middle that connects to all the terminals or nodes.

The advantage of star topology is that all the complexity in the network is driven to a central node, so all the other nodes only need to communicate in their time or frequency slot. How they communicate depends on whether wireless multiplexing is done through frequency-division multiple access (FDMA), time-division multiple access (TMA), or code-division multiple access (CDMA).

The primary disadvantage of star topology is that the radio link between the gateway and the end node or terminal can be very long, which means the further a node is away from the gateway, the more energy it has to expend relaying a message. But unlike a mesh node that has to be constantly “awake,” star nodes are able to rest between message transmissions, helping conserve the total amount of energy expended by each node.

Point-to-Point Topology
While mesh and star networks are used to connect multiple ‘things’ to a network, point-to-point topology is used to connect two things together.

The advantage of point-to-point network topology is that it is much simpler than mesh or star, because the topology simply tunnels a flow of data either unidirectionally or bidirectionally between two points.

The disadvantage is that point-to-point networks are not very useful for IoT. They are still used in some SCADA systems, traffic data systems, or in point-to-point broadcast systems (like police or fire radios), but it rarely makes sense in IoT to have a receiver talk to a single node instead of multiple nodes.

This whitepaper goes into more detail on mesh networks and star networks, like WiFi and cellular. Download it today.

Ref: https://www.link-labs.com/blog/iot-topology