2016년 7월 30일 토요일

RPI is not good handling DHT11

Hello?

This is failure story about converting c code to python.

There is GPIO controlling library on Python such as RPI, wiringPI.

But they are not enough to controlling high frequency data.

some people already investigate about it.
http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/


Follow code return wrong values because frequency.

So I should hybrid c++ and python codes.


2016년 7월 28일 목요일

Change whole things.

Hello?


I decide to renew whole devices.




Finally, there is a lego frame for raspberry pi.

This one has motion sensor, humid sensor, camera, IR receiver.

I will use Django, python for gathering daily logs.

Fun coding guys :)

2016년 5월 28일 토요일

Wii fit scale for activity application

Many people who bought Wii, they has a wii fit scale. 

I am one of them. I find a way to use it.

There is a developer who already connect wii fit scale board to android.

https://github.com/paulburton/fitscales

It seems that there is a FitBit, Runkeeper sync feature.

S Health will be a another sync option. because they also have a api to sync data 

Samsung health idk

http://developer.samsung.com/health#none

Anyway, I try to change the github code and try to add sync feature to it. 

Happy coding..

2015년 8월 28일 금요일

iPython...

I have meet the wall for analyse the data from sensors. If I have a lot of time it is possible to make whole code.

But I have a job and that job is so busy. I heard iPython, Numpy, and pandas from my Facebook friends.

That tool is seems very good!..

My project is postponed until study these tools.

I think I can make program with python.

be happy !



2015년 8월 19일 수요일

New power saving mode in android M.

Android M adds powerful battery managing modes. One is doze and the other is app stand by.

Today google Korea campus, there is conference about these two modes.
I write summary about the conference meeting.
Mr yang and many other company people are participated in.

Because M source code is not released yet, we just talk and sharing testing results about these two modes. So following question (other company people) and answer (Mr yang from google) may have wrong informations.

So, testing your application using adb commend. Some pending events will occurs malfunction to your applications.

Q&A

1. What is doze mode?
 - Doze mode aim is for saving battery when user does not move their device for a long time. For example, if user forget to charging the phone, and slept. The phone turn to doze mode until wake up at the morning.  In the doze mode, whole app does not working at all. (some hardware interrupt and google play service can working even it is doze mode.)

2. How to prevent to enter doze?
  - There is no way to prevent by coding level.
  - The only way is using white list in battery manager and condition on developer pages.

3.  Can I detects the doze?
  -  No

4. How to return from doze to inactive? (Android app state has active (screen on), inactive (screen off), idle_pending, sensing -> ( idle -> idle_maintenance), from 2015 google IO extended. )
  -  Screen on, battery charging, move device (walking)
  - It seems that when screen off, device uses significant moving sensor for changing mode.

5. How to testing?
  - In google developer page has some errors, so testing like this :
  a. adb shell dumpsys battery unplug
  b. adb shell dumpsys deviceidle step
  c. do "b" steps, until mode changes to idle.
  d. checking state changes using following commend.
     adb shell dumpsys deviceidle

 - doze seems pending all events likes alarm, intent.. etc while doze mode is on.

 6. What is app standby mode?
 - This mode aim is for saving battery when user does not using app for a long time. For example, application does not runs by user during 2 weeks. It prevent to access battery consumption jobs likes networking. It will block background application/services to use a lot of battery.

 7. How to prevent to enter app standby
 - User cannot prevent using code.
 - There is condition on the site (user interaction, foreground, generate notification, white list on setting)

 8. How to reset the app standby?
 -  4 prevent condition will reset the app standby.

 9. Can I detect the app standby?
 - No

 10.  How to testing?
 - In google developer page has some errors.
 a. adb shell dump sys battery unplug
 b. adb shell am set-inactive <packagename> true/false
 c. checking mode using following commend
     adb shell am get-inactive <packagename>

 - app standby seems to has ability to receive alarms and service sticky  restarting but networking is not working.
 - Widget affects this mode. It means when widget is registered, app standby mode is disabled. But it is not permenent.
 - See the notification of the program also disable this mode. It is permanent disable.  


* These two mode does not killing application at all.
* When change application behaviour or UX, be mind current behaviour is not final, just look concept. (current behaviour means get some result from testing application using adb commend.)
* Many people concerns their background services.
* Some behaviour is very critically harmed when the behaviour using networking, ble. Especially, periodic networking syncing will not goes on when enter these two mode.
* Even more application user cannot concern notification UX when entering these two modes, because there is no api or intent.

So.. I hope good luck with your application testing.  In my opinion, it was fortunate these two mode not killing application.

References
https://developer.android.com/preview/features/power-mgmt.html
https://www.youtube.com/watch?v=X8eQn2E6GKw

2015년 6월 14일 일요일

Progress

Done :
1. AWS mysql server
2. AWS webpage
3. raspberry pi code is ready
  - Degree, Humidity, Movement
  - Upload information to AWS mysql
4. Web page


Not yet
1. phone application for logging event.
2. analysis module.


After some month, if I have a time, I will add more information this project again.

Following code is web page code for data viewing and some snapshot.




2015년 2월 20일 금요일

Everyone likes Lego.

If we have no proper case, lego is always perfect choice.

I build house for my sensors.

Problem is the light, my baby turn off all light when she go to bed.  





2015년 2월 16일 월요일

Test DHT11 and SEN0018 raspberry

Actually I am not familiar with hardware, so I bought sensors which are already output the digital signal.

