Thursday, 20 December 2012

I'm not afraid for the world will end today, I fear the world will continue without changing.

I'm not afraid for the world will end in 2012...I fear that world will continue without changing anything!
  





That is something I feel strongly about.
 About a billion out of 7 billions human beings are living in hunger and billions more in poverty across the world [WFP]. But if you realize the fact that the world produces much more food than we can consume (annually we produce food for about 12 billions people) or the fact that military spending of either US or China is more than enough to feed all the hungry people in the world ,then  you would realize the main problem for all our suffering is us, human beings or more precisely our greed. Before accusing me of being communist, I actually blame on the imperfect way we are made where greed and competition is necessary for the survival of the fittest. That is what evolution is about and it is true to all living and sentient beings on this world and is the basics of all our suffering. 

But life has not always been like that. Some scientists point out the hypothesis of universal common ancestor which is superorganism that share genetic information with all cells.
 " Instead of competing for resources and developing into separate lifeforms, cells spent hundreds of millions of years freely exchanging genetic material with each other, which allowed species to obtain the tools to survive without ever having to compete for anything. That's maybe not an organism as we would comprehend it today, but that's the closest term we have for this cooperative arrangement."  original article

But then some cells break off the arrangement and started endless competition we suffer today.

But situation is not hopeless. we can change that. One of the solutions is to engineer a more perfect human beings free from any suffering with the help of technology like hyperintelligence through singularity (the way transhumanists advocates) or by reimagining our socioeconomic system from sketch (the way Zeitgeist Movement has taken).  
Years ago, I used to think that social engineering is the only way to go for a better society (which is the way all the religions have tried without much success).  But then I realize that you don't really need to teach them to make better humans... We can engineer them!!
For example, there are recent research papers that show that hormone oxytoxins could make us more altruistic[ Ref: http://brainethics.wordpress.com/2008/06/04/oxytocin-the-direct-route-to-altruism/  & http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0001128] We could discover many more factors like that in the years to come.

(There are some people who took issue with me for putting Altruism as my Facebook religious view. Here is the reason. Altruism is important aspect of all of the major world religions. But how many altruistic people you find in daily life even in the religious circles? Very few and even then they won't care for people of other religions.
But the good news is that you don't need to preach or teach people of altruism. We could just manipulate the biochemicals in the body to make them more altruistic as research has shown. Hence ,no argument and religious wars are needed just to feed a hungry kid or to do what is right or to be a good person. )

I believe we could do many great things like this by going into genetic or molecular level of us, ironing out the genes that cause the diseases, creating better humans physically, immunologically, psychologically and socially). That is the reason behind this blog title "Engineering The Cure", It doesn't mean as a cure to any particular disease. I mean as the cure for humanity which we are trying to find.

 " Instead of competing for resources and developing into separate lifeforms, cells spent hundreds of millions of years freely exchanging genetic material with each other, which allowed species to obtain the tools to survive without ever having to compete for anything. That's maybe not an organism as we would comprehend it today, but that's the closest term we have for this cooperative arrangement." 
By the way, from the description,  what does that ancient superorganism sound like in modern day?  I would say that is how Open source movement work.  Open source softwares, hardwares and open science are gradually gaining the momentum for good. They are the prime examples of we can do great things and increase overall benefits by freely sharing. This proves competition is not the only way to success.

Tuesday, 29 May 2012

Monday, 14 May 2012

Tuesday, 17 April 2012

Apple or Android ? What would Benjamin Franklin have chosen?


With the another drove of news that are critical of Android's security and recent OSX's security woes which experts blame on Apple's lack of transparency., I think the time is right to create this image.

Benjamin Franklin is one of my favorite heroes that I look up to. He was a statesman, scientist, inventor, musician and philosopher as well as one of the founding father of United States ,and hence father of the modern world.

So what would Benjamin Franklin have chosen if he was given a choice between Apple's iOS and Android?

I think answer is obvious. I don't think the close system will ever be as secure as open systems in the long run. Don't forget iOS is only 5 years old. So let's wait and see what would happen in the future.




P.S. I realize there are different version of this quote but this one is my favorite and cover the whole concept.
"Those who sacrifice liberty for security deserve neither and will lose both"- Benjamin Franklin.

Monday, 16 April 2012

Physical Priority GMail notifier and retro mailbox with display, sound and flag

A brief history of GMail retro mailbox.


[from the previous post] While I am taking a little break last week for mid sem break, I decided to do a physical Gmail notifier , as if all notifications from my gtalk , phone and tablet are not enough . 
Well , the catch is this will notify me only for the important messages . So I can turn off notifications from other gmail clients notifying me of unwanted mails.
The design is simple ,using gmail's priority inbox feature)I fetch the important mail from gmail rss feed (https://mail.google.com/gmail/feed/atom/important) using python script and send data to arduino using pyserial .

What it does

The incoming important mail will raise the mail flag, display the mail title in LCD (scrolling) , light up notifier LED and play melody.


Watch a short demo video: 








The followings are photos of mail in priority inbox or lack of that.




Yahoo! You've got a mail. 
Woohoo! You've no mail






Tutorial : How to 

You will need :
Software list:


Hardware list
  • Arduino Uno or duemilanove board
  • LCD
  • Servo motor
  • Piezo speaker
  • LED 
  • 100 Ohm resistor
  • variable resistor
  • Mini breadboard
  • paper and sessior to make your own box

Step 1. Fetch Software

 Install software if you do not have them already.
Pyserial is python module for serial communication. Feedparser is module for parsing the emails. Pyserial installation is easy since it is exe file (if you use windows). However, feedparser installation could be tricky if you are a newbie to python like me. You need to add python directory to Windows' "PATH" envionment variables. Then use the command prompt to install feedparser as mentioned in feedparser documentation page. (Hit me up in the comments for any problem).


Step 2: Get Connected



Connect hardware components as follows.



Image is produced by using Fritzing.



 



Step 3: Get codes.


 Upload Arduino sketch file. You can change melody as you like. You can compose a new one all the notes are in pitches.h. Mine is a simple alarm melody that I like . simple piano score  B,G,A,D, , D,A,B,G.

/*
 * This code reads serial port for email.
 * If mail is present, it will turn on LED, display on LCD and scroll the display,
 * raise flag and play defined melody
 *copyleft by Aung Thiha
 *created in April 12 
 *last modified April 15 
 *This code is in public domain
 *www.engineeringthecure.blogspot.com
 */
#include <LiquidCrystal.h>
#include "pitches.h"
#include <Servo.h>
#define MAX 45     // servo maximum degree. I am making it turn counterclockwise so 0 degree to 45 degreee. It depends on your servo position and configuration
#define MIN 0      // servo minium degree

LiquidCrystal lcd(12,11,5,4,3,2);
int ledPin =13;
char ser;
String email ="";
int servoPin = 9;
// notes in the melody: you can write any melody you like
// this is a tune I like. so I coverted the piano note 
int melody[] = {NOTE_B5,NOTE_G4,NOTE_A5,NOTE_D4,0,NOTE_D4,NOTE_A5,NOTE_B5,NOTE_G4,0};

// note durations: duration for a note to play. 4 = quarter note, 8 = eighth note, etc.:
// Not important for this tune, but u need to change it if you want to run other other tunes
int noteDurations[] = { 4,4,4,4,4,4,4,4,4,4};
Servo flag;

void setup(){
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(ledPin,OUTPUT);
  flag.attach(servoPin);
}

void loop(){
  
  lcd.clear();
  lcd.setCursor(0,0);
  if (Serial.available()) {
         lcd.print("connected");
          lcd.setCursor(0,1);
   ser = Serial.read();     //read the serial port
          //if incoming character is 0, no mail, LED is low 
         if (ser == '0'){
             digitalWrite(ledPin,LOW);
             flag.write(MIN); 
             //lcd.write("You got no mail!");           
          }
          //if other characters, servo flag turns, Lcd display and play sound"
         else if(ser > '0') {
           flag.write(MAX);
           lcd.clear();
           email += ser;
           digitalWrite(ledPin,HIGH);
           getEmail();  //parse email function ,code block is below
           printEmail(); //print email ,code block is below
           playSound(); // play melody
           email ="";  // reset email
           
         }
       
 
    }

 
  delay(1000);
 
    
}
/*
 *parse  the email from incoming characters.
 *adding each character to email string
 */

void getEmail(){
    while(Serial.available()>0){
      char nextChar = Serial.read(); 
      email += nextChar;
    }
}
/*
 * print email and scroll it
 *
 */
void printEmail(){
  int emailLength = email.length();
  lcd.setCursor(0,0);
  lcd.print(email);
  delay(500);
  //scroll it to left until the final char of email is displayed on LCD
  for (int positionCounter = 0; positionCounter <emailLength-12; positionCounter++) {
    lcd.scrollDisplayLeft(); 
    delay(500);
  }
  lcd.clear();
  lcd.print(email);
  
}
/*This code play tune from melody array . 
* literally from public domain code
* from arduino Tone tutorial http://arduino.cc/en/Tutorial/Tone
*/
void playSound(){
 
   // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 10; thisNote++) {

    // to calculate the note duration, take one second 
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 2000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }
    
}



