Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module

Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module

We will connect ARDUINO with ThingSpeak using TCP Connection and HTTP port with GET method.

Required:
1-      Arduino Uno
2-      ESP 8266
3-      Jumper Wires
4-      Account on ThingSpeak

Circuit Diagram:
·         ESP Vcc, and CH_PD PIN to Arduino 3.3V
·         ESP GND PIN to Arduino GND Pin
·         ESP RXD to Arduino pin 1 (TX)
·         ESP TXD to Arduino pin 0 (RX)
Testing circuit:
Open serial monitor and enter “AT”. The response should be “OK”, otherwise your circuit is not properly connected.
ACCOUNT on ThingSpeak:
Visit www.thingspeak.com and click on the "Get Started" button to make a free account.
Now click on the "New Channel" (second image above). Give it a name and select two fields. If you want you can fill more info about your channel, e.g. Latitude and Longitude of your sensor. If you want to share sensor info with your friends (and more...) click on the "Make Public?" check box option. Finally click on the "Save Channel" button.
Click on your new channel and select the API keys tab.
Copy GET Method for Write/ Send, using Write API Key, as follows:

Connecting with WIFI:
In serial monitor type following commands:
AT+CWMODE=1 // This is to program ESP for basic connection mode
AT+CWJAP="Android","12345678" // This command connects with SSID= Android with PW= 12345678
Creating a TCP Connection and sending data:
In serial monitor type following commands:
AT+CIPSTART="TCP","184.106.153.149",80 // The IP is for ThingSpeak website
AT+CIPSEND=52 // This is the length of the text we will send using GET Method
GET /update?api_key=QLOQF4XBLZPIOHIL&field1=65\r\n // In get method, use your API Write key and remove thingspeak domain address. Must add “\r\n” at the end.

If all above commands go well, the you will get some response, otherwise after some time connection will get closed.



Flow-Monitor in NS3. A Perfect Tool For Evaluation Purposes. (Throughput, Delay, Jitter, Packet Loss and Other Parameters in NS3)

Flow Monitor:
                A set of evaluation criteria are the focus of every simulation, using which a proposed scheme can be evaluated. In communications, specifically wireless communications, more specifically LTE, major evaluation criteria are:
  • -          Delay (end-to-end mean delay)
  • -          Throughput
  • -          Packet loss ratio
  • -          Mean Jitter
  • -          Mean transmitted packet size (bytes)
  • -          Mean received packet size (bytes)
  • -          Means transmitted bitrate (bit/s)
  • -          Means received bitrate (bit/s)
  • -          Mean hop count
  • -          Lost packets


In any NS3 simulations, you can easily calculate parameters mentioned above using FLOW-MONITOR.

How to use flow-monitor in code:

1-      Include flow-monitor header file.
#include "ns3/flow-monitor-module.h"
2-      Add following code snippet before “Simulator Stop();”. This code will assign a monitor to each node.
Ptr<FlowMonitor> flowMonitor;
FlowMonitorHelper flowHelper;
flowMonitor = flowHelper.InstallAll();
Simulator::Stop(Seconds(simTime));

If you are interested in installing monitor to each node separately, then use “Install” method instead of “InstallAll”. But I would prefer to install flow-monitor on all nodes J .
flowMonitor = flowHelper.Install (nodes);

3-      Finally, we print output to an XML file. Add this line after “Simulator Run();”.
flowMonitor->SerializeToXmlFile("NameOfFile.xml", true, true);


That’s it. Using above three steps, you can easily add flow monitor to all node. The NameOfFile.XML file will be generated in your NS3 directory.

How to visualize output:

The XML file can be viewed by any XML viewer. I found NetAnim (A basic guide to netanim is here) to be the best viewer for the flow monitor.
1-      Open NetAnim (Make sure you see three tabs in netanim, Animator, Stats, and Packets)
2-      Click “Stats” tab
3-      From dropdown menu, select Flow-monitor. (The dropdown menu will show IP-MAC in start)
4-      Click “FlowMon file” button on the right.
5-      Browse to your NS3 directory and select “NameOfFile.XML” file.
6-      The file will display every flow with its parameters and values.
For your convenience J .
 



