Canon MP280 - Scanning at resolution 1200 dpi

No comments :

Recently, while trying to scan some of my coins using Canon MP287, I noticed that all the windows applications like Scan app, Windows fax and scan and even in import option of Adobe photoshop, there is no option to select a scan resolution higher than 600 dpi.
Though 600 dpi is good enough to scan photos, for some of my coins which measured few millimeters, this is not enough.
From the specification of MP287, it is clear that it supports 1200 x 2400 dpi. So, I should be able to scan at 1200 dpi. After searching a lot, I found the answer.
The 1200 dpi option will be available only from the scan dialog of the driver - ScanGear.
For this
  • update the drivers to latest version from the Canon support page.
  • download and install Canon MP Navigator EX(appropriate to windows version) from support page



Read More

CUSAT exam result checker python script

No comments :

So, do you want to summarize your results for planning or just want to know the details about someone else? Or want to find an easy way to document the results instead of reading/copy the mark list to make a summary?
Many times it is very time consuming task to go through each and every results. It becomes even difficult when we are checking the results of our friends or relatives and dose not know the exam dates or the semester.
I had to check results of my brother who is finishing his Engineering course from Cochin University(CUSAT) and all I had was his register number and not much information about when the exam was. So I made these python scripts.
There are two parts in this script. First one will read all results from CUSAT exam results page and form a dictionary with all the available results including the previous attempts and creates a pickle dump of the same. The next script will then read the pickle and generate a report.
In this script beautifulsoup4 library is used on Python 3+. Hence, it is necessary to install it first and then run.
Note: Before use, open the results page, and check whether internet connection is available and the results portal is not down.
You may download the scripts from here.

Below you may find snapshot of tool output for a random registration id.