Then save the following codes as pitches.h
 
/*************************************************
 * Public Constants
 *************************************************/

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978

Then get python script. Open new Window >> paste codes >> saved it under any name 
with .py extension. Put in your email, password, change serial port that is same as port on
arduino.I pointed the path to "important" label to get priority mails. You can change that 
to specific label just by pointing to your label instead of important. You can set your own 
filters and label as explained in the link.Reminder about python: index is very important in
python. Copy exactly as follow.





import serial, sys, feedparser,time
#Settings - Change these to match your account details
USERNAME="youremail@gmail.com"
PASSWORD="yourpassword"
PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom/important"
mySerial= serial.Serial('COM5',9600) #change port to  your setting.

while True:
        
        gmail = feedparser.parse(PROTO + USERNAME + ":" + PASSWORD + "@" + SERVER + PATH)
        unread = len(gmail.entries)
        #"print ("Unread:{0}".format(unread)) #uncomment if you want it to dispaly on your desktop
        if unread ==0:
                mySerial.write(0)
                time.sleep(10)
                #print("no mail")
        elif unread>0:
                gmail_latest = gmail.entries[0]
                title = gmail_latest.title
                author = gmail_latest.author
                #print (title)
                #print (author)
   
                mySerial.write("[{0}] {1} ".format(unread,title))
                time.sleep(20)
        mySerial.flushOutput()





