iPhone Development

MyRvApp

MyRvApp is an iPhone app that I’ve been working on to control my Arduino-equipped RV. The concept is pretty simple:

  • Display the floor plan of the RV
  • Controllable lights have circles overlaid to show their location
  • Tapping on a circle turns the light on or off
  • The color or alpha of the circle changes to reflect on/off state

Lights are controlled by Arduinos. These in turn communicate with each other over a simple RF24 radio network. One of the Arduinos is also connected to WiFi and Particle.io and serves as a bridge for all of the Arduinos.

Initially, lights will be hardcoded into the app. Going forward though, I’ll want the Arduinos to self publish information about their location and capabilities. This differs from HomeKit in that units are configured within each’s Arduino code. I’m doing this because I want to distribute the intelligence of the system across all of the units, instead of locating it all within a single point of control. I believe that this will result in a more robust, and eventually more intelligent system.

I’ll be creating a Github repo for this code and will be posting links here.

Arduino Hackathon

After about a month’s preparation, we successfully conducted an Arduino Hackathon this past Friday. It was great to get more folks at work excited about all the things that can be done using this technology. I’m really looking forward to seeing what folks do with it, now that they understand it and have seen how easy it is to use. I’ll add some links to the Mutual Mobile website once pictures get posted there.

Playing with Arduino

I’ve been busy playing with Arduinos these past few months. I think I must have been locked in a cave the past 8 years or so. I’ve been shocked by how advanced and inexpensive these things have become. These things are awesome, and very inexpensive. I plan on installing a dozen or so throughout my RV to control just about everything. Couple that with my iPhone programming skills, HomeKit, Siri, and the new Amazon Echo, and this is going to be a high tech playground for me. Woohoo!

I had been struggling with getting nRF24+ radios working, to provide cheap communication between Arduinos. It turns out that a bunch of folks at MySensors have already implemented a very cool, open source solution along the same lines. This is an incredible site. The information there really helped me get my radios working. They’ve done a lot of good work to provide clear instructions on how to connect multiple Arduinos together using open source software. These Arduinos can then read various types of sensors in order to control all sorts of things. I feel like a kid in a candy store (“ooh, which one do I want next?”). The crazy part is the price of these parts. They have a really well done page listing out links to buy all the various parts at unbelievable prices. Thank you MySensors!

Unfortunately, I think I’ve let myself become spread too thin across exploring and playing with all these cool technologies. I’ve written an iPhone app and Apple Watch extension that uses the Lightblue Bean to display the level of the RV remotely. I got it working well enough to use for myself, but I haven’t taken the final steps to post it to the App Store so that others can use it also. It’s very close to being in a state that can be released to the app store, but I’d rather play with new Arduino projects instead of spending the time to finish and submit it. I’ve also setup several Arduinos to control fans and lights in the RV, but they’re still sitting on the workbench. I’m trying to get them connected to the internet so the Echo and iPhone can control them.

So now I’m going to try to be disciplined with myself, and focus on getting a few basic pieces done and installed before worrying about adding more advanced features. With the 3 day weekend coming up, I’m hoping to get the Lightblue Bean installed in my closet to control a string of led lights based on sliding door microswitches, and an Arduino Uno hooked up to control dimming some LED recessed spotlights that I installe over my booth workbench. I’ll post back later about how that goes.

RV Automation using LightBlue Bean

I’ve started playing with the LightBlue Bean as a part of my RV Automation project. This $30 part combines a low power, 3.3v Arduino board with Bluetooth LE, several sensors, and an attached 3.3v watch battery. This means that it can be used to do a lot of jobs without any connections whatsoever, and it can talk with an iPhone over BTLE.

I first heard about this part from a github article that my friend Sean wrote. It’s a well written article, fun to read, and I recommend that you read it. Thank you, Sean.

What Can I Do With A LightBlue Bean?

Using Bluetooth

I think the best thing about this part is the built-in blue tooth.

iPhone Connection

I expect the bean to be a bridge from my iPhone to other Arduinos. BTLE makes it very simple to interface to an iOS device using

