Introduction: Smart Eco-Driving System

About: Catch up with this tech geek on LinkedIn !

Excited to meet you viewers of Instructables + IoT aspirants !!

Well, there is a famous proverbial saying that goes by, "All is well that ends well".

To go by, from my perspective, before I begin sharing my project endeavor, I wish to give a pretty good introduction of the same so that the objective or outlook of the proposed project is put forth evidently. Here we begin ...

With the increasing number of smart cities and metropolitan cities, the world is flourishing in its task to meet the needs of its exploding population. Though solutions in traffic regulation and transit management are coming up in Arithmetic Progression, the problems keep on increasing in Geometric Progression which demands an attention to be focused and an action to be enhanced in mobility patterns. This gives rise to the development of 'Smart Eco-Driving System'.

  • This system has been technologically penned on the perspective of introducing 'Driving Pattern Analysis' and 'Wifi Roads' for establishing the friendly rapport with nature. The concepts of Internet of Things, Cloud Computing, Data Analytics and Multiple Sensor Fusion are incorporated in this system.
  • The 'Driving Pattern Analysis' system facilitates the prospects of monitoring, organizing and generating the driving pattern and finally analyzing it for application in 'metropolitan, school and college transportation system, license and regional transport offices along with the personal assistance of the driver.
  • The 'WiFi Roads', as the fancier name stands, it helps to provide free WiFi of electrical energy generated from piezo-electric crystals. This can be applied to fuel the cars instantly after storing the power generated in a battery tank along the roads, which can then be used to power the automobiles.


  • Internet of Things
  • Cloud Computing
  • Big Data Analytics
  • Eco-friendly patterns
  • Multiple Sensor Fusion


In fact, I wish to paraphrase Neil Armstrong's quote of,

"A small step for Instructables

A giant leap for IoT"


So let's start developing ... IoT enthusiasts ! Here we go ...

Step 1: Catch Up With the Hardware Stuff

As per the requirements of this project, the following components will be used :

  • Intel Edison (1)
  • Grove Rotary Angle Sensor (1)
  • Grove Piezo Vibration Sensor (1)
  • Grove 3 Axis Digital Accelerometer (1)
  • Grove 3 Axis Digital Gyro (1)
  • Grove Dust Sensor (1)
  • Piezo-electric plates ( quantity based on area implemented )
  • LEDs (5)
  • Diodes (4)
  • Capacitor (1)
  • Jumper wires ( as required )

Step 2: The Software Overview

  • We will be using Arduino IDE, preferably 1.6.5 for the coding and compiling tasks.
  • The cloud platforms for implementing this project can be any - most preferably Intel IoT Dashboard, AWS IoT, ThingWorx.etc

Yes ! Now that we are aware of the requirements pertaining to IoT and Cloud Computing in this project, let's begin with the software implementations.

Step 3: Arduino Setup

  1. Install the Arduino IDE in your computer ( preferably 1.6.5 )
  2. Now go to Tools -> Board -> Board Manager ->Intel Edison and install it.
  3. The Intel Edison will now be available in the list of boards in the Arduino Boards Manager.

Simple isn't it ? Yeah ... With the hardware and software part of our project ready, let's roll on making this Smart Eco-Driving System

Step 4: Begin Your Joy With Intel Edison

  • For configuring and going ahead with the initial setup process of Intel Edison, refer the link :

  • To make things simpler, I am not going to pull you people to use Putty Terminal for connecting WiFi ( one of my favorite features in Intel Edison ), instead use the WiFi library in Arduino code to connect automatically.

char ssid[] = "wifi_network_name";
char pass[] = "wifi_password";

status = WiFi.begin(ssid, pass);

  • And yeah ! As simple as that, the fun of making project stuff with Intel Edison is obvious.
  • Further, for deploying a robotic car, the car control has been facilitated through bluetooth control from phone.
  • For connecting Edison with phone through bluetooth, refer the following documentation :

Step 5: Multiple Sensor Fusion

The experimentation with driving pattern can be ascertained with the help of 'multiple sensor fusion' with their values subjected to predictive analysis using machine learning algorithms. The various sensors that can be used are as follows -

  • Grove 3-Axis Digital Accelerometer - Co-ordinates and changes observed for analyzing driving pattern
  • Grove 3-Axis Digital Gyro - Orientation changes to be cohesively plotted
  • Grove Encoder - Assisting the data collected to determine pattern in steering the vehicle
  • Grove CO2 Sensor - Emission rates observed for better mobility and pattern of driving
  • Grove Dust Sensor - Providing suggestion for maintenance and service based on dust emanations in vehicle
  • Grove Ultrasonic Sensor - Determining distance between vehicles

Want to know more about SeeedStudio Grove Sensors ? Chase the link below ...

Step 6: Connect the Sensors

As of a model prototype of our system, we are going to use the following sensors :

  • Grove Rotary Angle Sensor
  • Grove Piezo Vibration Sensor
  1. Connect the Grove Rotary Angle Sensor to Analog port A0 according to the code
  2. Connect the Grove Piezo Vibration Sensor to Analog port A1 respectively

