Thursday, September 07, 2017

Duplicate IP Detection in Network

Duplicate IP problem can create trouble time in your network; mostly you will feel it frequenclty dropped connection. It might be caused by wrong DCHP server configuration or more than one network device functioning as DHCP server.

Option 1 :

To detect if it is the case for your problem; you can simply check ARP packets with Wireshark and you will see some packets like the capture below :


Option 2 :

If you dont have Wireshark installed on your device with you. You can use arp-scan command :

$ sudo arp-scan -I eth0 -l | grep -i dup
10.10.5.68 e0:ca:94:d9:ed:80 Askey Computer (DUP: 2)
10.10.5.89 bc:a9:20:e4:85:8e (Unknown) (DUP: 2)
10.10.5.94 78:31:c1:c4:54:e4 (Unknown) (DUP: 2)
10.10.5.71 5c:f8:a1:e7:80:5a (Unknown) (DUP: 2)
10.10.5.83 b0:70:2d:a4:9c:97 (Unknown) (DUP: 2)
10.10.5.143 10:a5:d0:05:9c:85 (Unknown) (DUP: 1)
10.10.5.100 80:19:34:82:34:a8 (Unknown) (DUP: 2)
10.10.5.114 40:40:a7:e1:80:02 (Unknown) (DUP: 1)
10.10.5.99 b0:72:bf:7d:e4:f0 (Unknown) (DUP: 2)
10.10.5.125 64:bc:0c:64:54:87 (Unknown) (DUP: 1)
10.10.5.146 c4:9a:02:5a:2d:db (Unknown) (DUP: 1)
10.10.5.146 c4:9a:02:5a:2d:db (Unknown) (DUP: 2)


Monday, April 10, 2017

A Bluetooth IoT Gateway (BLE-CC41A)

