Water Level Indicator

Posted in Water Level Indicator on September 15, 2009 by csecyborg

This project is water level indicator.This is real time application in which we can use in our day to day life.

/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED)  connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().

The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
* one side pin (either one) to ground
* the other side pin to +5V
* LED anode (long leg) attached to digital output 13
* LED cathode (short leg) attached to ground

* Note: because most Arduinos have a built-in LED attached
to pin 13 on the board, the LED is optional.

Created by David Cuartielles
Modified 16 Jun 2009
By Tom Igoe

http://arduino.cc/en/Tutorial/AnalogInput

*/

int sensorPin0 = 0;    // select the input pin for the potentiometer
int sensorPin1 = 1;
int sensorPin2 = 2;
int sensorPin3 = 3;
int sensorPin4 = 4;
int sensorPin5 = 5;
int ledPin0 = 2;      // select the pin for the LED
int ledPin1 = 3;
int ledPin2 = 4;
int ledPin3 = 5;
int ledPin4 = 6;
int ledPin5 = 7;
int ledPin6 = 8;
int ledPin7 = 9;
int sensorValue0;  // variable to store the value coming from the sensor
int sensorValue1;
int sensorValue2;
int sensorValue3;
int sensorValue4;
int sensorValue5;
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
pinMode(ledPin0, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(ledPin6, OUTPUT);
pinMode(ledPin7, OUTPUT);
}