Using all these values, many evaluation parameters can be calculated. Next section will show you how to calculate those parameters from these values.

Parameters:

Some parameters are directly calculated and rest can be calculated using these formulae.
Throughput (bps): rxBytes*8 / [(timeLastRxPacket/1,000,000,000)- (timeFirstRxPacket/1,000,000,000)]
And
Throughput (Mbps): rxBytes*8 / [(timeLastRxPacket/1,000,000,000)- (timeFirstRxPacket/1,000,000,000)] / 1024 / 1024


 



References and material:
  1. FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3), online: http://telecom.inesctec.pt/~gjc/flowmon-presentation.pdf
  2. NS-3 Advanced Tutorial: Visualization and Data Collection, Online: https://www.nsnam.org/tutorials/consortium13/visualization-tutorial.pdf
  3. https://www.nsnam.org/docs/models/html/flow-monitor.html
  4. Throughput: http://comments.gmane.org/gmane.network.simulator.ns3.user/18301
  5. https://groups.google.com/forum/#!topic/ns-3-users/NuScxlCA8H0
  6. https://groups.google.com/forum/#!msg/ns-3-users/Z2pgY6tbJgM/viiOwlfeu4kJ
  7. https://groups.google.com/forum/#!topic/ns-3-users/8rxd2VfHsFg
  8. https://groups.google.com/forum/#!topic/ns-3-users/nXuyOZaazbU

NetAnim for NS3, Graphical simulation animation and statistics for NS3 simulation

Dear Fellow,
         This tutorial is to help you configure and run NetAnim with NS3. I hope you have already installed NS3 in ubuntu. If not refer my previous post for NS3 installation.
To configure go in netanim directory. This directory you can find in NS3 folder.

Prerequisites

  1. mercurial
  2. QT4 development packages (recommended version 4.7)

Debian/Ubuntu Linux distribution:

  1. apt-get install mercurial
  2. apt-get install qt4-dev-tools


root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/netanim-3.105#

after that use these commands:

make clean
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)
make

after these commands netanim will be configure. NetAnim can be used to read *.xml files generated by your code. Lets assume we are using /example/tutorial/third.cc file. add following lines of code in this file. (its better to copy this file first in scratch folder)

For adding ns3 to your program, do the following
1. Add the header file

#include "ns3/netanim-module.h"

2. Add the following statement before Simulation::Run()

AnimationInterface anim ("animation.xml"); 
anim.SetMobilityPollInterval(Seconds(0.25));
anim.EnablePacketMetadata(true);



References: http://www.nsnam.org/wiki/NetAnim

by using these lines a new file will be created named as animation.xml
now go in

root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/# 

and type

root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/# ./netanim-3.105/NetAnim

This will open graphical interface of NetAnim, use open file and open animation.xml
By play button you can easily play the simulation.

Note: There is different interface that you can encounter. Using above method you will get full interface.
In above picture you can see 3 tabs.
But if you open netanim from dashboard you will get minimal view.
. (This is due to root permissions :) )


Thats all for now.
GOOD LUCK.. 

Installing NS3 with LENA (LTE Simulation) Module in Ubuntu 14

NOTE: 5G/ mmWave NS3 SIMULATOR IS AVAILABLE NOW. https://github.com/mmezzavilla/ns3-mmwave



Dear Friends,
      I am sharing my experience of installing LTE module LENA and NS3 in Ubuntu. I Hope this will help you. I have installed Ubuntu in VMPlayer with 1.7GB RAM assigned.
  • Install Ubuntu in VMPlayer
    • Download VMPlayer
      • https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0
    • Download Ubuntu ISO
      • http://www.ubuntu.com/download/desktop
  • After installation U need to install prerequisite of NS3
    • This link contain all the commands for Ubuntu. But I am adding those commands here for your ease.
      http://www.nsnam.org/wiki/Installation#Ubuntu.2FDebian
