Categories
Uncategorized

Co2 Data Logging

Recently I was convinced by a friend to get a CO2 sensor to check on the levels in my apartment, citing the correlation to CO2 and cognitive function. The sensor I picked up immediately showed that the levels in my apartment were around 1800ppm above the recommended amount. I wanted to be able to log the CO2 levels over time so I threw together this quick project to read the data out of the sensor. Now I can see how opening different windows or doing things like turning on the bathroom fan affect the CO2 levels and how fast.

If you’re curious about logging CO2 levels and building a dashboard to show them this guide below should let you replicate my setup.

Parts

C02 sensor AZ Instrument RH7722
This is device that will do the actual measurement.
Particle photon
This will connect to the CO2 sensor and send the data to adafruit.io
Barrel Connector
This lets us connect the Particle to the CO2 sensor
Prototyping kit
If you don’t have a breadboard, a 1k resistor, or hookup wire this looks like an acceptable little kit

Wiring

Hook up the Photon like this, using a 1k resistor as a pull up for the UART communication.

Setup Adafruit IO

Setup an account on Adafruit IO
https://io.adafruit.com/

From there you will want to set up 3 new feeds named, temperature, humidity, and co2

Click the yellow AIO key link in the upper right to get your key and save it for the next step.

Programing the Photon

Now follow the instructions to get your Particle Photon connected to your wifi https://setup.particle.io/
One that is complete load up the code for this project here: https://go.particle.io/shared_apps/5ddc83012b93b800054a08b4
On line 4 put your AIO key from earlier into the quotes replacing the key_here text.
You can now flash this code to the Photon.

Once that is done, go back to the Adafruit IO page and you should see data in your feeds. You can now make a new dashboard that uses these feeds to show information. Have fun!

Categories
Uncategorized

Fix for Windows 8 hanging with 100% Hard Drive Usage

If Windows is suddenly tasked with a lot of HDD I/O it will lock up for 20 seconds or more. I’ve noticed mostly this when launching games or installing apps. This fix has worked for me in the past:

bcdedit /set disabledynamictick yes

Categories
3D Printing

RepRapRingtone

I threw together a quick web page to convert rtttl ringtones to gcode so that users can play ringtones on their printers. It’s great for print finished notifications. You need a printer firmware and that supports M300 and a buzzer. I’ve put in pull requests for Marlin and Repetier that add M300 support.

You can use the converter here:
http://ddrboxman.github.com/RepRapRingtone/

Categories
Android Mobile Development

Careful! Filters on Google Play

Recently Foodzy released a major update to their Android app. I had heard about it in the past and figured I would check it out. I went to install it from the Play Store and the only device that was listed as compatible was my HTC incredible. Even more intrigued I installed it and dumped the APK. Upon further inspection the manifest contained an un-needed requirement that explained why is only showed on one of my devices.

<uses-configuration android:reqFiveWayNav="true"/>

I let the developers at Foodzy know that they needed to remove just that line. The app now shows up on all the devices it should.
When running into issues with apps not showing up on the play store store for certain devices, be sure to check the filter list here and remove any un-needed filters.

Categories
Android Mobile Development

Is there a new Android Google Maps API around the corner?

Evidence that a new version of the Google Maps API has shown up in a recently released app named Field Trip. This app sits in the background and will alert you when you near interesting landmarks. There are wonderful looking maps throughout the application, that have much of the enhanced functionality that users are used to from the Google Maps app. It would seem that this app is not just for fun, and that Google is using it to test out a new version of the Google Maps API.

Decompiling Field Trip reveals some secrets about the new Maps API.
The application tag in the app manifest references “com.google.android.maps.v2.API_KEY”:

<application android:label="@string/app_name" android:icon="@drawable/launcher_icon" android:name="com.google.android.apps.scout.ScoutApplication" android:description="@string/app_description" android:hardwareAccelerated="true">
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="redacted" />

While most of the project has been obfuscated by proguard the com.google.maps package remains intact. Ever since Google introduced fragments developers have been requesting a MapFragment class. It would appear that there requests have been answered, the package contains a MapFragment.smali file. There is also a SupportMapFragment.smali for use with the compatibility libraries that google uses.

.class public Lcom/google/maps/MapFragment;
.super Landroid/app/Fragment;

# interfaces
.implements Lcom/google/maps/GoogleMap;

All signs point to the fact that the new maps API is almost ready for developers to use. Hopefully Google releases it sooner rather than later.

Categories
Uncategorized

Removing advertisements from the new Kindle Fire HD

