Click here to Skip to main content
15,886,724 members
Articles / Mobile Apps / Android

Loggy Project

Rate me:
Please Sign up or sign in to vote.
4.87/5 (13 votes)
31 May 2013CPOL5 min read 38.6K   684   23   10
Store your life, every day!

Introduction

Loggy is an open source project that allows to record your life. It uses the microphone and the photocamera of your smartphone as essential hardware to capture the frames and the audio streams. Another important component of this project is the mindwave headset. Through this device we retrieve our attention level. With this information we can select to record an image or video multimedia files.

Background 

Mindwave... what is it?

Mindwave is an innovative headset produced by Neurosky. Mindwave converts brainwaves into digital electronic signals. There are two version of this device:   

Mindwave... two versions, but which i should choose?

For the scope of this project the Mindwave Mobile is indispensable. That device supports the bluetooth connection, through the bluetooth connection it send the data in RAW mode to the connected devices. With the retrieved data we can parse the various frequency reading by the headset. 

What do I need to implement this project?

The fundamental elements to create this project are:

  1. Android Smartphone with front camera
  2. Windows Seven or 8
  3. Mindwave Headset
  4. Loggy.apk
  5. FileZilla Server
  6. Photo Gallery

Complex architecture but modular

Loggy is divided in two logical modules:

  • Capture the multimedia files: the multimedia files are stored and processed by the Android device. These files are saved as images and videos directly into external sdcard memory. In this way we prevent the wear of internal memory.
  • Face tagging and photo organizing: all of multimedia files are saved through a FTP communication betwwen the Android device and the Windows server. In this mode we daily unload the Android device. Once downloaded the files, we must use the software named "Photo Gallery" to catalog them.

Capture the multimedia file: 

All the multimedia files are captured, processed and saved temporarily on the Android device external memory. Using this method we optimize and simplify the management of the files. The main event that allows the capture of files is the attention level provided by the headset. When the attention level is included between 25% and 60% it captures a frame. Instead the attention level is above 60% it records a video. Each video is 10 seconds long. Below the logical diagram and its corresponding source code:  

Image 1

Java
case TGDevice.MSG_ATTENTION:
    attentionBar.setProgress(msg.arg1/20);
    if((msg.arg1 > 25)&&(msg.arg1<60) && (!pictureTaken) &&(!recording)){
        sndUtility.playShortResource(R.raw.chimes);
        camera.takePicture(null, null, jpegCallback);
        pictureTaken = true;
    }else if(msg.arg1<50){
        pictureTaken = false;
    }
    if(msg.arg1 > 60){
        if(!recording){
            try{
                InitMediaRecoder();
                mediaRecorder.prepare();
                mediaRecorder.start();
                recording= true;
            }catch (IOException e) {
            // TODO: handle exception
            }
        }
    }
    break;

Class Initialization

The business logic of Loggy uses two fundamental class of Android's framework to capture the multimedia file contents.

  • Camera class: this class is used to setup the image capture, start/stop the preview, capture the frame and to obtain each single frame to encoding and recording  the videos. For a correct use of the Camera class, follow this step in order:
    1. Obtain an instance of the class through the its a static methods open();
    2. Retrieve the default settings with setParameters()
    3. if necessary, modify the returned Camera.Parameters object and call set Parameters(Camera.Parameters)
    4. Set the surface holder to see the preview 
    5. Start the preview using startPreview() method

    After that, we can take pictures using the takePicture() method.

  • MediaRecorder class: the MediaRecorder class is used to record audio and video streams. It needs of an instance of Camera class. Below the steps to create a correct MediaRecorder object:
    1. Create an instance of MediaRecorder class
    2. Set the audio source
    3. Set the output format
    4. Set the audio encoding  
    5. Set the path where the software saves the video files
    6. Invoke the prepare() method to initialize the MediaRecorder with the previous settings
    7. Start recording by start() method

    Finally, call the stop, reset, and release methods to release the MediaRecorder resources to another process.

Face tagging and photo organizer:

Wrote the code, we must create the architecture to send the multimedia files to the server. The communication protocol used is the FTP (File Transfer Protocol).

Smartphone's Configuration:

This step is so simple. We must only download and install AndFTP app form the PlayStore.

FTP Server Configuration:

Do you know FileZilla Server? If your answer is "No", FileZilla server is a software that allow to create a FTP server. With it you can manage the users, the home path and the relative permissions. Follow this stemp to setup the environment:

  1. Download the FileZilla Server bin package  from here: https://filezilla-project.org/download.php?type=server
  2. Install it
  3. After that, run server(the icon is on your desktop)
  4. Create one user with his relative HOME_PATH- This path will contain all of multimedia files captured by the Android phone
  5. Test the connection using the AndFTP Android's app.

Photo Gallery:

Now we can catalog our transferred multimedia files using Windows Photo Gallery. Open Photo Gallery and click on the top-left blue button: 

Image 2

Then add the folder that contains the multimedia files of Loggy:

Image 3

After that select only the Loggy's folder an the left list and click on "Batch people tag" to tag all faces:

Image 4

Search person:

Now we have a catalog of person. With the Search function of Photo Gallery we can known when we have meet a person for example,or if is possible we can known where we have meet it! 

Image Captured:

Below several image captured by Loggy!

  • Me using Loggy: 

    Image 5

  • Me using Loggy(2): 

    Image 6

  • Me driving my car: 

    Image 7

  • My Parrot 

    Image 8

  • My Iguana:  

    Image 9

Conclusions

With Loggy you can store your life and tag your friend on Facebook. I use this project for more day and i have store more GigaByte of data! For more information see my website( www.blesciasw.it). 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Futura Enterprise Srl
Italy Italy
Software developer with great passion for innovative technology. Open source application writer for disabilities person.(www.blesciasw.it)

Comments and Discussions

 
QuestionThat's pretty neat Pin
Sacha Barber16-Oct-13 23:12
Sacha Barber16-Oct-13 23:12 
AnswerRe: That's pretty neat Pin
Antonio Blescia16-Oct-13 23:16
Antonio Blescia16-Oct-13 23:16 
GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA13-Jun-13 20:50
professionalȘtefan-Mihai MOGA13-Jun-13 20:50 
Questioninteresting Pin
BillW337-Jun-13 10:37
professionalBillW337-Jun-13 10:37 
AnswerRe: interesting Pin
Antonio Blescia11-Jun-13 22:49
Antonio Blescia11-Jun-13 22:49 
Questionwhy loggy is so funny Pin
Member 99673343-Jun-13 14:36
Member 99673343-Jun-13 14:36 
AnswerRe: why loggy is so funny Pin
Antonio Blescia3-Jun-13 20:50
Antonio Blescia3-Jun-13 20:50 
GeneralMy vote of 5 Pin
Cornelius Henning1-Jun-13 2:07
professionalCornelius Henning1-Jun-13 2:07 
GeneralMy vote of 5 Pin
Ranjan.D31-May-13 5:03
professionalRanjan.D31-May-13 5:03 
GeneralRe: My vote of 5 Pin
Antonio Blescia31-May-13 5:08
Antonio Blescia31-May-13 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.