-------------------------------------------------------------------------
| Sem  |                   Subject                    | Marks | Results |
|------|----------------------------------------------|-------|---------|
| I&II | A101 ENGINEERING MATHEMATICS-I               |   87  | Passed  |
| I&II | A102 ENGINEERING PHYSICS                     |   82  | Passed  |
| I&II | A103 ENGINEERING CHEMISTRY                   |   79  | Passed  |
| I&II | A104 ENGINEERING MECHANICS                   |   77  | Passed  |
| I&II | A105 ENGINEERING GRAPHICS                    |   79  | Passed  |
| I&II | A106 BASIC CIVIL & MECHANICAL                |   84  | Passed  |
| I&II | A107 BASIC ELEC. ENGG. AND ELE               |   76  | Passed  |
| I&II | A108 COMPUTER PROGRAMMING                    |   90  | Passed  |
| I&II | A109 TECHNICAL COMMUNICATION                 |   88  | Passed  |
| I&II | A180 COMPUTER PROGRAMMING LAB                |   86  | Passed  |
| I&II | A190 ELE. & MECHA. WORKSHOPS                 |   80  | Passed  |
| III  | B101 ENGGN MATHEMATICS II                    |   83  | Passed  |
| III  | B102 ELECTRICAL TECHNOLOGY                   |   75  | Passed  |
| III  | B103 NETWORK THEORY                          |   62  | Failed  |
| III  | B104 DIGITAL ELECTRONICS                     |   79  | Passed  |
| III  | B105 SOLID STATE ELECTRONICS                 |   65  | Failed  |
| III  | B106 ELECTRONIC CIRCUITS - I                 |   65  | Failed  |
| III  | B180 BASIC ELECTRONICS - LAB                 |   51  | Passed  |
| III  | B190 ELECTRICAL MACHINES LAB                 |   70  | Passed  |
| IV   | C101 ENGINERING MATHEMATICS-II               |   60  | Failed  |
| IV   | C102 MICROPROCESSORS                         |   75  | Passed  |
| IV   | C103 ELECTRONICS CIRCUITS II                 |   67  | Failed  |
| IV   | C104 SIGNALS AND SYSTEMS                     |   62  | Failed  |
| IV   | C105 ANALOG COMMUNICATION                    |   64  | Failed  |
| IV   | C106 INDUSTRIAL AND POWER ELEC               |   52  | Failed  |
| IV   | C180 DIGITAL ELECTRONICS LABOR               |   50  | Passed  |
| IV   | C190 ELECTRONIC CIRCUITS LAB -               |   53  | Passed  |
| V    | D101 ENGINEERING MATHEMATICS I               |   97  | Passed  |
| V    | D102 ELECTROMAGNETIC THEORY                  |   63  | Failed  |
| V    | D103 DIGITAL SYSTEM DESIGN                   |   77  | Passed  |
| V    | D104 ADVANCED MICROPROCESSORS                |   79  | Passed  |
| V    | D105 MICRO ELECTRONICS & INTEG               |   56  | Failed  |
| V    | D106 DIGITAL SIGNAL PROCESSING               |   76  | Passed  |
| V    | D180 MICROPROCESSOR LABORATORY               |   60  | Passed  |
| V    | D190 ELECTRONIC CIRCUITS LABO                |   71  | Passed  |
| VI   | E101 DIGITAL COMMUNICATION                   |   55  | Failed  |
| VI   | E102 MICROWAVE TECHNIQUES & DE               |   62  | Failed  |
| VI   | E103 VLSI DESIGN                             |   62  | Failed  |
| VI   | E104 ELECTRONIC MEASUREMENTS                 |   86  | Passed  |
| VI   | E105 CONTROL SYSTEMS ENGINEERI               |   77  | Passed  |
| VI   | E106 EMBEDDED SYSTEMS                        |   78  | Passed  |
| VI   | E180 COMMUNICATION LABORATORY                |   64  | Passed  |
| VI   | E190 MINI PROJECT                            |   95  | Passed  |
| VII  | F101 INDUSTRIAL ORGANIZATION& MANAGEMENT     |   87  | Passed  |
| VII  | F102 RADIO COMMUNICATION                     |   77  | Passed  |
| VII  | F103 COMPUTER COMMUNICATIONAND NETWORKS      |   80  | Passed  |
| VII  | F104 ELECTRONIC PRODUCT DESIGN               |   82  | Passed  |
| VII  | F106 SIGNAL PROCESSING LABORATORY            |   71  | Passed  |
| VII  | F107 COMMUNICATION LABORATORY II             |   88  | Passed  |
| VII  | F108 SEMINAR                                 |   37  | Passed  |
| VII  | F109 PROJECT DESIGN                          |   46  | Passed  |
| VII  | F150 INTELLIGENT SYSTEMS                     |   83  | Passed  |
| VIII | G101 AUDIO AND  VIDEO ENGINEERING            |   86  | Passed  |
| VIII | G102 COMMUNICATION SYSTEMS                   |   71  | Failed  |
| VIII | G103 OPTO ELECTRONICS &COMMUNICATION;        |   66  | Failed  |
| VIII | G105 PROJECT WORK                            |  286  | Passed  |
| VIII | G106 VIVA - VOCE                             |   81  | Passed  |
| VIII | G140 DIGITAL IMAGE PROCESSING                |   85  | Passed  |
-------------------------------------------------------------------------

                   Uncleared Subjects                   
----------------------------------------------------------
| Sem  |  Atmpt |                Subjects                |
|------|--------|----------------------------------------|
| III  |    5   | B103 NETWORK THEORY                    |
| III  |    5   | B105 SOLID STATE ELECTRONICS           |
| III  |    5   | B106 ELECTRONIC CIRCUITS - I           |
| IV   |    6   | C101 ENGINERING MATHEMATICS-II         |
| IV   |    6   | C103 ELECTRONICS CIRCUITS II           |
| IV   |    6   | C104 SIGNALS AND SYSTEMS               |
| IV   |    6   | C105 ANALOG COMMUNICATION              |
| IV   |    6   | C106 INDUSTRIAL AND POWER ELEC         |
| V    |    6   | D102 ELECTROMAGNETIC THEORY            |
| V    |    6   | D105 MICRO ELECTRONICS & INTEG         |
| VI   |    6   | E101 DIGITAL COMMUNICATION             |
| VI   |    6   | E102 MICROWAVE TECHNIQUES & DE         |
| VI   |    6   | E103 VLSI DESIGN                       |
| VIII |    4   | G102 COMMUNICATION SYSTEMS             |
| VIII |    4   | G103 OPTO ELECTRONICS &COMMUNICATION;  |
----------------------------------------------------------