Removing the ads from the new Kindle Fire HD is a fairly simple process.

First make sure to root your device, the method here should be quick and painless: http://forum.xda-developers.com/showthread.php?t=1893838

Now just open up a terminal and do the following:

adb shell
su
cd /data/data/com.amazon.kindle.kso/                        
rm -r ./adunits
touch adunits

Now the lockscreen should just show the stock photos.

Categories
Fitbit golang

Water Cooler, a web app for Fitbit

The FItbit is a futuristic pedometer that can track a users steps, the number of flights of stairs they climb and even how much they sleep at night. The companion website allows users to log the food they eat throughout the day and how much water they drink. It is often hard to remember to log the water that you have consumed throughout the day. I decided that I would write a quick web app that could help log the water that I drink at the office. I had also been wanting to try out the Go programming language for a while and this seemed like a good project to try it out on.

Water Cooler is meant to be run on a spare smartphone or other touchscreen device. At the office I’ve put an extra iPod touch on a dock and placed it on top of our water filter / dispenser. Now whenever I fill up my glass I simply just have to click my profile icon, choose the amount, and my drink is uploaded to Fitbit. Water Cooler then shows me how much of my daily water goal I have consumed.

For anyone interested in checking out the source, I’ve put it up on github: https://github.com/DDRBoxman/Water-Cooler

Categories
Android

Android Fragment layout

I recently ran into a problem when using a FragmentTranscation to replace a LinearLayout with a Fragment. The Fragment that I was putting into the layout was not filling the view port properly. Luckily it was a fairly easy problem to fix.

FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
trans.replace(R.id.main_fragment, mFragment);
trans.commit();

The code above was creating a layout that had an intermediary FrameLayout that did not have the proper layout parameters. NoSaveStateFrameLayout was set to “wrap_content” so the children were not filling the viewport.

Luckily the fix was just to change the code in onCreateView of the Fragment:

Incorrect:

View layout = inflater.inflate(R.layout.fragment_page_edit, null);

Correct:

View layout = inflater.inflate(R.layout.fragment_page_edit, container, false);
Categories
Uncategorized

Modifying Amazon’s Kindle app to hide soft keys on Ice Cream Sandwich

Ice Cream Sandwich introduced soft buttons to Android phones, and Google had forethought  enough to allow applications to dim these buttons so that they don’t distract from content like text and video. Sadly Amazon has yet to update their Kindle application to support this feature. Luckily we can take advantage of APK Multi-tool to de-compile, modify, and re-compile and resign applications. Below is a screen shot of how the app should look before and after the modifications.

First we need to create a temporary application so that we can get the Dalvik code that we want to inject into the Kindle application.

Create a test project in eclipse to get the dalvik code and put this into the onCreate method after setting the content.

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

We can use baksmali that comes with APK Multi-tool to de-compile this new app and find code similar to this:

invoke-virtual {p0}, Lcom/amazon/kcp/reader/ReaderActivity;->getWindow()Landroid/view/Window;
move-result-object v2
invoke-virtual {v2}, Landroid/view/Window;->getDecorView()Landroid/view/View;
move-result-object v2
const/4 v1, 0x1
invoke-virtual {v2, v1}, Landroid/view/View;->setSystemUiVisibility(I)V

Next we need to de-compile the Kindle app.

We want to change the code located in:

com/amazon/kcp/reader/ReaderActivity.smali

Now the code that was generated earlier can be inserted into the Reader activity after line 2027 which should look like this

invoke-virtual {p0, v0}, Lcom/amazon/kcp/reader/ReaderActivity;->setContentView(I)V

Once that is complete smali include with APK Multi-tool can be use to re-compile the modified app. The output can be pushed to an android device with adb and the soft buttons should now auto hide.

Categories
Android DIY Mobile Development

Android Kinect Projector Interface w/ System Access

Watch this video on YouTube.

This is a continuation of my work to create a way to interact with Android when it is being displayed on a large scale using a projector.

The setup I’m using consists of a Kinect hooked up to a Windows PC running Simple Kinect Touch. This software processes the input from the Kinect and sends TUIO commands to a Galaxy Nexus running TuioForAndroid. These events get injected into the OS as touch events allowing control over any application. The projector is connected to the Galaxy Nexus with a MHL adapter.

In order to give  TuioForAndroid system access I had to download the AOSP source tree and compile a rom for my Galaxy Nexus.  TuioForAndroid must be signed with the System key so that it can get a system pid to inject the touch events into the OS.