Follow pictures are DHT11 and SEN0018. The first one DHT11 can collect humanity and degree information. The second one SEN0018 can collect movement human body using ultra ray.

<Front of SEN0018>

<Back of SEN0018>

<Front of DHT11> 

<Back of DHT11>


I connect these sensor's signal line to GPIO G04 (DHT11) and G18(SEN0018).  DHT11 needs 3V input and SEN0017 needs 5V input. The connection is done like following pictures.

<Raspberry PI>

<Connection Setup>


Following is DHT11 test code which can easily getting from web site. For example "http://www.uugear.com/portfolio/dht11-humidity-temperature-sensor-module/".


And Following code for SEN0018 codes which is made by me. I cannot find any open source code for SEN0018. So I make the code.

Each of codes are works fine.

Data not good, skip
Humidity = 41.0 % Temperature = 25.0 *C (77.0 *F)
Data not good, skip
Data not good, skip
Humidity = 40.0 % Temperature = 25.0 *C (77.0 *F)
Humidity = 40.0 % Temperature = 25.0 *C (77.0 *F)
Data not good, skip
Data not good, skip
Data not good, skip
Data not good, skip
Humidity = 40.0 % Temperature = 25.0 *C (77.0 *F)
^Cpi@raspberrypi ~ $ 


pi@raspberrypi ~ $ sudo ./test.o 
Sensor start
state = 1
state = 0
state = 1


Next time I will merge these code and save the log data to db in raspberry PI.


2015년 2월 7일 토요일

2015 Project #1. Motion, Humanity, and Degree monitoring with Raspberry pi and Data analysis with baby cold symptom.

I have 2 years old baby. She take a cold very frequently.

So I decide to make the  monitoring tool in her sleeping room.

I will get motion, humid and degree information from raspberry pi and analysis it.

If I found some meaningful relationship, I will make a iPhone alert application for mother.

I will post

1. How to make a sensor logger with raspberry pi.
2. Logging policy and make an databases.
3. Analysis the logs.

Is it working?


2013년 12월 31일 화요일

Fix iOS 7 trust device problem on ubuntu 12.04

I think libimobiledevice's developer will give better solution than this guide, soon.
In developer homepage, easy way will be adopted  on 1.1.6.

This guide is just compile and update the newest version of the libimobiledevice and the ifuse.

So, I assume that a reader has a knowledge about using make, cmake, automake, git .. etc which are using widely on developing.

And I also do follow things on my ubuntu 12.04 before update binary.

  1. Install libimobiledeivce-1.1.5 and related libraries.
     http://www.libimobiledevice.org

  2. Disable automount on desktop.
     http://askubuntu.com/questions/89244/how-to-disable-automount-in-nautiluss-preferences
 
Before to do this guide, you must find your original binaries on your system. In my system, it was "/usr", so I add "--prefix=/usr" when configuration. 

Now, lets go.

1. update libimobiledevice
 - git clone https://github.com/libimobiledevice/libimobiledevice
 - cd libimobiledevice
 - autoreconfig
 - automake --add-missing
 - ./configure --prefix=/usr
 - sudo make install

2. update ifuse
 - git clone  http://cgit.sukimashita.com/ifuse.git
 - cd ifuse
 - ./autogen.sh
 - ./configure --prefix=/usr
 - sudo make install

 * I also manually update the libfuse as 2.9.3.

After finished, following command works fine.

- idevicepair pair
  -- success
- idevicepair validate
  -- paried deivce införmation
- ifuse /media/iphone --root
  -- it works fine

Trust message does not bother me after update.

Happy new year.


2013년 12월 21일 토요일

ANT building on android development

If you want to make a script for building, installing and rebooting device, ant build is needed.
Next steps may can help you do make a script or batching.

1. install jdk on your system

2. install ant on your system

3. If you have a custom library or want to just reference jar files, do modify android-sdk/tools/ant/build.xml likes follow. In this example, library added ordered by XXX, YYY, ZZZ.
I remove two lines from original code because do not include jar on my code.

<!-- Compiles this project's .java files into .class files. -->
    <target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile">
        <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
            <!-- merge the project's own classpath and the tested project's classpath -->
            <path id="project.javac.classpath">
                <path refid="project.all.jars.path" />
                <path refid="tested.project.classpath" />
                <path path="${java.compiler.classpath}" />
            </path>
            <javac encoding="${java.encoding}"
                    source="${java.source}" target="${java.target}"
                    debug="true" extdirs="" includeantruntime="false"
                    destdir="${out.classes.absolute.dir}"
                    verbose="${verbose}"
                    fork="${need.javac.fork}">
                <src path="${source.absolute.dir}" />
                <src path="${gen.absolute.dir}" />
                <compilerarg line="${java.compilerargs}" />
                <classpath>
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="XXX.jar" />
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="YYY.jar" />
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="ZZZ.jar" />
                </classpath>   
            </javac>


This code is same thing on your eclipse menu as follow.



4. you can make build script like as follows
 android update project --name YOURPROJECT -p ./

5. you can implements keystore file on ant.property, next is just sample. you input your own string matching with your keystore. This step is just optional.

key.store=YOUR keystore path
key.alias=YOUR keystore alias
key.store.password=password

key.alias.password=password

6. build your project, you can also do "ant debug"
ant release

RPI is not good handling DHT11

Hello? This is failure story about converting c code to python. There is GPIO controlling library on Python such as RPI, wiringPI. But...