NOTE: NS3 simulator requires some other programs (dependencies) to be installed already in your system. You can install those dependencies using these commands:

  sudo apt-get install gcc g++ python

  sudo apt-get install gcc g++ python python-dev
  sudo apt-get install mercurial
  sudo apt-get install bzr
  sudo apt-get install gdb valgrind 
  sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
  sudo apt-get install flex bison libfl-dev
  sudo apt-get install g++-3.4 gcc-3.4
  sudo apt-get install tcpdump
  sudo apt-get install sqlite sqlite3 libsqlite3-dev
  sudo apt-get install libxml2 libxml2-dev
  sudo apt-get install libgtk2.0-0 libgtk2.0-dev
  sudo apt-get install vtun lxc
  sudo apt-get install uncrustify
  sudo apt-get install doxygen graphviz imagemagick
  sudo apt-get install texlive texlive-extra-utils texlive-latex-extra
  sudo apt-get install python-sphinx dia 
  sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
  sudo apt-get install libboost-signals-dev libboost-filesystem-dev
  sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
  sudo apt-get install gcc-multilib

Section 1:All in one install
 
This tutorial will guide you to install NS3 in your UBUNTU 14. I have installed Ubuntu 14 in VMplayer virtual environment.
To install NS3 use this:

1 cd
2 mkdir workspace
3 cd workspace
4 wget http://www.nsnam.org/releases/ns-allinone-3.21.tar.bz2

If above does not work try downloading latest tar from : http://www.nsnam.org/ns-3-21/ 
Download the latest ns3 stable release: https://www.nsnam.org/release/ns-allinone-3.24.1.tar.bz2 or from here: https://www.nsnam.org/ns-3-24/
after downloading cp the file to workspace folder

$ sudo cp /home/user/Downloads/ns3-allinone-3.21 ~/workspace/

above command will copy the file then use 
$ cd ~/workspace/

5 tar xjf ns-allinone-3.21.tar.bz2
this will create a workspace folder and in that folder will create ns-allinone folder.
Problem: Now if you are unable to download above ns3 tar file then download it manually using:
or
and copy the file in workspace using
cp /home/hassan/Downlaods/ns-allinone-3.21.tar.bz2  ~/workspace

after copy use step 5 (given above) to untar the files. After untar use this command to build.
Change the directory and go to ns3 folder.

./build.py 
./build.py --enable-examples --enable-tests

after build you will have some folder that you can see using ls command.

cd ns-3.21

so that you get in to ns3 directory then use waf to configure ns3


$ ./waf clean
$ ./waf configure --build-profile=debug --out=build/debug
$ ./waf configure --build-profile=optimized --out=build/optimized
$ ./waf configure --enable-examples –-enable-tests
$ ./waf build
(Note: If tests and examplse are still disabled use:)
cd ..
./build.py --enable-examples --enable-tests
Now if everything
goes well you can test your NS3 by:
./test.py -c core
and You should see 
92 of 92 tests
passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors)
Now lets run one
script so that we can be sure of NS3.
./waf
./waf –run hello-simulator
Ta da .. Done . 
In case you have difficulties running hello-simulator code. Try configuring WAF again:

Configuration with Waf 

 ./waf -d optimized configure; ./waf 
 ./waf distclean ./waf configure    // (or use this > ./waf configure –enable-  examples –enable-tests)
 ./build.py --enable-examples --enable-tests  // we are enabling example and test by build
 ./waf configure --enable-examples --enable-tests // we are enabling example and test by waf
./waf build
  •  Now as You are good to go with ./waf to run scripts.
  • to run any script use
./waf --run first // to run file first.cc while your root folder should be ns3.17

Using Above method I have found that LTE is supported and installed already in NS3 . So no need to install separate module.
So Now lets run a simple LTE file with 1 enb and some devices.
You can refer this file documentation here and source code here.

Put lte_basic_example.cc in scratch folder.

