Hackathon and the Digital Pantry of the Future

This weekend I participated in my first hackathon. If you don’t know, a hackathon is some sort of technology competition (usually) where people get together and make whatever they want (sometimes) in 24 hours (usually). Sometimes hackathons are different, maybe based around a specific goal or lasting 48 hours, but this one was free form and 24 hours.

This hackathon is called hackpoly and it’s hosted by the business college at Cal Poly Pomona. It is the first CPP hackathon, but it went quite smoothly. They had great speakers from Space-X and the startup, At The Pool, and after the speeches, the hacking began. 18 teams competed diligently to get their idea off the ground and very few people slept.

I was particularly excited about my team’s project. I was on a team with 3 senior computer science/engineering majors and we had a very ambitious goal. We wanted to create a system that keeps track of what food you have in your kitchen and suggests recipes that you can make with what you have. I would write the iPhone app, Garrett would write the Windows Phone app, Alex would write the Android app, and Steven would write the cloud service and a basic website. To at least some extent, we did all of these things. At the end, the iPhone app and Windows Phone app were at about the same place and had most of the basic functionality in place. The cloud service was also functional at a basic level.

I consider this a huge success. We got a lot done and we realize just how much potential our idea has.

Here’s the idea in a little more detail. The mobile app let’s you put food items from your kitchen into the app by typing them in or by scanning the barcode. The app then sends this data to our cloud server, the cloud server retrieves recipes from the amazing food2fork website, then you see these recipes that you can make with the food you have. To bring this idea into the modern age, we will also be developing a range of different hardware devices which keep track of your different food items and send that information directly to our cloud and back down to your mobile device. For example, a device could keep track of how much milk you have or when your spices have run out. This data would be immediately updated in the apps and website so you would always have an accurate list of recipes to make. Of course there are many times when you have almost enough to make a certain recipe. Say you have all the spices and vegetables to make a popular chicken curry recipe, but you don’t have chicken. The app will suggest that you can make this recipe if you buy some chicken.

I think that having this complete loop of hardware that automatically tracks your food inventory and software that tells you what you can make with it is the perfect combination for the home cook. This is the future of the kitchen.

We will be finishing the software in the next few months and then developing the hardware, likely starting with an internet connected spice rack.

Oh and by the way, we like won hackpoly and stuff. We got first place, as well as the “best use of food2fork” award since they were a sponsor.

Giving a Mac Intelligence

A few years ago I wrote a Mac application that didn’t do anything, except be stealthy. It ran in the background, without a dock icon or a toolbar icon. I could even change the process name so it looked like a system process to anyone casually looking at their processes. This app could’ve been the basis for some malicious code, but of course that was never my intention.

About a month ago I came up with a new way to use this hidden app. I was doing some work on the command line and I came across the “say” command. It gives you access to the speech center in every Mac. Run the command “say hello” and your Mac suddenly says hello to you just as you told it to. I realized that this has some interesting implications if applied correctly.

An application running in the background could spit out all sorts of entertaining things to the listener. I was originally planning on simply using cron to have the Mac say things at specified times. I then realized I could expand this idea using cocoa and making an app that had many more personality trait– erm… features…

Basically the whole premise of this project is to misuse lots of low level and some high level features that have some legitimate uses.

First I figured out how to get notifications of when the computer is about to go to sleep or when it has just woken up. This uses some low level magic that I just copy and pasted from the Apple reference material. This lets me create the main feature. When you close your laptop, the computer says “Nap time!”, then a few seconds later it says “zzzzzzzzz. I’m sleeping”. When you open your laptop it says “I’m awake!”. It’s a very fun and unexpected feature. It also uses applescript to turn the system volume up to 70% before saying those things so you can be assured they’ll be heard.

The problem is that this doesn’t work on computers newer than mine. I’m running OSX 10.6, but I tried it on two computers running 10.8 and the sleep talking doesn’t work. The system allows you to delay sleep, but it doesn’t let any sounds happen. Presumably Apple realized that when someone closes their laptop, they want it to fully shut up. This is of course problematic for this application, but probably good when my laptop starts making noise in the middle of class.

Regardless, I left this feature in place for those who it works for.

Of course it does need some other personality features as well. I realized that I could setup timers, originating when the user opened the computer. After a certain amount of time, a random amount of time, or at a certain time of day, the computer would do something interesting. In one case, I have it ask if you want to hear a joke. If you press yes, then you get a joke from a list of jokes curated by yours truly. If you press no, then you’re told that you’re boring.

Of course, if I tell you the rest of the features then they won’t be very interesting. So I’ll leave the others as surprises to those who I give this software to. I may post it online at some point as well if I can clean it up and make it work more reliably.

Quadrocopter 2013 Update

