Continuing with 3-D Printing: The iPhone-based Colored Object Tracker

It stalks! It records video! My latest project is a lot more involved – I wanted to build a device that could track & record a colored object as it moved around.

Here’s a video of a prototype version:

As you can see, it’s a 3-D printed object that holds an iPhone in a sort of cage. The movable cage is connected to a servo, which turns the iPhone around as it tracks and records a colored object.

I have some applications in mind which require visual feedback. For example, I’d like to use it to follow and record an ice hockey player wearing a particular jersey/socks color combination. Because it’s constantly following the player, the video can be quite zoomed in, resulting in the player appearing quite large and clear in the video. This will be very helpful for training and feedback purposes.

I suppose it can be helpful in any situation where visual feedback is helpful, and the person is moving around, such as in ballroom dancing, etc.

Advertisements

Experiments in 3D printing: Bathtub Shelf

I first started designing objects for 3D printing using the open-source design software, Blender. However, I found it quite tedious. Blender was designed for a very different purpose: it was designed to model objects in 3D for rendering and animation. Designing a 3D object that is printable is a whole other story. And so with Blender it took me a long time to make 3D models that could be printed.

On the other hand, if a software were designed explicitly to make objects for 3D printing, then it could be much better. It could leave out the hundreds of features that are not needed for 3D printing (shading, lighting, physics effects, etc). And it could only allow operations that resulted in objects that could be 3D printed, making it idiot proof.

I was thrilled to find that such a software existed. And even better, it’s free and runs entirely in a web browser. Cloud-based, yeah! It’s called TinkerCad. It’s super easy to use and optimized for 3D printing. It took me just a couple of hours to custom design a shelf for my bathtub. And Shapeways readily accepted the design and printed it, and in a couple of weeks I got the shelf. Check it out!

3D printed bathtub shelf

Here’s my design file on TinkerCad, and here’s the design on Shapeways for printing. It’s pretty cool to compare the picture above with the design as you can see below:

 

3D model of shelf

 

What I liked about creating this design is that it’s quite complex with all the holes and angles, but yet it was very easy to do with TinkerCad. It would have taken me days with Blender.

I’m now working on an even more complex design with moving parts and round shapes. Let’s see if it prints well. I should be getting it in a few weeks, very excited! Here’s a preview.

Bedside box

My favorite web-app stack for medium-sized applications

I have an ongoing goal of creating many subscription web applications in 40 hours. If 500 Startups’ goal is to fund many startups with micro funding, my goal is to create many small startups with little time.

I try to meet these criteria when creating those web applications:

  • It should reside on as much free infrastructure as possible.
  • It should be ready to scale in case it takes off.
  • It should be revenue generating from day 1.
  • It should be designed to support thousands of simultaneous users.
  • It should require minimum maintenance from me. Once it’s live, it should keep on going.

I have a very strong opinion on the stack. Here’s what I’d go for:

Heroku for the cloud server infrastructure

Absolutely Heroku. I wouldn’t go with anything else right now. It’s a joy to use once you figure it out. It has a free tier which is very performant for websites that are not busy yet. It can be scaled with one command. It has easy-add add-ons like memcache when you need to scale. It uses Git for deployments. It monitors the app and brings up a new one if any instances crash.

Postgres on Heroku

No matter how awesome NoSQL is, I still need the ability to query and sort structured data. I try to use a combination of NoSQL (to store large data) and Postgres (only for light data that needs sorting and querying).

Postgres on Heroku is absolutely the way to go. It’s managed so I don’t have to do upgrades, maintenance etc. It has a bunch of common utilities like making snapshots and backups, cloning, etc. I don’t have to worry about underlying physical hardware. Win.

And I have lots of experience with Postgres and I know it can handle millions of rows with no problems.

Beware of using one-schema-per-customer though. That is Postgres’ Achilles heel. It dies under the weight of hundreds of schemas. Backups and restores take 10 hours or more. Even Heroku says don’t do it!

Amazon DynamoDB

For the NoSQL layer, I like DynamoDB. It is very fast both from my local machine as well as from Heroku (Heroku uses Amazon US East – Virginia fyi). I trust Amazon’s cloud infra. They use it internally and since it powers Amazon surely it can power my little app.

HTML5 + JavaScript single page app

I like creating a single-page app. You completely remove all the headache of passing data back and forth between pages.

Yes you do have to deal with some History/back/forward button issues but only once. You also have to deal with dynamically loading resources if your app gets big. But after that it’s single-page nirvana.

It’s wonderful to be able to code all your front-end stuff purely in JavaScript.

Build server-side services as REST API and use them via your front-end

It is no more difficult to build your server-side services as REST APIs. You may as well do so. This way you can easily open up the API in the future. Plus it makes a lot of sense.