./waf
./waf --run lte_basic_example

This will not generate any output on console but I have added some code to generate an xml file to read in NetAnim program. You will see a file in ns3 folder named as lte_animation_test.xml you can use netanim to read and simulate LTE basic scenario. To understand how to run netanim go here.

I HOPE THAT NOTHING IS MISSING, HAPPY CODING GUYS. "GOOD LUCK"                <WRITE COMMENT FOR ANY QUERY>

Permissions in android and intrusion in the privacy of a person's personal life, Facebook messenger's permissions

(Solved) Intrusion of the android apps specially Facebook messenger on Personal information <No  Purchase>:


Hi Friends, 

       I read and saw some news about the privacy issues with facebook and its application on android phone like :

http://www.youtube.com/watch?v=FzGMcJ_DMLo
http://www.onthemedia.org/story/why-facebook-wants-access-your-phones-microphone-all-times/
http://mashable.com/2014/08/11/stop-freaking-out-about-facebook-messenger-app-permissions/

and other articles and videos.
So gave my self a thought that why the hell do Facebook need permission which are not related to the operation of the application like reading/sending my sms/contact/calls, storage, recording features and much more.


On the other hand I want to use Facebook and its messenger. Now how to get around this problem so I searched a bit and got a workaround.
In short (for geek/nerd kind of guys) what I did (Galaxy S3) is :

Updated: I put a comparison of permission on android apps (Facebook, Facebook messenger, Skype, Viber) that I use normally. and also I used above procedure to remove some permissions. details are here:
https://app.box.com/s/c0g6u5xx34s31vktdlr3

Detailed information about the process from start:

  • Root your device
  • Install Xposed framework
    • http://repo.xposed.info/module/de.robv.android.xposed.installer
    • First you need to install framework, copy apk in your device and then use it. Make sure your unknown sources is checked in setting. If you dont know unknown sources setting, this might help
    • http://goo.gl/G59aDa
    • After installation it might ask you to grant supersu permission to XposedFramework, grant it
  • Install AppSetting framework from xposed repository 

Select Xposed Installer
Selects Modules

Enable App Settings and Reboot


  • Using Appsetting go in facebook or any other and revoke the permissions you don't want any application to have, like removing camera,sms access from Facebook or any other applications.
Open AppSetting
Select Facebook or any app to revoke permissions

1. switch on settings
2. select permissions

1. switch on permissions
2. touch permission you want to remove and press OK
after Ok you will be redirected to above screen press save button and click ok, relaunch application and you are good to go.



  • Thats it .. Use application and be secure :) 
  • Using above process you can check application that are accessing more than they require for their operation.
  • if after revoking permissions your application crashes try revoking 1 permission at a time and relaunching application.





Good Luck Guyz.
Note: If you have any question feel free to ask or share your experiences.

Android S Planner Sync with Outlook Calendar and Google Calendar, Backward Sync Too .

Dear Friends,
          When I bought Samsung S3 I wanted an application that can remind me about my important appointments I tried many but I found S Planner available already in Phone really help. Then it came to me that I should sync my calendar to Outlook or Google so I can see and set my appointment using computer and get more ease of use.
I searched and after many searches I did it.
I want to share that experience with You so you can do it easily.

Sync with Outlook:

Requirement:
  1. Android Phone with S Planner
  2. Outlook account with calendar set up.
procedure is in snap shots:

1
 2
 3
 4
 After adding accounts from Outlook, go back to pic 3 and mark the check box with your account information.
Now while using outlook calendar you can see in your S Planner the events you added in Outlook calendar but not the events that are saved in S Planner ..
( I Also wanted backward sync )So To Sync this kind of system you have to add events on your phone using your outlook account name in SPlanner, refer the snap shot.
And your new event/task will be updated on your Outlook calendar.


Google Calendar:

For Google calendar the steps are same but with Google calendar instead of Outlook calendar. I hope I helped someone..

Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module

Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module We will connect ARDUINO with ThingSpeak using TCP Connection and HT...