The Grove Rotary Angle Sensor is used for Driving Pattern Analysis for building up a virtual steering simulation environment whereas the Grove Piezo Vibration Sensor is used in implementing WiFi Roads for determining the intensity of vibrations for tapping in the piezo-electric energy from piezo crystals.

Precaution :

Strictly connect the Vcc pin of Rotary Angle Sensor to 3.3 Vout pin of Intel Edison.

Pity that I got one of my Grove Rotary Angle sensors damaged after having connected it to 5v port of Arduino breakout in Edison.

"Experience is the mother of wisdom" - Well said !

Step 7: Arduino Code

#include "twApi.h"
#include "twLogger.h"

#include "twOSPort.h"

#include "WiFi.h"

#include "Ethernet.h"

#include "stdio.h"

#include "string.h"

#include "Wire.h"

char ssid[] = "wifi_network_name";

char pass[] = "wifi_password";

int status = WL_IDLE_STATUS;

/* Name of thing created in cloud */

char * thingName = "Smart_Driving";

/* IP/Hostname of server */

char * serverName = "";

/* port */

int port = 80;

/* API key created */

char * apiKey = "key_name";

/* refresh rate */

int timeBetweenRefresh = 1000;

/* Parameters to be measured */

struct { double Steer; double Piezo_vibration; } properties;

void sendPropertyUpdate()


propertyList * proplist = twApi_CreatePropertyList("Steer", twPrimitive_CreateFromNumber(properties.Steer), 0); if (!proplist) { TW_LOG(TW_ERROR, "sendPropertyUpdate: Error allocating property list"); return; } twApi_AddPropertyToList(proplist, "Piezo_vibration", twPrimitive_CreateFromNumber(properties.Piezo_vibration), 0); twApi_PushProperties(TW_THING, thingName, proplist, -1, FALSE); twApi_DeletePropertyList(proplist);


void dataCollectionTask()


// Assigning the corresponding ports in board to properties created in code

// Any sensor can be used with regard to the purpose used

// Do calibrations with values accordingly

int a = analogRead(A0); delay(500); properties.Steer = a ;

int b = analogRead(A1); delay(500); properties.Piezo_vibration = b ;

Serial.print("Time:"); Serial.print(millis()); Serial.print(" Steering control:"); Serial.print(properties.Steer, 1); Serial.print(" "); Serial.print(" Piezo vibration intensity: "); Serial.print(properties.Piezo_vibration, 1); Serial.print(" "); Serial.println();



enum msgCodeEnum propertyHandler(const char * entityName, const char * propertyName, twInfoTable ** value, char isWrite, void * userdata)


char * asterisk = "*"; if (!propertyName) propertyName = asterisk; TW_LOG(TW_TRACE, "propertyHandler - Function called for Entity %s, Property %s", entityName, propertyName); if (value) {

if (strcmp(propertyName, "Steer") == 0) *value = twInfoTable_CreateFromNumber(propertyName, properties.Steer); else if (strcmp(propertyName, "Piezo_vibration") == 0) *value = twInfoTable_CreateFromNumber(propertyName, properties.Piezo_vibration); else return TWX_NOT_FOUND; return TWX_SUCCESS; } else { TW_LOG(TW_ERROR, "propertyHandler - NULL pointer for value"); return TWX_BAD_REQUEST; }


void setup()