An IoT gateway is the bridge for your things (within this project's scope; it is embedded Bluetooth nodes) to make them able to talk to your cloud server. Most of embedded WiFi modules comes with support of application layer capabilities (such as HTTP requests). But non Bluetooth modules that i have seen had such capabilities in application layer - at least the ones i saw. Most of Bluetooth modules that i tested, access to internet through mobile phone applications. But you might not have "a mobile phone" in your system design all the time. So this was one of my project that i started with such motivation, but sadly i had to leave it in half way. This piece of code manages Bluetooth modules  and give them HTTP request capability. Even though this project have long way to go; it does what it has to in modest level.

Github : 
https://github.com/kerematam/IoT-Gateway-BLE-CC41a


What does this Gateway do? :

  1. This Gateway automatically searches for BLE-CC41A module on each serial port.
  2. Configures the serially connected BLE-CC41A module as master.
  3. Searches for availible slave modules around.
  4. Establishes connection between master and slaves.
  5. Sends requests of slaves to cloud server.


Requirements :

  1. A linux machine able to run Python 2.7. I have developed and tested this gateway on Ubuntu 14.04 machine.
  2. Gateway hardware should have at least one ethernet (to cloud server) and one serial USB port (for BLE-CC41A module).
  3. A cloud server: I have used my own cloudserver.
    3.1. You can go with thingspeak.com and update the code accordingly.
    3.2. Wait for me to upload my cloudserver code to handle http requests
    3.3. Write your own servercode.
  4. Couple of BLE-CC41A modules. It is clone of HM10.

Configuration :You must modify server_url and api_key variables in main.py


alt tag

Monday, March 13, 2017

Making an IoT Project from Scratch : Intro - kerem izzet atam

I have been developing embedded projects since my university years to now. When i looked back i see that i have done so many projects and left them behind without documented. This is my first attempt to document my experiences on IoT projects. I will try to explain my approaches, methods and experience in my projects together with source codes and pretty much every technical details that i can provide. Hopefully i will finish this article series explaining every steps that i took by taking it from very beginning to end.



Sunday, March 05, 2017

Hands on Docker Tutorial : Running a Container with WordPress - kerem izzet atam

In this tutorial i will show my steps to install Docker on Ubuntu 14.04 and run container having WordPress on it. I have prepared this tutorial within my first attempt to try Docker so don't judge me for any miss leading parts.

I have been hearing mighty """Docker""" and its capabilities for a while but never dare to share time to read and learn so far. Today it was my first attempt to investigate as one of my colleague was talking about it again with such excitement. So i decided give a shot. As i am lazy person to read and excited person to try technologies i directly go into doing something... Lets run some server application (WordPresss) with Docker on my Ubuntu 14.04 machine.

Before we start let me tell how you might like Docker (as my friend's words) : "It runs like virtual machine but lot more light weight with container mechanism" and "You can search for different containers with different configurations and install it to your PC in seconds".

As i am lazy, selfish, solution oriented, so-called engineer, i ask "how is it useful for me?" So...

Is Docker useful for you?
  • Do you remember the time your efforts to prepare your development environment again and again each time you need to copy it other PCs; messing with all these tool chain installations, satisfying all those repository requirements and so on. 
  • Do you remember when you need to create independent environment variables for different projects and applications like php 5 for this php 7 for that.
  • Do you remember the time when you work with team overseas and you need to share same configurations to your colleague of your OS.
  • Do you remember your struggles to move your cloud server; re configuring all those configurations and facing same problems during installations.
If you remember, yes! Probably it will save your time as you will have very light weight version of your PC or server as container. You can keep those containers on cloud and install it whenever you want, like an application.

STEPS 

As summary of istructions on this official tutorial  : https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository

1 - Clean if you have old versions of it : 

$ sudo apt-get remove docker docker-engine

2- Update and Install :

$ sudo apt-get update
$ sudo apt-get install \ linux-image-extra-$(uname -r) \ linux-image-extra-virtual

$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common

$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common

3- Verify finger prints :

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
$ sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) 
sub   4096R/F273FCD8 2017-02-22
Done! Dockers is installed.

4- Now go to site : https://hub.docker.com/ , Search for "WordPress" and click on detail of first result.












5- You will see page under this URL https://hub.docker.com/_/wordpress/ and check the command to command to pull this container as :
$ sudo pull wordpress


6- Run the container : 
$ sudo pull wordpress


7- Access to shell of container :
$ sudo docker run -it wordpress /bin/bash

8- Check running containers on host PC  :
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0acccb9e18ce wordpress "docker-entrypoint..." 10 seconds ago Up 9 seconds 80/

9- Query IP of container by ID. We learn ID of our container from previous command as 0acccb9e18ce :
sudo docker inspect 0acccb9e18ce | grep "IPAddress"
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.2",
                    "IPAddress": "172.17.0.2",

10- Now i can browse through my WordPress container from IP "172.17.0.2"


This tutorial is only for testing. Step 6 should be applied with command below according to instruction in WordPress. This will link our WordPress container with another container having mySQL. :
sudo docker run --name some-wordpress --link some-mysql:mysql -d wordpress


Kerem İzzet ATAM

Friday, February 17, 2017

Git Cheat Shit

Create Repo
## git repo is created bitbucketi
## to put your project on local to remote server
git init
git remote add origin [user name]@[git url]
git add .
git commit -m "message for 1st commit"
git push -u origin master

Make Commit
## to make commit your updates
git status
git add --all
git commit -m "Love you!"
git push -u origin master
Undo git add
## unstage change before commit
git status
git reset file_name.asd
git status

Undo git add
## unstage change before commit
git status
git reset file_name.asd

Clone
## to take the repo
git clone [user name]@[git url]

Update Project from Remote Repo
## to update 
git remote update
git status
git pull

Clean Local Changes and Update
## overwrite local changes
git fetch
git reset --hard origin/master

Show Latest Version of Only Single File
## show head version of file
git show HEAD^:admin/[file name]

Show Difference Between Local File and Latest Version
## to see difference
git diff HEAD^^ [file name]

Return Lastest Commit 
git reset --hard HEAD^

Show Branches 
## show available branches
git branch -a

## show remote branches
git branch -r

Create Branch
## create branch locally
git branch [new branch name]

Switch to Branch
## switch to branch to branch
## 1st you must 
git checkout master
git checkout [branch name]

Push new Commit to Branch
git add .
git commit -m “Love me!”
git push origin 
Create new branch on current existing project
## when you started project and you decide to make it new branch
git checkout -b 
git add 
git commit -m "i decide this code to be new branch"
git push origin

Merge Branch with Master
## switch to master
git checkout master 
git merge 

## commit if works
git push origin master

Delete Branch Locally
git branch -d 

Delete Branch Remotely
git push origin --delete 

Pull Master Branch over New Branch
git pull origin master

Merge with Master Branch with Conflict
git checkout master
git merge 
    ## command output :
    Auto-merging index.html CONFLICT (content): Merge conflict in some-conflict-file 
    Automatic merge failed; fix conflicts and then commit the result.
git checkout master git merge ## fix the issues with meld git mergetool --tool meld git commit git origin master
 
Revert to Previous Commit on Remote Repo
## use soft to keep the mistaken commit
git reset --hard 
git commit -m 'restoring the mistaken commit to master branch'
git push -u origin master
 
Revert to Previous Commit on Remote Repo
## use soft to keep the mistaken commit
git reset --hard git commit -m 'restoring the mistaken commit to master branch'
git push -u origin master
 
Clean the local Changes
## show files to be deleted
git clean -n 

## say good bye to your files
git clean -f
 
## aand directories
git clean -f -d 

## clean ignored files
git clean -f -X

Monday, February 13, 2017

Interview About Duyum Project has made into Turkish TV - kerem izzet atam

Duyum Project is smart home automation that we have been developing for a while to solve daily life problems of people with hearing troubles in home environment. It allows these people to feel sounds from various sources in home like door bell, baby cry or any kinds of alarms with the Duyum sensor nodes. Once Duyum node triggers with sound, it notifies Pebble smart watch on person with both vibration and related image.