Server-side language: Java

This is not a hard decision for my personal projects since I’m very comfortable with Java. However, I can see that NodeJS is attractive because it’s easier to hire JavaScript developers than Java developers.

App Server: Tapestry

This is not the most ideal app server. I was actually looking for something far more lightweight than Tapestry. For some reason I thought Tapestry was that light-weight solution. But it’s definitely doable for me. Key features: It uses Java. It has nice injection framework. It’s use of Maven and the Maven Repository is wonderful. Adding new modules is so easy.

Maven

Maven as a build tool is great, especially with Tapestry. Heroku for Java kinda needs it too. I just really like how easy it is to add new modules and then deploy to Heroku.

GitHub

I especially like how I can push to GitHub to commit and then push to Heroku to deploy.

Conclusion

I really, really like the above web app stack. Cost effective, time effective, and ready to scale.

Tracking server configuration files with GitHub

I’m really digging Git and GitHub. It’s simple to set up, and GitHub provides a great hosted service.

So I wondered if it would be possible to commit configuration files from production and development servers onto GitHub. This way, we’d never get confused over changes, and if any of the servers were to die on us, we’d have the configuration files safe and sound. And if it were to work the way I thought it could, it would be as simple as adding any file, anywhere on the server, and committing it.

Alas, after a quick search on the web, the message I got was this: Git isn’t designed to track server configuration filles, and I should use one of the specialized configuration management tools out there. Git isn’t appropriate because:

  • It tracks all the contents in a working directory. It’s not great at cherry picking files from around the file system.
  • When you do a pull, you have to pull all the contents at once.

But darn it, I don’t want to have to install and learn a configuration management tool. And I couldn’t find any hosted solutions that was dead simple to use.


It took me a few days but finally the solution dawned on me. And, like most solutions that emerge only after your subconscious has a go at it, it IS dead simple. And yes, I can use Git. Score.

The idea is to create a central location where all your configuration files can be copied to, complete with directory structure. You then manage that central location as a normal git repository. The key is a script which will copy any configuration file to the git repo.

Here are the steps.

1. Create an empty repo on GitHub

I find it’s always easiest to create an empty repo on GitHub, and then to clone that.

2. Pull the empty repo to your server

You can do this on all your servers.

git clone {your github repo URL}

3. Create the script file, track.sh

I’m using linux, so modify as appropriate.

mkdir -p /home/maestro/{your git repo name}/`hostname``pwd`/
cp $1 /home/maestro/{your git repo name}/`hostname``pwd`/$1

This script file will copy whatever file you want to track to the git repo directory. It will insert the hostname so that all the files are separated by server.

4. Start tracking files!

To track a file, you first change to the directory of interest and then you run the script on the target file.

For example, let’s say I want to track my PostgresDB configuration file.

cd /var/lib/pgsql/data
track.sh postgresql.conf

Voila! Now the configuration file is in the git repo, and you can commit and push that as normal.

Tracking server configuration files via GitHub makes me happy.

My experience with Tropo has been good

I’m happy to say we’ve gone live with using Tropo for our international, outbound SMS messages.

In the early days, all I heard was Twilio, with the occasional mention of Tropo. Now that Twilio doesn’t support international SMS, I had to reinvestigate SMS options.

At first I tried Nexmo, but that didn’t work immediately, and I gave up right away and tried Tropo. True, I may have done something wrong with Nexmo, so I can’t say anything much.

In fact, even with Tropo my first attempt didn’t go well, but I decided to contact support and they helped me out.

After that, the experience has been great.  International SMS seems solid. They say they have years and years of doing this, so that makes sense.

iMovie imports HDV but plays it “slowly”

This weekend, we have a big family function (a family concert, actually), and dad tested out his HDV camera to make sure everything was working correctly.

It wasn’t.

Footage he captured from his Sony HDV camera (A PAL camera) would get imported into iMovie incorrectly. During import, things appear correct. But once the import completes, the length of the clip displayed suddenly becomes longer by about 20%, and playing back the clip shows that the playback is slower by about 20% and the sound is of lower pitch (consistent with slower playback).

I was convinced this was caused by some kind of NTSC – PAL framerate issue, since they differ by about 20%. I took the imported .mov clip into my windows PC, ran GSpot on it, and correctly the frame rate is 25 fps. So why is iMovie playing the video incorrectly?

I attribute it to some bug in iMovie 6. Dad has refused to upgrade to iMovie 11, but I finally convinced him and he will do it next week.

Meanwhile, I managed to find a workaround for the problem. I simply had to copy the clips out of iMovie onto a folder, and then copy it back… and voila, the clips now have the proper length and playback speed.