The last time I posted about my quadrocopter, I was about to have a ton of problems that would keep me from getting it working. That was still in 10th grade. That summer I mostly gave up on the project since I simply couldn’t get it to level properly.

At the end of senior year in high school in AP Physics I had the opportunity to do a physics project instead of taking the final. I had thought many times about revisiting my quadrocopter, but I never got around to it. Even though I didn’t touch it for the better part of 2 years, I was planning ways of making it work and learning new things in school and online.

After spending months and countless hundreds of hours trying to get it to work before, I got my quadrocopter working in a week. All I had to do was cushion the sensor boards from vibrations better and change a few lines of code. At first it didn’t work. Then I tried a vastly different PID tuning and suddenly it started flying reasonably well.

I had gotten so incredibly close to getting it to work years ago. There was just that last little push, along with a much clearer understanding of math, that I needed.

I made a powerpoint presentation for the class that I’m quite proud of. It explains the theoretical implementation behind quadrocopters, but not the practical physical part. I’ll upload a video of me presenting it soon. I also flew the quadrocopter for the class and it worked even better than when I had flown it at home.

Then I flew it more later that day. And I crashed it. I was trying to “bounce” it, by giving it a lot of throttle for a short period of time. Something happened in the software that made it go directly sideways at full power instead of up. It went directly into the side of a jacuzzi (not in the water luckily). At least one of the motors was completely ruined and all of the propellers were smashed and cracked. Luckily the other electronics didn’t seem to be damaged in any way to compromise their ability to work.

I decided to use this as an opportunity to upgrade the motors and propellers. Both of which were ridiculously cheap Chinese parts. Real motors should’ve cost at least $20, but these were only $5. I decided to go for $10 motors this time and real APC (not APC-style) propellers. The old propellers weren’t even APC-style. They were flimsy bendy pieces of plastic that I seriously doubt could effectively support the weight of the quadrocopter.

IMG_1137I’ve barely flown it since upgrading, mostly because I need more battery life and a better charger (the charger was also $5). It seems this motor/prop set is less responsive and uses more battery life. The motor rotors and propellers are much heavier and the propellers are larger in diameter. That equates to a much larger inertia. I think if I re-tune the PID then it will work just fine, and probably be more stable because of the nicer equipment. But right now it is not terribly stable.

IMG_1138

Websites for parts and services for building things

Parts and raw materials:

The BEST source. Ever. Period. But fairly expensive: http://www.mcmaster.com/

They’ve got metal (cheap metal but expensive shipping; limited selection of sizes; pretty good alloy selection): http://www.onlinemetals.com/

More metal (haven’t bought from them yet; looks like a great size selection; medium pricing): http://www.speedymetals.com/default.aspx?

Ball bearings (great selection for basic bearings; super cheap): http://www.thebigbearingstore.com/

More ball bearings (haven’t bought from them yet; mediocre website; interesting selection): http://vxb.com/

Super cheap composites, mainly carbon fiber (mediocre website; nice customer support; dirt cheap carbon fiber; good selection): http://www.sollercomposites.com/

Cheap Surplusy stuff (haven’t bought from them yet; looks super cheap): http://www.surpluscenter.com/home.asp

Super cheap RC parts (they have a Chinese warehouse as well as an American warehouse; generally good quality parts; good forum type comment system; often prone to long backorders): http://www.hobbyking.com/hobbyking/store/index.rc

When you can’t find what you need anywhere else… (oh and they have some books too): http://www.amazon.com

It’s best to try to not give into the FIRST corporate machine whenever possible, but sometimes… http://www.andymark.com/Default.asp

Robot motors and wheels: http://banebots.com/

Robot parts (haven’t bought from them yet; looks like good selection; good community of customers): http://www.robotmarketplace.com/store.html

If you want awesome interface electronics, look here (great LED items, screens, and other high level electronics parts and kits): http://adafruit.com/

Huge selection of high level hobby electronics (high margins; slightly non-techy feel; bad product specs): http://www.sparkfun.com/

Electric scooter parts (just like what it says on the tin): http://www.electricscooterparts.com/

Bolts, so many bolts (haven’t bought from them yet; looks cheap; huge selection): http://www.boltdepot.com/default.aspx

Services (haven’t tried any of these yet):

Laser cutting of thinish materials: http://www.ponoko.com/

Waterjet cutting: http://bigbluesaw.com/

3D printing (expensive): http://www.shapeways.com/

Carbon Fiber Trumpet

Please vote here: http://www.openhardwaresummit.org/open-hardware-scholarship-voting/

Accompanying video: http://www.youtube.com/watch?v=O-1-3z22V6k

The problem with traditional trumpets, and all brass instruments for that matter, is that they really just aren’t great for marching band. They’re heavy which makes them difficult to march with, they’re made of soft brass which restricts their tone and range, they’re made of metal which means they need to be warmed up in order to stay in tune, and they’re easily dented which ruins their sound quality. That’s a lot of problems.