{ int err=0;



if (WiFi.status() == WL_NO_SHIELD)

{ Serial.println("WiFi is not connected");

// don't continue:

while(true); }

// attempt to connect to Wifi network:

if ( status != WL_CONNECTED)

{ Serial.print("Wifi is connecting to "); Serial.println(ssid);

// Connect to WPA/WPA2 network:

status = WiFi.begin(ssid, pass);

// wait 10 seconds for connection: delay(10000);

} Serial.println("You're connected to the network");



Serial.println("Intel Edison communicating with cloud");


err = twApi_Initialize(serverName, port, TW_URI, apiKey, NULL, MESSAGE_CHUNK_SIZE, MESSAGE_CHUNK_SIZE, TRUE); twApi_SetSelfSignedOk(); twApi_RegisterProperty(TW_THING, thingName, "Steer", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler,NULL); twApi_RegisterProperty(TW_THING, thingName, "Piezo_vibration", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler,NULL); twApi_BindThing(thingName);

/* Connecting to server */


{ Serial.println("Sucessefully connected to cloud!"); delay(1000); }


void loop()

{ delay(1000);



Step 8: Arduino Code - Points to Ponder

  • The Arduino code explained in terms of comment lines in each and every part of code can be ascertained.
  • As mentioned earlier, any of the cloud platforms can be used with Intel Edison owing to its wide range of incredibility and reliability. In this juncture, I am going to use Intel IOT Dashboard to plot the sensor values in a graph and also ThingWorx cloud platform to display the values through cloud processing in gauge type displays.
  • Certainly, the ThingWorx libraries have to be added using the Arduino IDE command,

Sketch -> Include library -> Add .ZIP Library

  • The ThingWorx TWX2 library is available in many Github repositories.
  • The sensor values are updated through function dataCollectionTask(); and then property values are updated.
  • Moreover, the server name along with the correct WiFi will for sure enable the error-free compilation of code.

Step 9: Cloud Processing and Display

  • The mashup created using ThingWorx cloud consists of LED Bars, Gauges for displaying the rotary angle and piezo-vibration sensor values.
  • Similarly , Intel IoT Dashboard can also be used to facilitate graphical plot with regard to the reference link :

  • In layman's context, let me try explaining it with an example,

"Consider a person driving rashly in a road/highway. His/Her driving skills can be monitored anywhere around the world by the secured set of people who can affirm the results of driving pattern analysis results. Yeah ! The corresponding person will be given a warning or at times, license can also be pulled back"

  • And so, with this cloud monitoring system, a precautionary monitoring system is established so that accidents and mishaps due to negligence of driver can be avoided.
  • With everything set and ready, lets go ahead with the compilation of code.

Step 10: Compile Code to Compute Cloud

  • With the Arduino code being ready, at first Verify it using

Sketch -> Verify/Compile

  • Finally, dump it in Intel Edison using

Sketch ->Upload

  • Note :

Make sure that the Board and Port is assigned correctly under Tools menu

Step 11: The Output Outlook

  • The rotary angle sensor provides a steering type environment in an automobile.
  • Based on the steering control and speed, the driving pattern analysis is carried out as per the code.
  • Try changing the positions of Rotary Angle Sensor and tap Piezo Vibration Sensor to observe the changes in cloud platform.
  • As a result, you can keep the Edison setup with rotary angle sensor connected to the steering control in car to carry out the driving pattern analysis.
  • To affirm the results on a accurate basis, I have developed a robotic car, wherein I have used ultrasonic sensors ( to determine the distance maintained between moving objects ), accelerometer and GPS ( to calculate the speed ) respectively.
  • Thus, from any location around the globe, you can do this stuff and observe the output.
  • I have attached the images of outputs in THINGWORX and INTEL IOT DASHBOARD cloud platforms.
  • That's the significance of cloud computing in IoT domain using Intel Edison

Step 12: Driving Pattern Analysis - Instructions

  • A model prototype of the 'Driving Pattern Analysis' can be set up with sensor based network.
  • Robotic car controlled by means of Intel Edison micro-controller with motor shield ( shown in figure ) connected servo of robotic car, rotary encoder, piezo-vibration sensor is used here.
  • In the sample prototype, the robotic car is controlled through the smart phone application so that a real time environment can be effectuated.
  • And the model presented has LED based visual representation to present the results.
  • Three cases of ascertaining the skills of the driver have been introduced as follows :
  • Good (Green), Warning (Amber) and Bad (Red) indications are provided through the LEDs
  • With simulation environment developed using cloud platform along with this real time application, the driving pattern analysis can be established.

Exploration Trivia

As an extended version of this concept, a 'Connected Cars' application with the use of OBD unit was developed. Do have fun watching the video ! The link is as follows :

Step 13: WiFi Roads - Instructions

  • Based on the intensity of vibrations sensed using piezo sensor connected to Intel Edison, the piezo electric energy is tapped according to the circuit attached in photo.
  • The tapped energy can be stored in a battery which can then be used to power the automobiles.
  • By placing relatively inexpensive piezoelectric sensors underneath a road, the vibrations produced by vehicles can be converted into electricity which is stored at battery charging tanks kept at main specific locations in the city.
  • To improve the efficiency, I have used the piezo plates with rectifier circuit.
  • This gives the output of around 40 Volt with Voltage doubler.
  • If implemented with parallel connection using capacitors, it can generate a large potential.
  • Thus, if established on a grand scale, the piezo energy will be the most tapped green energy in the future.
  • Kudos to Intel Edison for assisting in this task !

Step 14: The Complete Prototype Preparation

Preparation for the complete prototype can be summed up as follows :

  • Integrate the Intel Edison setup with sensors in the automobile like cars.
  • Just observe the output through the cloud platform.
  • With the digitized results, the driving pattern analysis is carried out.
  • On the basis of vibration produced, the energy generated on roads by piezo crystals is tapped accordingly.
  • Have an eco-friendly transit and hassle-free transportation.
  • Driving pattern analysis

Analyze the skills of a driver using the output of sensor values plotted on cloud with respect to virtual simulation environment developed which can be used by many organizations like school/ college management, driving schools, transport offices .etc

  • WiFi Roads

Today's green energy is tomorrow's treasure. So lets try generating electricity just by deploying the piezo crystals underneath the roads after measuring the corresponding intensities using sensors.

From bullock carts of the past to the Benz cars of the present,technology is taking strides in every aspect and enhancing prospect to facilitate mobility. Certainly, with the implementation of "Smart Eco-Driving System", the traffic and transit patterns can be devised to a new level of technology that is innovative and pragmatic, thanks to Intel Edison.

Courtesy : PTC ThingWorx, Intel, SeeedStudio

Special thanks for your patience and I had much fun sharing my insights on building this project. Keep developing ...

Intel® IoT Invitational

Participated in the
Intel® IoT Invitational