iBeacon

I may be able to take advantage of the fact that any BTLE device can be configured to act as an iBeacon. This will enable the iPhone app to determine proximity to it. This leads to all sort of automation possibilities:

  • Turning nearby lights on/off
  • Disabling security system when near
  • Unlocking doors

Of course, security will be important, so I’ll have to consider carefully the use of a passcode or some other system to prevent allowing unwanted access if my phone is stolen.

Using the built-in 3 axis accelerometer

The bean also includes a built-in 3 axis accelerometer. This means that it can detect motion in any direction.

Security System

One of the shortcomings of living in an RV is that it moves when walking around inside of it. I’m planning on turning this into an advantage, and use this as a component of my security system.

Leveling

The accelerometer will be used to help me level the RV when parking. Since gravity is indistinguishable from acceleration, it makes a great way to check for level. I’ll need a way to calibrate the level settings after mounting the bean, and I’ll want to convert the accelerator readings from Gs to angle for display on my iPhone.

Door Motion

Another possible application, but one I don’t plan on using at this time, would be to mount the bean to a door. Since it’s battery operated, this could be as simple as just sticking it onto a door.

Using the Temperature Sensor

This is a no-brainer, but does require me to think about where I mount it. Do I want interior or exterior temperature readings?

Using the RBG LED

Status Display

I expect to mount the LED such that it can be used for displaying status of some sort. It can display any color, and be dimmed and/or blinked, allowing for a large range of indications.

Interfacing with Other Arduinos

I expect the bean to be a bridge from my iPhone to other Arduinos using inexpensive RF24 parts. These can be purchased for under $2 each.

Replacing the Battery

I expect to connect it to my RVs 12v system eventually, so I don’t have to keep replacing batteries. This will require a 3.3v regulator. The LD1117v33 is available from Amazon for under $2.

HomeKit

I’ve been playing with Apple’s new HomeKit framework. It attempts to provide a way to integrated all your automated home devices, allowing a single app to control them all. Even better, Siri can be used.

This is still early, so we’ll have to see how it plays out. But you can bet I’m going to be looking at how to use this technology in my RV. I’ll be blogging about it going forward.

Lavaca and Bower and Grunt, oh my!

I had a couple weeks off over the holidays. Since we didn’t have any big plans, I wanted to take the opportunity to learn something different. So I chose to dive into learning Lavaca.

Lavaca is a “curated collection of tools” that provides a “web application framework designed to jumpstart development of hybrid and single page applications”. It is available free from Github.

I had really thought that this would be a fairly quick exercise. I’m already familiar with HTML, CSS, JavaScript, jQuery, PHP, and so forth. But I was in for a bit of a surprise. I guess in the past few years that I’ve been focused on learning iOS and native mobile technologies, the face of web development has changed. And it’s changed a lot.

I’m glad to say that the days of throwing together some HTML, CSS, and JavaScript files to create a static website are gone. Websites are now created using real software engineering practices such as build systems, automated testingdependency management, and formal deployment mechanisms. Sure, one can still throw together some files and upload them using FTP, but why would one want to do so? The good news is that there are powerful, open source tools available to automate and manage the whole process. The bad news (for me) was that there are a bunch of powerful, open source tools that I needed to learn to use. But that’s not really bad news, is it?

I realized that I needed a project to work on. I’ve never been able to learn new things very well unless I could find some way to apply it. So I reached back into my past projects, did some looking around, and found that the Celestino Couture website that I converted to WordPress several years ago hadn’t been updated in about that long. So I contacted Rusty and Sergio and asked if I could use their website as an exercise in learning Lavaca, and with their ok, off I went.

My goal in this exercise is to create a responsive web design that will be easy to maintain and extend over time, and can be deployed natively to Android and iOS devices, as well as the web and other mobile devices.