I have a solution. Instead of making trumpets out of brass, why not make them out of carbon fiber? Carbon fiber is extremely light, and extremely strong and rigid. If a trumpet were made out of carbon fiber, it would be much lighter, it would have better tone because of the rigidity of carbon fiber, it wouldn’t need to be warmed up because carbon fiber doesn’t conduct heat very well, and it would resist denting much better because of the strength of carbon fiber. All of this makes for a much better experience for both the musician and the audience.

“This sounds like such a perfect trumpet, why does no one use carbon fiber trumpets?” Great question. The reason is because no one has made a carbon fiber trumpet before. I was able to find a single company who makes a trumpet with just a carbon fiber bell (http://www.dacarbo.ch/en/trumpets), but other than that it has never been attempted. “Why has no one made a carbon fiber trumpet before?” One reason is tradition. In the past brass instruments have been made out of brass and only brass. Other instruments have tried out different materials, but for the most part brass instruments have stayed very much the same. Another reason is because of price. The brass in a trumpet might cost less than $50, but with lots of work put in to build it, the price is brought up to around $1000 for a reasonably good trumpet. While a carbon fiber trumpet may be significantly easier to make than a brass trumpet, the materials going into a carbon fiber trumpet might cost hundreds of dollars, if not more.

This is where I need help if I’m going to create a carbon fiber trumpet. If you are here from my OSHW scholarship submission, I ask that you vote for my project to be awarded this $2000 scholarship. The money would allow me to buy the tools needed to work with carbon fiber (vacuum bagging equipment, mold making equipment, and safety gear) and it would allow me to buy the carbon fiber and epoxy I need. I will keep detailed documentation of the process I use to create this trumpet. All of my documentation, drawings, and files will comply with the Open Source Hardware Definition. I aim to share all of my findings and processes with the online community.

I support the Open Source Hardware Definition v1.0

The quadrocopter lives!

I finally have the quadrocopter approaching completion! I have the frame completed out of 3/4″ aluminum square tube and Lexan. Each motor is held on the frame with a clamp mechanism made from Lexan. Each propeller is mounted to it’s motor with a prop saver. The electronics are all mounted and have mostly been all soldered together. Each of the ESCs (electronic speed controllers) is getting power from a circle of 10 gauge wire in the center. The Arduino is mounted in the center on stand-offs. Each speed controller is connected to the Arduino through a custom made connector. The battery (2200mAh 20-25C LiPo) is mounted to the bottom with Velcro. The battery connects to the power distribution system through an XT60 connector. The Arduino will connect to power through the on-board power connector (right now it’s running off of USB power).

Here’s a picture:

Right now I really just have to work on the code to make it run. So far I have code that gets an attitude (angle) measurement from the IMU. I have PID code from another project so I just have to implement that into this project. After that I just have to tune the PID and it’ll be working! The code is really the interesting part of this project. I’ll post an in-depth post on exactly how my code works and how you can change it to make it work for you once its finished. Also, I’ll post all the code, links, design drawings, and anything else that went into building this.

In the meantime, here’s a video of all four motors powering up a bit from computer->Arduino control: http://www.flickr.com/photos/49325300@N07/5698514204/

How to easily access the raw location data on your iPhone or 3G iPad

Some people (namely David Pogue) have been saying that it is quite difficult to get access to this data without lots of knowledge of Linux. This is not true. Here are some simple instructions on how to get access to the raw location data kept track of by Apple. The basic idea of these steps is: Extract your backup with a backup extractor application, then read the location database file with a database browser.

Step one: Back up your iPhone using iTunes. Do not encrypt your backup as that renders it impossible to get access to the contents. If you don’t want people getting access to the contents then encrypt it. But for the purposes of this exercise, don’t encrypt it.

Step two: Get the iPhone backup extractor application. This application simply finds your backups and extracts them into a readable folder. It is available here: http://supercrazyawesome.com/ This app is only for Macs so if you have a PC or if you use linux then you might want to try this one instead: http://www.iphonebackupextractor.com/ I have not tried it so use it at your own risk.

Step three: Extract your backup! Open up the iPhone backup extractor you downloaded, select “Read Backups”, select the most recent backup from the list, and click “Choose”. Scroll down until you find the text “iOS Files”. Select this and click “Extract”. Select a location to extract it into and click “Extract Here”. It will create a new folder so you don’t have to worry about it spitting files everywhere.

Step four: Get a program to read the database file. I’m using a program called SQLite Database Browser. It is available here: http://sourceforge.net/projects/sqlitebrowser/ Another one that is popular is Base (Mac only): http://menial.co.uk/software/base/

Step five: Go to the place where you extracted your backup. You should see a folder called “iOS Files” or something similar. In that folder go into Library>Caches>locationd. In locationd you should see a file called “consolidated.db”. Open this with the database browser you just downloaded.

Step six: In SQLite Database Browser, click on the “Browse Data” tab. Select “CellLocation” from the “Table” pull-down menu. Here you will see all of the location data points. You can double click on any of the cells in the table to get copy and pastable text. You can copy and paste the longitude and latitude data into google maps to see where it is. This data is not especially useful the way it is because of how inaccurate the location data is. For each data point there is also a “HorizontalAccuracy” field which is most likely in meters. Most of them are between 500 and 1000 for me so that shows how inaccurate it is.

But this data is still very useful for someone who wants to know where you’ve been. Put it all on a map and you have a very clear path of where you’ve been. The point of this blog post is not to show how you can see where you’ve been on a map, but rather to show how easy it is to access this data. All of the software used here has been available for a long time so anyone could have had access to this information for months.

This tutorial may not seem incredibly simple for the average consumer, but this is an extremely simple procedure for any programmer with SQL experience (which is most programmers). There are many virus programmers who would love to have access to millions of people’s location information. This information is just sitting on your hard drive so it would be trivial for someone to add this capability to their PC virus. It only took the O’reily researchers a day to create their mapping application. And if you combine this information with your address book and all of your text messages that are also stored in this backup (in iOS Files>Library>SMS>sms.db) then you get a very good representation of someone and what they’ve done.

Quadrocopter Progress

Earlier this year in December I saw a bunch of videos of this new type of RC flying machine called a Quadrocopter. After some research I decided that I could build one for significantly less than the price of a commercial one. I was determined to build one of these. After many many more hours of research I found the code to be the most difficult part because of all the math that I haven’t learned yet. This project is finally starting to come together and I have most of the components needed to build it. This post will document my progress in building my very own quadrocopter.

Here is what I have so far:

I have 4 high power brushless outrunner motors with special Gaui quadrocopter propellers attached. I am using prop savers to attach the props. In the middle I have a 2200mAh 3S LiPo battery and an Arduino with a Sparkfun Razor 6DOF IMU. Also, not pictured, I have 4 18A ESCs to control the motors. The motors, ESCs, and battery + charger cost me about $80 with shipping directly from China. I already had the Arduino, but that normally costs $30. The IMU cost $60, which may seem like a lot, but it should give me an exact position reading of roll, pitch, and yaw.

Here’s a video of me testing one of the motors with a ccw rotation propeller attached: http://www.flickr.com/photos/49325300@N07/5548752629/in/photostream/

These motors are extremely powerful. This single motor was able to lift the heavy vise enough to let it move from vibrations. And that was only at half speed! Just think what four of these will be like at full speed! This will probably be able to lift 5 pounds (made up statistic alert!) extra!

How to change the Mac boot logo WITHOUT 3rd party software (by hand)

This is going to be a short post about how to change your Macintosh boot logo/start logo without using software like BootXChanger. Since this software is open-source, I was able to figure out what it was doing and able to replicate it without using the software at all. Whats the point of this you may ask? Why not just use the software? Well its because I’m curious. And its interesting. And I don’t like using shady software, even if it is open-source. Unless I spend the time to figure out what its doing.

BUT FIRST, a warning: Don’t attempt this unless you know your Mac pretty well. I’m not responsible for anything that happens to your Mac, you, your neighbor, your pet fish, or anything else because of these instructions.

The first step is to find an image you want to replace the standard boot logo with. This image MUST be in PNG (portable network graphics) format. It can be any size, but on some Macs (like mine) it will be squished to fit the square space the old logo was in so I recommend using a square image.

The next step is to put the logo in the place where the OS will find it. But FIRST name the logo “BootLogo.png” without the quotes of course. Then you will need to move this logo into “/System/Library/Core Services/”. It will most likely get mad and say you don’t have permission so just put in your password and it should copy in fine.

The next step is to tell the OS that you want a different logo. That can easily be achieved by going into the folder “/Library/Preferences/SystemConfiguration”. Then go to File>Get Info. At the bottom of this you will need to change the permissions so that you can edit the files in this folder. Click the lock at the bottom and enter your password. Click the plus sign and select your user name. Then in the table, change the permissions so that you have read & write privileges. Then click the lock again to save the changes. Then do the same process of changing the permissions to a file in this folder named “com.apple.Boot.plist”. Now open that file in a text editor. TextEdit will work fine. Now add these lines in between the “<dict>” line and the “<key>Kernel</key>” line:

<key>Boot Logo</key>
<string>\System\Library\CoreServices\BootLogo.png</string>

And before each of these lines add in an indent so that these lines line up with the lines below them. Now save this file (it should work because you changed the permissions but it might complain a little).

That should be all you need! Now restart your computer and it should have the custom boot logo instead of that boring grey logo that Apple wants us all to use.