2015 in review

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 50,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 19 sold-out performances for that many people to see it.

Click here to see the complete report.

Advertisements

GPRS using SIM900 and AT Commands

sim900-gprs-gsm-module-arduino-compatible

Powerup the Sim900 module
connect it to the system through serial to USB or through FTDI cable.The TTl pins for FTDI is available near to the DB9 connector.

Open any serial Terminal porogram. In Linux i use GtkTerm. Select the correct port and set
Baudrate = 9600
parity = None
Bits = 8
Stop bits = 1
Flow Control = None

Screenshot from 2015-11-26 12:49:46

 

Screenshot from 2015-11-25 20:00:44

 

The AT Commands

I am posting the commands and its reply for better understanding. I am using an Airtel postpaid sim card.
Make sure you have enough balance on Sim card.

First Command

AT

OK If your response contains this, This string should tell you all is well

This is to check if SIM is unlocked.

AT+CPIN?

+CPIN: READY If your response contains this, then it means SIM is unlocked and ready

This checks if SIM is registered or not

AT+CREG?

+CREG: 0,1 This string in the response indicates SIM is registered

Check if GPRS is attached or not

AT+CGATT?

+CGATT: 1 A response containing this string indicates GPRS is attached

Reset the IP session if any

AT+CIPSHUT

SHUT OK This string in the response represents all IP sessions shutdown.

Check if the IP stack is initialized

AT+CIPSTATUS

STATE: IP INITIAL This string in the response indicates IP stack is initialized

single connection mode,if AT+CIPMUX=1 multi connection mode

AT+CIPMUX=0

OK This string indicates single connection mode set successfully at SIM 900

This sets the PDP context parameters such as PDP type (IP, IPV6, PPP, X.25 etc), APN, data compression, header compression etc.

AT+CGDCONT=1,"IP","airtelgprs.com"

OK If your response contains this, This string should tell you all is well

you need to know the APN, username and password for your service provider
AT+CSTT= “APN”, “UNAME”, “PWD”
For Airtel

AT+CSTT="airtelgprs.com"

OK If your response contains this, This string should tell you all is well

Bring up the wireless. The response to this might take some time

AT+CIICR

OK indicates wireless is up

Get the local IP address

AT+CIFSR

aa.bb.xx.yy If previous command is successful, you should an IP address in the response

comamnd returns the current connection status

AT+CIPSTATUS

STATE:IP STATUS if not this, some thing is wrong

Start the connection, TCP, domain name, port

AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"

CONNECT OK This string in the response indicates TCP connection established

Request initiation of data sending

AT+CIPSEND

The response should be the string “>” to indicate, type your data to send
Type anything after the prompt
>This is the Test Data
Now use Ctrl+Z key combination to indicate end of data sending

You should get some response back from the server. Normally some error message. But you have established the connection

To close the connection

AT+CIPSHUT

SHUT OK Indicates shutdown successful

Screenshot from 2015-11-25 20:12:47Screenshot from 2015-11-25 21:53:44Screenshot from 2015-11-25 20:51:29

 

For the ease of Copy Pasting retyping AT commands in sequence

AT
AT+CPIN?
AT+CREG? 
AT+CGATT?
AT+CIPSHUT
AT+CIPSTATUS
AT+CIPMUX=0 
AT+CGDCONT=1,"IP","airtelgprs.com"
AT+CSTT="airtelgprs.com"
AT+CIICR
AT+CIFSR
AT+CIPSTATUS
AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"
AT+CIPSEND

Happy Hacking 🙂

2013 in review

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 49,000 times in 2013. If it were a concert at Sydney Opera House, it would take about 18 sold-out performances for that many people to see it.

Click here to see the complete report.

How to Enable clean urls in drupal 6.xx and lighttpd

To enable clean url in drupal when we use lighttpd as webserver it needs a small hack…

we need to edit the configuration file ( /etc/lighttpd/lighttpd.conf) .In the server modules “mod_rewrite” must beenabled else edit it to the same.After editing server modules look like this

server.modules              = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_compress",
            "mod_rewrite",
#           "mod_redirect",
#           "mod_evhost",
#           "mod_usertrack",
#           "mod_rrdtool",
#           "mod_webdav",
#           "mod_expire",
#           "mod_flv_streaming",
#           "mod_evasive"
            "mod_secdownload",
            "mod_flv_streaming",
)

Then add this bunch of code to the lighttpd.conf file

url.rewrite-final = (
  "^/system/test/(.*)$" => "/index.php?q=system/test/$1",
  "^/system/test-clean-url/(.*)$" => "/index.php?q=system/test-clean-url/$1",
  "^/drupal/([^.?]*)\?(.*)$" => "/drupal/index.php?q=$1&$2",
  "^/drupal/([^.?]*)$" => "/drupal/index.php?q=$1",
  "^/drupal/search/(.*)$" => "/drupal/index.php?q=search/$1",
   "/drupal/rss.xml$" => "/drupal/index.php?q=rss.xml"
)
#url.rewrite-if-not-file = (
#    "^\/([^\?]*)\?(.*)$" => "/newone/index.php?q=$1&$2",
#    "^\/(.*)$" => "/newone/index.php?q=$1"
#)

Rename the drupal with the name of your folder in the code

How to connect two linux machines via ethernet cable

Assume :

  • Computer A has ip address 192.168.0.1
  • Computer B has ip address 192.168.0.2

On Computer A:

/sbin/ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up/sbin/route add -host 192.168.0.2 eth0

On Computer B:

/sbin/ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up/sbin/route add -host 192.168.0.1 eth0

Now on Computer A you should be able to ping Computer B:

ping 192.168.0.2

and must be able to do viceversa……..  🙂