Semister summary
III   3
IV   5
V   2
VI   3
VIII   2
cnt   43
tot   3493

Total arriears: 15

Pass %: 54.578125

Read More

Running Google Cloud Messaging(GCM) XMPP server using python

No comments :

Google Cloud Messaging logo
Have you tried Running Google Cloud Messaging(GCM) XMPP Cloud Connection Server (CCS) using Python and disappointed?
Some days before, I was reading about some project about using pushover service and pebble along with Raspberry Pi to notify on a doorbell project. Idea of push notifications impressed me and I decided to try it out. However, the famous pushover service used for this purpose was not a free.
While searching for alternate services to send push notifications, I stumbled upon the android developers guide about GCM. So, I thought of using it on my raspberry Pi based hobby projects.
After finishing the android application, I started with server side and chose the XMPP since the upstream messages can be used for sending commands to Pi from android application. However, the Python sample code failed to run due to missing xmpp module. I thought the module must be a part of google's python sdk for cloud. However, the xmpp module from sdk did not even had client class used in the sample.
Then I thought of trying other libraries. sleekxmpp did not work too and later the xmpppy module give me successful result. So, the point is google is using the xmpppy for xmpp in the sample but it is not documented. Maybe it is known to may programmers with good experience progroamming in Python and these kind of libraries. I am writing it here so that if anyone else who is searching could benifit.
So, go ahead install xmpppy module and successfully run the python gcm xmpp server.

Read More

Transferring files between Windows and Raspberry Pi

No comments :

Explorer view(WinSCP) - Transferring files between Windows 7 PC and Raspberry Pi

Many times it is necessary to transfer files between Raspberry Pi and Windows Desktop. I use my desktop to write code for Pi because of the availability of editors which I am familiar with; also I am running Pi in headless mode(ie. without monitor). So it is necessary to pull files from Pi for editing and later push it back to Pi.
This possible by using either ftp, sftp or scp. This tool(WinSCP) is one of the easiest method which I found available to transfer files between Windows and Raspberry Pi. It also has options to sync files between both sides while we are busy coding and debugging using various editors on both sides.

Follow these steps

  1. Download and install the WinSCP software from download page. You may either use the windows installer or the portable version. I prefers portable versions. So if you downloaded the portable version, extract it to a folder.
  2. When it is opened, enter the details
    1. File protocol: Most cases the sftp or scp or both will work. If not try ftp. If none are working, it is easy to install sshd(command: sudo apt-get install sshd) and use sftp. If you are able to connect using putty, then sshd is already installed and sftp option should work.
    2. Host name: You must be knowing this already if you connect using putty/ssh. But if you do not know, please search in google for articles on same.
    3. Enter username and password of pi login.
    4. Save, if necessary to connect later.
  3. Done! now the explorer window should be available. Explore the options. My favorite is Commands->Keep Remote Directory up to Date.
Initial login window


Keeping remote directory up to date


Read More

Generating .pem from .p12 for google cloud applications

No comments :

Today I was trying to use the django app django-push-notifications to work with Google cloud messaging. However, the app required .pem file as input. After some research, I found out how to get the file. Following are the steps.

  1. Create new client ID from respective project in Google cloud console.
  2. Choose Service account and save the .p12 file.
  3. While saving it will show the password, note it down. I guess default password key is 'notasecret'.
  4.  Now download openssl binary from the openssl download page.
  5. Depending on your operating system the files might vary. I am using openssl on windows x64 box.
  6. Extract files to a folder.
  7. Now from command line navigate to the folder and run
    openssl pkcs12 -in path/to/key.p12 -nodes -nocerts > path/to/key.pem
  8. You can find more information about authentication in this page.

Read More

Raspberry Pi 2 on sale!!

No comments :