Step 4. Test it



Run python script by using F5.


You can always disable some function to suit your need. e.g You might not want sound or display the message at certain time. Then you just need to disable that part of code on arduino. I wrote it in code block exactly to do just that.
If something is wrong , check the connection.


Step 5. Put genie in the box :)



Create the box as creative as you can. I create a cube just because I love the cube design. (not because of Steve Jobs btw.)


Yahoo! You've no mail :)

You have got a mail :(




References.
There are links that give me inspiration and some codes :)


1)http://j4mie.org/blog/how-to-make-a-physical-gmail-notifier/   I got feedparser python code
2)http://blog.tinyenormous.com/2008/12/08/arduino-lcd-gmail-subject/ I got LCD title display idea. but link for download is not working . so I need to write mine.
3) Arduino.cc for all the resources

My Mission


These two philosophies have been integral part of my daily living long before I read this quote.   I would prefer to eradicate sufferings all together and that is exactly what the title of my blog means. I am a strong believer in technology as our salvation and accordingly I am a follower of many technology trends. You can find the trends and tech news I follow on Engineering The Cure Facebook page.
My latest musing is about synthetic biology as I believe engineering a life form is the frontier of engineering. I could imagine all sort of advancement that synthetic biology could enable: from new food resources , geoengineering , energy production to healthcare.

P.S I found this picture on Google+. I don't know who is original creator. I tried to find by Google image search but it returns hundreds of links.

Thursday, 12 April 2012

Gmail Priority Inbox notifier using Arduino and Python


While I am taking a little break this week for mid sem break, I decided to do a physical Gmail notifier , (as if all notifications from my gtalk , phone and tablet are not enough :P). 
Well , the catch is it will notify only for the important messages (using gmail's priority inbox feature). So I can turn off notifications from other gmail clients as there are a lot of spams in my inbox(well, 99.99% spam is from my university. mails for all the events I don't give a damn ). 
The design is simple ,I fetch the important mail from gmail rss feed (https://mail.google.com/gmail/feed/atom/important) using python script and send data to arduino using pyserial . There is a notification LED and a lcd screen displaying title of latest important mail which obviously are controlled by Arduino. LED and LCD should be off if there is no new mail. 
To do list: put a speaker ;P, write tutorial on my blog, and integrate twitter notification. I will be doing them next week if I could find some time.. 
The main benefit is I learnt a couple of python tricks in this hack.;)

Tuesday, 24 January 2012

How to make a (really) simple DIY solar USB charger for your phone or mp3 player

How to make a (really) simple DIY solar USB charger for your phone or mp3 player


I am going on a trip in next few days where I will be without power, hence I decided to do some solar charging for my phone.  Here is one rudimentary circuit  you can make easily.

Parts you need :

Solar cells
Schottky diode 1N5819
Electrolytic capacitor 10uF
0.1uF capacitor
9V rechargeable battery
USB female port 
Perfboad or donut board or PCB
Soldering accessories






In this circuit , I use four 5V solar cells. Two are in parallel and other two in series, so that  the total output  would be 10V and 100mA.  I used it because it is the best alternative I have locally. You might choose better alternative like this one. Schottky diode prevents the back current to solar cells. Otherwise, solar cell will draw the current in the dark.  
The rest is ordinary LM7805 circuit. This IC will regulate any voltage between 7.5V and 30V to 5V. Capacitor C1 at the input prevents source oscillation while capacitor C2 maintains the output stable.
9V rechargeable battery will act as buffer power source when solar cells are not working.
The simple charging devices (like many phones and mp3, mp4) only use two port of USB ; pin 1 for power and pin 4 for ground. This circuit cannot charge the iPhones , iPods  because these devices use other two at specific voltage levels to be able to recognise as charger. See detail explanation about it at Ladyada.net Minty Boost USB charger. It is also not working with my ASUS transformer tablet. But my Nexus S phone is successfully charging.

This is very simple and inefficient design. I have some improved designs in mind. I wanted to use the more efficient step up transformer as in Minty Boost circuit. I am also thinking about using transistors to amplify current.  but the problem is I can't buy components I need because of Chinese New Year holidays here. And I really need to finish this solar charger before my trip. Can't really blame it, isn't it engineering is all about ? , to create something with limited resources we have (whether it is time or material). 
When my trip is over , I will be improving this circuit once again. Here are photos of my solar charger.
















Inception

Inception

One of  my 2012 wish list is to restart blogging. So here it is. I will be talking about some DIY projects of mine as well as my opinions on engineering and technological news that I find interesting. My  interest is in consumerization  and personalization of medical instruments and treatments which I believe is the next step in  reducing the cost and democratizing healthcare for the masses. 
This blog will also be advocating liberty and freedom in my country and around the world.