void loop() {
// read the value from the sensor:
sensorValue0 = analogRead(sensorPin0);
Serial.print(“a”);
Serial.println(sensorValue0);
if(sensorValue0<300)
// turn the ledPin on
{
digitalWrite(ledPin0, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
digitalWrite(ledPin0, LOW);
digitalWrite(ledPin6,HIGH);
digitalWrite(ledPin7,HIGH);
// turn the ledPin off:

// stop the program for for <sensorValue> milliseconds:
}

sensorValue1 = analogRead(sensorPin1);
Serial.print(“b”);
Serial.println(sensorValue1);
if(sensorValue1<450)

{// turn the ledPin on
digitalWrite(ledPin1, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin1, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue2 = analogRead(sensorPin2);
Serial.print(“c”);
Serial.println(sensorValue2);
//delay(1000);
if(sensorValue2<400)
{
// turn the ledPin on
digitalWrite(ledPin2, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin2, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue3 = analogRead(sensorPin3);
Serial.print(“d”);
Serial.println(sensorValue3);
//delay(1000);
if(sensorValue3<250)
{
// turn the ledPin on
digitalWrite(ledPin3, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin3, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue4 = analogRead(sensorPin4);
Serial.print(“e”);
Serial.println(sensorValue4);
//delay(1000);
if(sensorValue4<250)
{
// turn the ledPin on
digitalWrite(ledPin4, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin4, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue5 = analogRead(sensorPin5);
Serial.print(“f”);
Serial.println(sensorValue5);
//delay(1000);
if(sensorValue5<200)
{
// turn the ledPin on
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin5, LOW);
// stop the program for for <sensorValue> milliseconds:
}
}

Arduino door lock code

Posted in Arduino Door Lock on September 10, 2009 by csecyborg

/*  keypad_alnum sketch
*
*  Difficulty:  Intermediate
*
*  ******* THE KEYPAD REQUIRES PULL-UP RESISTORS ON THE ROW PINS. *******
*
*  Description:
*    This is a demonstration of using keypadEvents to switch between keymaps
*    while using only one keypad.  The main concepts being demonstrated are:
*
*        Using the keypad events, PRESSED, HOLD and RELEASED to simplify coding.
*        How to use setHoldTime() and why.
*        Making more than one thing happen with the same key.
*        Assigning and changing keymaps on the fly.
*
*    Another useful feature is also included with this demonstration although
*    it’s not really one of the concepts that I wanted to show you.  If you look
*    at the code in the PRESSED event you will see that the first section of that
*    code is used to scroll through three different letters on each key.  For
*    example, pressing the ’2′ key will step through the letters ‘d’, ‘e’ and ‘f’.
*
*
*  Using the keypad events, PRESSED, HOLD and RELEASED to simplify coding
*    Very simply, the PRESSED event occurs imediately upon detecting a pressed
*    key and will not happen again until after a RELEASED event.  When the HOLD
*    event fires it always falls between PRESSED and RELEASED.  However, it will
*    only occur if a key has been pressed for longer than the setHoldTime() interval.
*
*  How to use setHoldTime() and why
*    Take a look at keypad.setHoldTime(500) in the code.  It is used to set the
*    time delay between a PRESSED event and the start of a HOLD event.  The value
*    500 is in milliseconds (mS) and is equivalent to half a second.  After pressing
*    a key for 500mS the HOLD event will fire and any code contained therein will be
*    executed.  This event will stay active for as long as you hold the key except
*    in the case of bug #1 listed above.
*
*  Making more than one thing happen with the same key.
*    If you look under the PRESSED event (case PRESSED:) you will see that the ‘#’
*    is used to print a new line, Serial.println().  But take a look at the first
*    half of the HOLD event and you will see the same key being used to switch back
*    and forth between the letter and number keymaps that were created with alphaKeys[4][5]
*    and numberKeys[4][5] respectively.
*
*  Assigning and changing keymaps on the fly
*    You will see that the ‘#’ key has been designated to perform two different functions
*    depending on how long you hold it down.  If you press the ‘#’ key for less than the
*    setHoldTime() then it will print a new line.  However, if you hold if for longer
*    than that it will switch back and forth between numbers and letters.  You can see the
*    keymap changes in the HOLD event.
*
*
*  In addition…
*      You might notice a couple of things that you won’t find in the Arduino language
*    reference.  The first would be #include <ctype.h>.  This is a standard library from
*    the C programming language and though I don’t normally demonstrate these types of
*    things from outside the Arduino language reference I felt that its use here was
*    justified by the simplicity that it brings to this sketch.
*      That simplicity is provided by the two calls to isalpha(key) and isdigit(key).
*    The first one is used to decide if the key that was pressed is any letter from a-z
*    or A-Z and the second one decides if the key was any number from 0-9.  The return
*    value from these two functions is  either a zero or some positive number greater
*    than zero.  This makes it very simple to test a key and see if it is a number or
*    a letter.  So when you see the following:
*
*    if (isalpha(key))    // this is a letter key
*
*    then just remember that it is equivalent to:
*
*    if (isalpha(key) != 0)    // this is a letter key
*
*  And Finally…
*    To better understand how the event handler affects your code you will need to remember
*    that it only gets called when you press, release or hold a key.  And once you do then
*    the event handler runs at the full speed of the loop().
*
*
*  ******* THE KEYPAD REQUIRES PULL-UP RESISTORS ON THE ROW PINS. *******
*
*/

#include <Keypad.h>
#include <ctype.h>

// Define the keymaps.  The blank spot (lower left) is the space character.
char alphaKeys[4][3] = {
{ ‘a’,'d’,'g’ },
{ ‘j’,'m’,'p’ },
{ ‘s’,'v’,'y’ },
{ ‘ ‘,’.',’#’ }
};

char numberKeys[4][3] = {
{ ’1′,’2′,’3′ },
{ ’4′,’5′,’6′ },
{ ’7′,’8′,’9′ },
{ ‘ ‘,’0′,’#’ }
};
char buf[5];
char open[5]={’1′,’2′,’3′,’4′,’5′};
char close[5]={’5′,’4′,’3′,’2′,’1′};
boolean o=false;
boolean c=false;
boolean alpha = false;   // Start with the numeric keypad.

int i=0;
char* keypadMap = (alpha == true) ? makeKeymap(alphaKeys) : makeKeymap(numberKeys);

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these pins, eg. ROW0 = Arduino pin2.
byte rowPins[] = { 5, 4, 3, 2 };

// Connect keypad COL0, COL1 and COL2 to these pins, eg. COL0 = Arduino pin6.
byte colPins[] = { 8, 7, 6 };

//create a new Keypad
Keypad keypad = Keypad(keypadMap, rowPins, colPins, sizeof(rowPins), sizeof(colPins));

const byte ledPin = 13;                                                     // Use the LED on pin 13.

void setup() {
Serial.begin(9600);
digitalWrite(ledPin, HIGH);                                                // Turns the LED on.
keypad.addEventListener(keypadEvent);                                      // Add an event listener.
keypad.setHoldTime(500);                                                   // Default is 1000mS
keypad.setDebounceTime(250);
// Default is 50mS
pinMode(ledPin,OUTPUT);
}

void loop() {
char key = keypad.getKey();

if (alpha) {                      // Flash the LED if we are using the letter keymap.
digitalWrite(ledPin,!digitalRead(ledPin));
delay(100);
}
}

// Take care of some special events.
void keypadEvent(KeypadEvent key) {
static char virtKey = NO_KEY;      // Stores the last virtual key press. (Alpha keys only)
static char physKey = NO_KEY;      // Stores the last physical key press. (Alpha keys only)
static char buildStr[12];
static byte buildCount;
static byte pressCount;

switch (keypad.getState())
{
case PRESSED:
if (isalpha(key)) {              // This is a letter key so we’re using the letter keymap.
if (physKey != key) {        // New key so start with the first of 3 characters.
pressCount = 0;
virtKey = key;
physKey = key;
}
else {                       // Pressed the same key again…
virtKey++;               // so select the next character on that key.
pressCount++;            // Tracks how many times we press the same key.
}
if (pressCount > 2) {        // Last character reached so cycle back to start.
pressCount = 0;
virtKey = key;
}
Serial.print(virtKey);       // Used for testing.
}
if (isdigit(key) || key == ‘ ‘ || key == ‘.’) {

//Serial.print(key);
buf[i]=key;
i++;

}
if (key == ‘#’) {

//Serial.println();
i=0;
Serial.println(buf);
for(int j=0;j<5;j++){
if(buf[j]==open[j]){o=true;}
else{o=false; break;}
}
for(int j=0;j<5;j++){
if(buf[j]==close[j]){c=true;}
else{c=false;break;}
}
if(o){digitalWrite(12,HIGH);digitalWrite(11,LOW);}
if(c){digitalWrite(12,LOW);digitalWrite(11,HIGH);}

}
break;

case HOLD:
if (key == ‘#’)  {                   // Toggle between keymaps.
if (alpha == true)  {            // We are currently using a keymap with letters
keypad.begin(*numberKeys);   // and want to change to numbers.
alpha = false;
}
else  {                          // Or, we are currently using a keymap with numbers
keypad.begin(*alphaKeys);    // and want to change to letters.
alpha = true;
}
}
else  {                             // Some key other than ‘#’ was pressed.
buildStr[buildCount++] = (isalpha(key)) ? virtKey : key;
buildStr[buildCount] = ”;
Serial.println();
Serial.println(buildStr);
}
break;

case RELEASED:
if (buildCount >= sizeof(buildStr))  buildCount = 0;    // Our string is full. Start fresh.
break;

}  // end switch-case
}  // end keypad events

JOB FORWARDING

Posted in Job forwarding on September 9, 2009 by csecyborg

OBJECTIVE:   Send job alerts to mobiles

           Initially we need to design a web page where we collect the details about the area of interest and the mobile number of the candidate. This web page can be designed using HTML that links to a PHP page. In the area of interest column the user can mention which programming language he is interested in.
      Secondly we need to create a database where the details of various companies are stored. That is, which company is implementing which programming language. These details need to be updated regularly.
      Supposing, a user enters that his area of interest is JAVA, he must be sent a message that tells about the companies which are implementing java language as their base. The major task is to compare the area of interest with the details stored in the database and produce the required company information back to the user as a text message to their mobile number.

Front end —— PHP
Back end —— MySQL

STEPS TO BE FOLLOWED:

 STEP 1: Install apache2, mysql and phpmyadmin in your system

 STEP 2: Create a form using HTML to get the details from the user such as,

                     Name, Mobile Number, Qualification, Area of interest, Experience, etc. and submit the form

 STEP 3: To submit these details, write coding in PHP, which connects to the database “job” that is       already created

 <?php

$con = mysql_connect(“localhost”,”root”,”");

if (!$con)

  {  die(‘Could not connect: ‘ . mysql_error());  }

mysql_select_db(“job”, $con);

$sql=”INSERT INTO jobfrwd(name,mno,qual,area,exp)

VALUES

(‘$_GET[name]‘,’$_GET[mno]‘,’$_GET[qual]‘,’$_GET[area]‘,’$_GET[exp]‘)”;

if (!mysql_query($sql,$con))

  {  die(‘Error: ‘ . mysql_error());  }

echo “Your record added successfully”;

mysql_close($con)

?>

<br><br>

<a href=”jobfrwd.html”>Back</a>

 This code enters your details in the database “job” in the table say ”jobfrwd”.

 STEP 4: Create another table “company” in same database.

                     Enter the details of few companies with the company

                     name,address,field in which the company works,   

                     vacancy in the table.

STEP 5: Create another table say “compare” in the same database with the

                   following fields –name of the person,mobile number,company,  vacancy.

 STEP 6: Write a PHP code for comparing the user’s area of interest (in table “jobfrwd”) that matches with the field of the company(in the table“company”)

$sql = “SELECT  jobfrwd.name,jobfrwd.mno,company.company,company.vacancy

                FROM jobfrwd, company WHERE jobfrwd.area = company.field”;

 $sql=”INSERT INTO compare (name, mno, company,vacancy)VALUES(‘$name’,'$mno’,'$company’,'$vacancy’)”;

       The result of the above code is stored in the database “job” in the table “compare”. Now this table gives the name of the user, mobile number, company name, vacancy.

 STEP 7: Next we need to send SMS to the user regarding the company that                 

        matched his area of interest and if there is any vacancy available.

                    1.   For this we must first install gnokii software using the following code.

                                 sudo apt-get install gnokii

                    2.   Then connect a Bluetooth device to the system

To connect the mobile and sys ON the Bluetooth in mobile and system,for system use bluetooth dongle.

In system the Bluetooth symbol appears as

Note:   *in bluetooth symbol click and get preference and select “service”

In this symbol right click and select “Browse device” and select the your mobile and click “connect” ,and accept the message in mobile and give any passkey and click ok. Now the mobile and system are paired successfully.

Now goto terminal type,

                sudo gedit /etc/gnokiirc

The file opens, change the settings as follows

  • in 27th line default present like #port = aa:bb:cc:dd:ee:ff,  change port = aa:bb:cc:dd:ee:ff and we want the mobile id or address to get(when mobile and sys connected only) type in terminal like     

            hcitool scan

  • It gives the paired device mac address copy this .
  • Paste in the 27th line like port = aa:bb:cc:dd:ee:ff change port = “your mobile address”
  • Enable model = AT in 51th line disable #model=6110
  • In line 101 remove # from connection = bluetooth

STEP 7: Write a code in PYTHON for sending SMS to the users whose   

        names are in the compare table.Run the program in terminal as follows.

                python sms.py

 !……………………………………………………………………….!

POOR MAN’S WIFI:

Posted in Poor Man's WiFi on September 9, 2009 by csecyborg

The project is simple to install. We need a USB Wifi adapter and a USB wire.

We use BELKIN G Wireless USB network Adapter. It is supported in Windows 2000, XP and Vista 32- and 64-bit.

The G Wireless Network Adapter connects your desktop or notebook computer to wireless network. With a BELKIN G Wireless router as a central connection point of the network,this an easy solution for smaller homes needing to share high speed internet connection as well as files printers and hard drives.

The cost of our project is Rs.1100.00/-

1.BELKIN G wireless USB adapter-Rs.950.00/-

2.USB wire Extension-Rs.150.00/-

Hence the project is completed successfully……..

os cd scratch:

Posted in OS CD on September 9, 2009 by csecyborg

OS CD SCRATCH:
In this there is no hardware requirement.We are installed RECONSTRUCTOR TOOL.Using that tool we have to completely change our operating system apperance.
In reconstructor is normally placed in system tools in our os.Using this we have to customize following things.
1.Boot Screen
2.Gnome
3.Apt
4.Optimization
5.Live CD
6.Modules
Boot Screen:
In this we have to change our boot screen apperance.
Gnome:
In this we have to change our theme,text color,desktop,font style.
Apt:
In this we have to select repositories our wish.
Optimization:
In this enable startup,login.

Live CD:
This part we have to set username,password for login to enable secure os.
Modules:
This part we have to select modules that needed for our use.
Reconstructor contain two terminals:
1.Terminal
2.ChrootX
Using this two terminals we have to visualize changes on screen.
Finally we have to give apply in reconstructor window.It will apply what are the changes you have done till now that changes are applied.
Finally give finish custom-live-Iso will created.You have to install empty CD then  write to disk.After insert that CD and boot from that CD.Now your OS apperance will be completely change from normal OS.
WE ARE DONE THIS WORK

sms framework:

Posted in SMS FRAMEWORK on September 9, 2009 by csecyborg

SMS FRAMEWORK

In sms framework we are send sms from the system by using gnokii and ruby .in this we have to install ruby.the following steps shows installation and etc..

Steps in sms framework:

i)update system

ii)install gnokii

iii)install ruby

iv)install mysql-server 5.0.51 (or) any version

v)write the code for send sms to one or more numbers

vi)connect mobile and system

vii)send sms and enjoy……

UPDATE SYSTEM:

after install Ubuntu in u r system update the system using the following cmd in terminal..

sudo apt-get install update

INSTALL GNOKII:

Gnokii is an open source mobile phone tool that can be downloaded free of charge from the web . It was originally developed for Linux but also worked on Linux-like systems such as FreeBSD and Solaris. Today it has been ported to other platforms such as Microsoft Windows and Mac OS. However, some functions are not available in these versions.

Gnokii supports many different features. For example, sending and receiving SMS messages, reading and writing entries of the phone book and calendar, retrieving WAP bookmarks, handling logos, loading ringtones, reading battery charge level and radio signal strength, etc. The actual features supported depend on the model of your mobile phone. Regarding SMS sending and receiving, Gnokii works well with many mobile phones from Nokia, and also those from other manufacturers that support the AT-command mode.

As Gnokii is a command line program, some people find it less intuitive to use. If you are one of them, you may want to try XGnokii or Gnocky, two easy-to-use graphical user interfaces for Gnokii. XGnokii is already included in the Gnokii package, while Gnocky can be downloaded separately from the Gnokii web site..

sudo apt-get install gnokii

to check type “gnokii” in terminal it displays as

For info and which phones support the gnokii see the following wegsite

http://www.developershome.com/sms/gnokiiIntro.asp

for install and configuraion and error clear see the web page http://www.gnokii.org/docs.shtml

INSTALL RUBY:

ruby is an language,Ruby is a language of careful balance.Blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

He has often said that he is “trying to make Ruby natural, not simple,” in a way that mirrors life.

Rails is a web development framework written in the Ruby language. It is designed to make programming web applications easier by making several assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks

Installing ruby in our system is easy ,but it follows the some cmd line steps in terminal. To install ruby type the cmd in terminal

$ sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8

follow the steps in the web site

http://www.ubuntugeek.com/how-to-install-ruby-on-rails-in-ubuntu-810-intrepid.html

install mysql-server 5.0.51 (or) any version:

# To install MySql database:

sudo apt-get install mysql-server

# To start MySql server:

/etc/init.d/mysql start

# To stop MySql server:

/etc/init.d/mysql stop

# To restart MySql server:

/etc/init.d/mysql restart

# To check the status of Sql server:

/etc/init.d/mysql status

Connect mobile and system:

To connct the mobile and sys ON the bluetooth in mobile and system,for system use bluetooth dongle no need of any drivers for bluetooth dongle.

In system the bluetooth sysbol apper as

note:

*in bluetooth symbol click and get preference and select “service”

In this sysmbol right click and select “Browse device” and select the u r mobile and click “connect” ,and accept the msg in mobile and give any passky and click ok,now the mobile and system paired successfully.

Now goto terminal type,

sudo gedit /etc/gnokiirc

gnokiirc(/etc)-gedit file opened and change the settings as follows

  • in 27th line default present like
  • #port = aa:bb:cc:dd:ee:ff
  • change port = aa:bb:cc:dd:ee:ff and we want the mobile id or address to get(when mobile and sys connected only) type in terminal like
  • $ hcitool scan
  • it gives some address and copy this .
  • Paste in the 27th line like port = aa:bb:cc:dd:ee:ff change port = “u r mobile address”
  • enable model = AT in 51th line disable #model=6110
  • put like because v use bluetooth connection # connection = serial
  • remove # from connection = bluetooth

note:

*the id of mobile change depend on mobile model

*don’t use china and goriya.. mobiles or try….

    *get preference from bluetooth symbol and enable input service and disable serial service

    *Use Ubuntu 8.04 for bluetooth it is compatable…

send sms and enjoy:

go to terminal for send single sms to single number

type

gnokii –sendsms mobileno

enter the msg and end input press ctr+d

now send succeed..

SYMBIAN

Posted in symbian on September 9, 2009 by csecyborg

SYMBIAN

The Symbian platform is an open source operating system for mobile devices. It was created by merging and integrating software assets contributed by Nokia, NTT DoCoMo, and Sony Ericsson, including Symbian OS, the S60, UIQ and MOAP(S) user interfaces.

Python for 60 Installation and Resources

For developing Python for S60 scripts all you need to have is a simple text editor (even notepad works) on your computer and an S60 phone for instant testing without a build or compiling process in between. As an alternative for testing you can use an S60 platform device emulator on your PC, too. In order to test and run a Python script on your S60 phone, you first need to

install the Python for S60 interpreter software to the phone, since it is not preinstalled.

This installation provides the needed Python execution environment

and a range of Standard and proprietary Python library modules. For testing

Python for S60 scripts on your PC via an S60 platform device emulator some

extra software has to be installed to your machine.

Software Installation on the Phone

1. Download the Python for S60 interpreter software to your computer

from the SourceForge’s PyS60 project website: http://sourceforge.

net/projects/pys60. It is available for free as a Symbian install file

(.SIS). Note, you need to choose the correct Python for S60 interpreter

software file based on your phone model (e.g., whether your model is based

on the 2nd or 3rd edition of the S60 developer platform).



2. Install the Python for S60 interpreter software to your phone via Bluetooth,vUSB cable, or Nokia PC Suite. After this, your phone is ready to run Python scripts. The Python icon should be visible on your phone’s desktop or inside one of its subfolders.

To make sure you have the latest installation instructions available, check

from Nokia’s wiki site or relevant PyS60 online tutorials:

http://wiki.opensource.nokia.com/projects/Python for S60

http://www.mobilenin.com/pys60/menu.htm

http://mobiledevices.kom.aau.dk/index.php?id=909

Software Installation on the PC (for S60 Platform Device Emulator Use)

1. Download (free) and install to your PC the S60 Platform SDK for Symbian

OS that includes the device emulator that allows applications to be

run and tested on the PC. It can be found from Forum Nokia’s website:

http://forum.nokia.com. (For details about the installation, read the

releasenote.txt file contained in the .zip file you download).

2. Download (free) and install the Python plug-in for the Symbian SDK.

According to the phone model you want to target with your applications,

you need a different plug-in to install on your PC. It can be found

from the SourceForge’s PyS60 project website http://sourceforge.net/

projects/pys60.

Writing a Python Script

How Python Runs Programs

The Python interpreter reads the program you have written and carries out

the code statements it contains. The simplest form of a Python program is



just a text file containing Python statements which are executed. Such a text

file is in our case the Python script that we are writing.

Three Basic Steps

Let us now look into how to write such a Python for S60 script and how to instantly run it on an S60 mobile phone or an emulator on your PC as an

alternative. There are three basic steps to take:

1. Write a Python script with a text editor on your computer and save it

with the .py file extension.

2. Move your *.py script file from your computer to your phone.

3. Start the Python interpreter application on the phone (or on the emulator)

by clicking on the Python icon on the desktop of your phone (Figure 2.1)

or emulator, then press options key and select Run script from the menu.

From the appearing list choose the name of your script and press ok. Your

script should now start up.

Detailed Explanation of Steps 1 and 2

1. You can use any simple or advanced text editor on Mac or PC or Linux

to write and edit your Python script. Some developers have preferences

regarding which editor to use. Useful editors are, e.g., ConTEXT or Pywin

which are freely downloadable on the Internet, but also Notepad works.

All you need to do is to write the Python code with the text-editor and

save the file with the ending .py. After the code is typed, the file is ready to

be executed on the mobile or an emulator without going through a build

or compiling process. In order to run it, the file needs to be uploaded to

the phone, or copied to a specific folder when using the emulator tool on your computer.

2. There are different possibilities available to move your Python script to

your phone. Depending which phone model you have either of the following

should work: a) using the Nokia PC suite (PC only), or a USB cable or

Bluetooth for connecting the phone as an external hard drive to then

copy paste your scripts from the PC to a folder you need to create on

your phone named Python or b) via Bluetooth sending your *.py file from

the computer (any OS) to your mobile where it will arrive in the message

inbox. Open the received message from the inbox in order to install the



Python script file. When asked to install your file as a script or a library,

choose Python script. When using the emulator, all you need to do is to

copy your script files to a specific folder on your computer.

Sending Data from Phone to Phone via Bluetooth RFCOMM

Bluetooth sockets can be set up for sending and receiving data using the Bluetooth

protocol RFCOMM. This can be done from phone to phone, or phone

to computer, or from phone to microcontroller that has a Bluetooth chip. For

example, the arduino board (http://www.arduino.cc/) is a microcontroller

board with a Bluetooth extension chip. This might be of interest to projects

dealing with social interaction through wearables, physical computing, and

mobile devices. Furthermore the sensor introduced in Chapter 21 is doing the

same.

To establish an RFCOMM connection from phone to phone over Bluetooth

two different scripts are needed. One phone runs the server side script and

the other phone runs the client side script. Since we cannot go into detail due

to lack of space we show here some code example of a simple chat application

(Listing 2.16, 2.17) including comments. Make sure you have Bluetooth

switched on at both phones. All we do is setting up a Bluetooth RFCOMM

connection between two phones and each side sends and receives a string.

With these two scripts a multiuser game can easily be created, too.

Here is the code for Bluetooth chat

import socket, appuifw

def chat_server():

server = socket.socket(socket.AF_BT, socket.SOCK_STREAM)

channel = socket.bt_rfcomm_get_available_server_channel(server)

server.bind((“”, channel))

server.listen(1)

socket.bt_advertise_service(u”btchat”, server, True, socket.RFCOMM)

socket.set_security(server, socket.AUTH | socket.AUTHOR)

print “Waiting for clients…”

conn, client_addr = server.accept()

print “Client connected!”

talk(conn, None)

def chat_client():

conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM)



address, services = socket.bt_discover()

if ‘btchat’ in services:

channel = services[u'btchat']

conn.connect((address, channel))

print “Connected to server!”

talk(None, conn)

else:

appuifw.note(u”Target is not running a btchat server”,

“error”)

def receive_msg(fd):

print “Waiting for message..”

reply = fd.readline()

print “Received: ” + reply

appuifw.note(unicode(reply), “info”)

def send_msg(fd):

msg = appuifw.query(u”Send a message:”, “text”)

print “Sending: ” + msg

print >> fd, msg

def talk(client, server):

try:

if server:

fd = server.makefile(“rw”, 0)

receive_msg(fd)

if client:

fd = client.makefile(“rw”, 0)

while True:

send_msg(fd)

receive_msg(fd)

except:

appuifw.note(u”Connection lost”, “info”)

if client: client.close()

if server: server.close()

print “Bye!”

index = appuifw.popup_menu([u"New server", u"Connect to server"],

u”BTChat mode”)

if index != None:

if index:

chat_client()

else:

chat_server()

lirc

Posted in LIRC on September 9, 2009 by csecyborg

LIRC-LINUX INFRARED REMOTE CONTROL

LIRC is a package that allows you to decode and send infra-red signals of many (but not all) commonly used remote controls.

The most important part of LIRC is the lircd daemon that will decode IR signals received by the device drivers and provide the information on a socket. It will also accept commands for IR signals to be sent if the hardware supports this. The second daemon program called lircmd will connect to lircd and translate the decoded IR signals to mouse movements.

Sending infrared signals


The LIRC package contains the irsend tool for sending infrared signals to e.g. your TV or CD player. For reliable transmission a good config file is even more important than for receiving

SOFTWARE: LIRC lirc-0.8.5.tar.bz2, 700 kB


LIRC is a package that supports receiving and sending IR signals of the most common IR remote controls. A list of supported hardware is available on the main page. It contains a daemon that decodes and sends IR signals, a mouse daemon that translates IR signals to mouse movements and a couple of user programs that allow to control your computer with a remote control.
For Irman support download the latest libirman library. If you want to link the LIRC drivers statically to your kernel, have a look at Karsten Scheibler's static LIRC package. 

Gps & data logger

Posted in Gps and Data Logger on September 9, 2009 by csecyborg

GPS DATA LOGGER

AIM :

  • To find out the places where we are now and all.

  • Here fully Open Source type OS is used

( Ubuntu 8.04 ).

Requirement’s :

  • Adaptor 741-1Amp – 1 unit.

  • Serial Port Cable -1 unit.

  • Antenna - 1 unit.

  • GPS Receiver Engine – 1 unit.

Step 1 : Installing Python Software

Sudo apt-get install pytho-gtk2 python-glade2

Step 2: Code for read data direct from GPS Receiver

import serial

ser = serial.Serial(‘/dev/ttyS0′, 4800)

f=open(‘Darling.nmea‘,’w');

while 1:

a=ser.readline()

print a

f.write(a+’\n’)

Save this file as filename.py

For Ex, Darling.py

Step 3: Converting NMEA format to GPX format

To convert the above generated NMEA file to GPX file using WWW.GPSVISUALIZATION.COM

For Ex,,, Darling.NMEA TO Darling.GPX

converting

Step 4 : Uploading GPX File To Visualizer

upoloading GPX file

Step 5 : Visualize GPX File using GPSVISUALIZER

visualize

See The Image marked  in Rose Color

Arduino to Blender

Posted in Aurdino to Blender Studio on September 9, 2009 by csecyborg

Arduino to Blender

Blender is an open source multimedia software for creating 3D objects.

Blender consists a good SDK(Software Developmental Kit). So that it can be connected to microcontrollers and controlled by them. Blender runs on python script and python is integrated to th arduino

Features of Blender:

  • Interfacing

  • Rigging

  • Animation

  • UV Unwrapping

  • Physics and Particles

  • Realtime 3D/Game Creation

  • Modeling

  • Rending

  • Shading

  • Imaging and Compositing

  • Files

Blender can be interfaced with arduino by using python, and blender can be controlled by the microcontrollers like Arduino (Open source microcontroller).

Here we use a potentiometer as the input device using arduino microcontroller and the blender objects actions can be controlled by this potentiometer.

The aruino code used:

void setup()

{

Serial.begin(9600);

}

void loop()

{

Serial.print(analogRead(0)/4, BYTE);

delay(40);

}

The Program used to implement this is:

import serial

import Blender

serialport = serial.Serial(‘COM4′, 9600)

ob = Blender.Object.Get (‘Cube’)

Blender.Window.WaitCursor(1)

for i in range(1, 100):

x = serialport.read(size=1)

y = 0.01*ord(x)

#print “y=”, y

ob.setLocation(0,2*y,2.55)

ob.setEuler(0,0,y)

ob.setSize(0.5+y,0.5+y,0.01+y)

Blender.Redraw()

else:

serialport.close()

Blender.Window.WaitCursor(0)

Potentiometer can be connected to arduino board by:

The conections of this project is represented by the flow chart:

Blender is compatible with linux, windows and many more operating systems…

Blender can be downloaded from

http://blender.org/

Follow

Get every new post delivered to your Inbox.