Today, I was searching for some electronic stuff on the Internet and stumbled upon this webpage of Raspberry Pi2 and later understood I happen to reach the site just when it was published.
I am very much impressed with the new design and surprised to know that even Microsoft supports it with the windows 10(Windows On Devices) for free(for those who Joins the Windows for their IoT Development program).
Though Microsoft supports it. I think this is their step to capture a share in the new market of Internet of Things like all giants are trying now. I am not sure yet how much it will be beneficial for the Open community.
Anyways, raspberry will still continue to grow as one of the first choice for enthusiasts and small business category of people due to it price $35. Old models are still available for the same price.
I have a Model B board which I use for some automation of fish tank and door bell now. 
For me and this is the easiest option to do an embedded project because I am more comfortable with the programming part. Using a microcontroller will consume a lot of time for the initialization kind of stuff. Same project which can be made with Pi in an hour will take a week to do using a conventional microcontroller. Moreover, if we want to use WiFi/Ethernet connectivity it will cost further more time and money.
Below attached a video from the release page.

BCM2836 silicon bringup from Raspberry Pi Foundation on Vimeo.

Read More

Function pointers - The unconventional use

No comments :

In my previous post about function pointers, I have written about the definition of function pointers. Which explains how to avoid confusions while defining. In this post, I will list some uses of the function pointer.

The unconventional use

Usually function pointer are used in callbacks or some special cases. But, we can use it also to simplify code. Consider the below example
void print_zero(void)
{
    printf("Zero\n");
}
void print_one(void)
{
    printf("One\n");
}
void print_two(void)
{
    printf("Two\n");
}
void print_three(void)
{
    printf("Three\n");
}
void print_four(void)
{
    printf("Four\n");
}
void example_switch(void)
{
    unsigned int number = 0;

    switch(number)
    {
        case 0:
            print_zero();
            break;
        case 1:
            print_one();
            break;
        case 2:
            print_two();
            break;
        case 3:
            print_three();
            break;
        case 4:
            print_four();
            break;
        default:
            break;
    }
    
}
The snippet above is nothing but calling few functions in a switch case. Using function pointers, it can be simplified as below.
void example_fPtr(void)
{
    unsigned int number = 0;
    void (*pFun[5])(void) = { /* Define and initialize function pointer */
        print_zero, print_one, print_two, print_three, print_four
    };
    
    number = 4;
    if(number < 5)
        pFun[number](); /* Call function corresponding to number */
}

Read More

Function pointers - Simple use without confusion in C Programming

No comments :

Pointer is one of the most used feature of C - Programming language. It gives us a lot of power to access and control. Function pointers are nothing but a pointer to a function. While learning the concept, it may seem a redundant feature to assign address of a function to a pointer and call the same function using the pointer. However, in simple programs, it is of no use. But, it make sense and it is the only way to achieve certain functionality using C-Programming language.

Good way to define function pointer

In an embedded project with different programs, pointer is of great use. For example, in an embedded project, one may want to do a soft reset. Which means nothing but jumping back to the starting address(most of the cases, the reset vector = address 0). In C program, this can be achieved by using a pointer, assign it to value 0 and call.
void (*pSoftReset)(void); /* Define a function pointer */
pSoftReset = (void (*)(void))0; /* Assign address 0 to pointer */
pSoftReset(); /* Function call using pointer */
In the above snippet, in line 1, a function pointer is defined. In line 2, pointer is initialized with address. Note the typecasting. 0 integer is typecast-ed to a function pointer with address value 0. Then, the function is called. It will never return as the initialization routines will initialize all the variables, stack etc. The same code can also be written in single line as
((void (*)(void))0)(); /* Typecast address 0 to pointer and call */
Here integer is typecast-ed and called at the same time. This function pointer definition, typecasting etc might be difficult to read for many. Because of this code may be less readable. To avoid this we may use the typedef functionality to define new types as below.
typedef void (*typFPtr)(void); /* Define new type typFPtr as pointer to a function */
typFPtr pSoftReset = (typFPtr)0; /* Assign address 0 */
pSoftReset(); /* Call using pointer */
In order to avoid confusion and improve readability, it is better to define new types and use it instead of directly using the function prototype. However, please note that this may also cause some confusion as the '*' is missing in declaration of variable and typecast. Alternately, it can also be done as below.
typedef void (typFN)(void); /* Define new type typFN as pointer to a function */
typFN *pSoftReset = (typFN *)0; /* Define pointer to function and Assign address 0 */
pSoftReset(); /* Call using pointer */

