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:
- Android Smartphone with front camera
- Windows Seven or 8
- Mindwave Headset
- Loggy.apk
- FileZilla Server
- 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:
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) {
}
}
}
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:
- Obtain an instance of the class through the its a static methods
open();
- Retrieve the default settings with s
etParameters()
- if necessary, modify the returned
Camera.Parameters
object and call set Parameters(Camera.Parameters)
- Set the surface holder to see the preview
- 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:
- Create an instance of
MediaRecorder
class - Set the audio source
- Set the output format
- Set the audio encoding
- Set the path where the software saves the video files
- Invoke the
prepare()
method to initialize the MediaRecorder
with the previous settings - 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:
- Download the FileZilla Server bin package from here: https://filezilla-project.org/download.php?type=server
- Install it
- After that, run server(the icon is on your desktop)
- Create one user with his relative HOME_PATH- This path will contain all of multimedia files captured by the Android phone
- 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:
Then add the folder that contains the multimedia files of Loggy:
After that select only the Loggy's folder an the left list and click on "Batch people tag" to tag all faces:
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:
- Me using Loggy(2):
- Me driving my car:
- My Parrot
- My Iguana:
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).