So I created a test site, and started through the Lavaca Guide, taking side trips to go learn Bower, RequireJS, Node, Grunt, YUIDoc, Dust, LESS, and Jasmine. It’s been fun, and I still have a lot to learn and a lot to do to finish up the new website, but it’s been a great experience. I’m really delighted with what our web team has been doing with Lavaca, and glad to get a better handle on the capabilities of responsive web versus native apps.

So that’s what I did over the holidays. I’ve got to say that it has been a blast! I still have a lot of learning to do, but I’m really enjoying it.

AppCode 2.0 Released

JetBrainz has released a major update (2.0) to AppCode. I purchased my copy about 6 months ago, so the upgrade is free (anytime within 12 months).

The announcement says that Kiwi is now supported, so of course I needed to get a copy and check it out.

I’ve been wanting to redo the WhatsMySpeed code using true TDD with Kiwi, so I’m going to take this opportunity to try out AppCode 2.0 while I’m at it. I’m renaming it to HowsMyFuel to avoid confusion with the older code.

I’ve created a new public repository on GitHub to track this work. Feel free to watch and comment as I go. Since it is on git, you can use the git commit comments to monitor updates.

Motivation for Converting from Subversion to Git

We’re in the process of converting to Git at work. We’ve been talking about doing this for quite awhile, but never really had a compelling reason to do so. Recently though, something happened that has given us that reason.

Many of our projects are done with teams in both Hyderabad and India. We refer to these as “hybrid” projects. In a recent hybrid project, the SVN repository contained a lot of large assets (movies, images, PSDs, etc). Unfortunately, the internet bandwidth in our India office has been pretty bad. This caused updates to/from the svn server to take a very long time. This by itself caused delays, due to the time it took to sync up at the beginning and end of each location’s workday.

But then we threw a real monkey wrench into the works by converting the project to “Branch Based Development”. BBD has become a best practice where I work. We use this term to mean that a branch is created for each and every development task, then the branch is merged back into trunk only after it has been completed, tested, and code reviewed. However, branching/merging in Subversion requires essentially downloading then uploading the entire branch/trunk. I’m probably oversimplifying this, but the result was that each task ended up incurring that long update delay. Often multiple tasks can be completed in a single day, so now instead of a single delay at the beginning or end of the day, we ended up having this delay multiple times per day. At its worst, we were looking a 1-2 hours of delay per task!

At that point, someone pointed out that had we been using Git, this would not have been a problem. Git is much smarter about its branching, and doesn’t require this full upload/download to the remote. Granted, better organization of our svn repositories could have alleviated much of this problem, but we recognized that for international development, a DVCS like Git would be valuable and improve productivity.

So we’re using Git now. My experience with Git has been pretty much limited to clicking on the “Clone in Mac” button on Github. So I needed to learn Git.

Luckily, lynda.com has a very nice Git Essential Training course by Kevin Skoglund. I just completed that course this morning, and I’m excited now to get started using Git.  I recommend that you checkout the lynda.com course if you are just getting started with Git also.

iOS Development on iPad

I’ve started looking at if/how to do iOS development on an actual iPad. I currently use an 11″ Macbook Air. It’s portable and powerful. But I find myself doing everything on the MBA instead of learning how to really use the iPad.

With that in mind, I’m trying to force myself into really using the iPad for everything. It’s clear that most things will be a snap (email, chat, conferencing, etc), but iOS development is a bit of a challenge.

A couple approaches appear obvious:

  1. Remote Desktop to a development system
  2. Edit on iPad, and use FTP/Dropbox/etc. to sync to a development system.
  3. Get Apple to recompile Xcode for iPad (or JetBrains to recompile AppCode for iPad).

The first option is fairly straight forward. Tools such as TeamViewer and PocketCloud make this fairly simple. The only trick here is to set the development system’s screen resolution to match the iPad. This eliminates the need to scroll over the viewport.

The second option is perhaps more interesting. It should have a definite performance advantages, but somewhat greater complexity. There are several blogs talking about using DropBox to expose files on the iPad, then using Textastic or Koder to do the editing.

Option 3 is of course Nirvana for this, but totally out of our control. Anyone from Apple or JetBrains listening?