To conclude, definition and use of complex function pointers can be achieved by using typedef. Some examples are mentioned below.
 /* Below definiton is a function pointer fp which
  * will accept a pointer to a function which takes
  * pointer to int as argument, returns void and 
  * another int as second parameter and returns a
  * function pointer which takes int as argument
  * and returns pointer to int */
 int *(*((*fp)(void (*)(int*), int *)))(int);
 
 /* Uning typedef it can be simplified as below */
 typedef int *typFun_pint_int(int);
 typedef void typFun_void_pint_int(int*);
 
 typFun_pint_int * fp_simplified(typFun_void_pint_int *, int *);
 /* Here it is clear what is the return type
    and what are the arguments */
In my next post, I will list some examples of using function pointers. Initially, I thought of adding it here. But, it is too late for me now. So thought of writing it as another post.

Read More

Finding IMEI number if mobile is lost or stolen

No comments :

Normally, the IMEI number of a mobile is found by dialing *#06# on mobile. What if mobile is lost? and we haven't noted the IMEI number. We do not have mobile to dial and check. In this case, there are few places you could check for finding out the IMEI number.
  1. Mobile phone package: If you still have the mobile phone package/carton box in which the phone was shipped, It will have the IMEI number.
  2. Mobile phone purchase bill/Invoice: Mobile phone purchase bill will have the IMEI number noted. If your bill is missing, then still you may get the duplicate bill/invoice from the retailer. If mobile is purchased from online retailer like Flipkart, EBay, Amazon, Snapdeal, etc. It can be obtained from purchase history in the respective website.
  3. In the warranty card or the user manual of the mobile.
So if you have any of the above options available, it is possible to obtain the IMEI number for reporting to the police. Below you can see my Xiaomi Redmi 1S's box with IMEI labels. I have masked it for privacy.

Read More

Lost my mobile for second time

No comments :

This is the second time my mobile is lost. Well this time it is clearly a theft. I kept my Xiaomi Redmi 1S for charging on a table nearby a window. Somebody somehow opened the window and picked the mobile during night when we were sleeping. Though we woke up hearing some sound, it was too late; the one who picked my mobile has left by then.
Without wasting much time, I called the customer care center and requested for temporally blocking my mobile number which he accepted after verifying my personal details.
Now, the next thing is to inform police. However, from my previous experience, I was sure that they will not help much. Maximum they will do is nothing but issue acknowledge for lost mobile reporting. They says, the IMEI number is added to the tracking system and if someone use the mobile it can be tracked. But, still there is no information about my Sony xperia U which is in tracking system since two years. I have found the news here about arrest of person who used to modify IMEI. So what I think is, the people who steals the mobile would approach such people, change the IMEI and then either use it or resell. So, the tracking systems will not be able to find the mobile phone. Below line is from the news source.
Accused, who is a software engineer, was arrested and charged under the IT Act for using technology to change the unique IMEI number of mobile phones
Now, for getting a duplicate Sim-card also, acknowledge from police station is required. This is because, I have ported my number from Vodafone postpaid to BSNL prepaid. And for getting new sim for prepaid, acknowledge is must. Also I think it is necessary to report the loss to avoid any misuse/abuse of the device.
While searching the Bangalore police website, I found this website of Bangalore police. In the page, there is an option 'report lost'. A screenshot is pasted below.
For reporting, we will have to first search in their partner site Lost Click Found. If our mobile is not in the list, then it will give us option to reach this page(Police report of lost item) finally report to Bangalore City Police site. Here there are lot of categories. After submitting we will get option to download the acknowledgement. I have pasted screenshot of my acknowledge below.
Acknowledgement downloaded

However, in the form, there is no option to enter IMEI number. So, I mentioned in the comments column. Since, the IMEI number is not specifically asked, I have also personally went to the nearby police station and informed so that they will add the IMEI number for tracking.

Read More

Fluid width for facebook comment box

No comments :

A page layout, which stretches or shrinks to fill the browser window according to its size, is called, fluid layout. Advantage the view will adjust according to the size of the screen, ie page will adjust itself to browser used in different devices like mobile, tablet, desktop etc.
Usually, blog templates has fixed widths for most of the fields. But those who are using fluid layout may want the facebook comment box to be fluid too. Or those who does not know the width to be set can also try fluid width as it will fill the container. In blogger, filling the container will be nothing but taking the width of the side bar or body where the widget is placed.

Facebook comment box

If you are generating the comment box, just enter 100% in the Width field.

If you dont want to generate, then it is also possible to just edit the existing code and change the part.
'data-width' to 100%

data-width="100%"
data-numposts="5" data-colorscheme="light"> This is documented in facebook developer page from where we generate the code for comment box.
The width of the plugin. Either a pixel value or the literal 100% for fluid width. The mobile version of the Comments plugin ignores the width parameter, and instead has a fluid width of 100%.

Read More

How much power does my USB project/device/phone consume?

No comments :

Ever wondered how much power, a USB device consumes? Sometimes when mobile phone battery is deeply drained, mobile will not indicate whether it is charging or not. Is there a way to check current is really flowing and charging the battery? May be you are doing a USB powered electronics project and want to check how much current it draws.
USB - Current reading for arduino
Current reading of Arduino

Well I found this nice little device(seen in the image above) from Deals Extreme which is also very cheap. It shows the current and voltage of the USB device attached. All we have to do is add this device in between.

Some uses for this are
  1. Find if a USB cable is complaint(Current will remain 0A).
  2. Find if USB charger adapter is complaint.
  3. Check if the USB device is drawing more current.
  4. Check amount of current required used by arduio or raspberry pi or other embedded project boards which you are using.
  5. Show off this cool gadget in-front of friends, etc.
Note: If you want to buy one like this, you may search for USB power measurement or USB current measurement.
USB - Voltage reading for arduino
Voltage reading of Arduino

Read More

Pinguino on bread board

No comments :

I am a fan of PIC microcontroller. Reason being the first one to use during my college/university time. Pic16f84 was one of the first microcontroller which I used as I started exploring the new world of micro-controllers.  Those days programmers were very costly and there were no shops near the place I lived where I could take a microcontroller to program. But, the JDM programmer which can be constructed with some basic components made my life easy.
Now a days, there are lot of cheap options, if we want to do some hobby projects using micro-controllers. Arduino being one of the most popular which uses the self reprogramming feature to flash the new code, can be used even by people who does not know much about software or hardware programming.
Pinguino is an arduino like hardware and IDE for PIC microcontroller. Its software is Free and Open Source. And Pinguino boards are Open Hardware. It is very much similar to arduino with additional USB features supported by PIC microcontrollers. So it does not need a USB to RS232 converter chip in the hardware which must make the hardware cheaper. Below is the description of Pinguino as published in Pinguino website.
Pinguino is an Arduino-like electronics prototyping platform. It supports different 8- and 32-bit ©Microchip microcontrollers, all with built-in USB module (no FTDI chip !).
Pinguino comes with a USB Bootloader. This small program running inside the microcontroller is responsible for transferring your application from your PC to the microcontroller memory and handing over the control to this program afterwards.
No programmer is needed(*), the microcontroller can be reprogrammed over USB with a PC.
  • 8-bit : PIC18Fx550, PIC18Fx5K50, PIC18Fx6J50 and PIC18Fx7J53 family
  • 32-bit : PIC32MX Mips family
Pinguino is an Integrated Development Environement (IDE) which gives everyone the ability to write, compile and upload programs on a Pinguino board.
Pinguino's Language is an Arduino-like or Arduino-influenced rather than Arduino-compatible Language. Users can use the same keywords but can not include Arduino's libraries in their code. Adapted libraries are listed here.
It makes you write easily your application without spending hours learning pragma, configuration bits or command line compiler.
However, due to lack of popularity the Pinguino boards are difficult to find and costlier than that of the Arduino boards. Hence I decided to try it using a PIC18f2550 on bread board. It is very easy to construct as there is not much components. Firmware which is necessary to make the controller work with the Pinguino IDE is available at the Pinguino website. An image of final constructed circuit with an 8x8 led matrix display is below.
Following are steps to make it working.
  1. Download software(Pinguino IDE) and Firmware/bootloader for PIC18f2550.
  2. Flash firmware to the controller.
  3. Construct the Pinguino hardware on bread board as per the schematic.
  4. Install drivers for pinguino if using windows.
  5. Connect hardware to PC using USB.
  6. Open IDE and select the correct com port number for the pinguino.
  7. Make sketches and enjoy.
 I will soon add some posts on some of these stages since some problems might occur.

Read More