Tag Archives: Raspberry Pi

Home Server

I’m not quite sure why, but the Raspberry Pi has always seemed neat to me. If you’ve ever even looked at trying to build up a small piece of hardware out of components, the price quickly scales to something higher than anticipated and almost high enough to warrant just purchasing a pre-made item. To have the Pi (almost) ready to go for around 40$ is pretty awesome – I think the Model A started at 25$? Of course everything adds up if you don’t have a keyboard/mouse/wifi adapter/monitor/power adapter etc, but luckily I have everything lying around. It’s an extremely cool platform to play with. I think a contributing factor for me is the seemingly transient nature of the PI’s software. It doesn’t have to be that way, but it’s trivial to change the SD card and have a completely different environment running on the same software. Want a LAMP server? Pop in an SD card. Dedicated RaspBMC? Swap it out. Nothing has to collide, it’s easy to image the SD cards so you can save the state of anything you’ve done. It just seems a lot more forgiving than a traditional computer. I imagine it’s just because I don’t have an intimate knowledge of most of the stuff I’m trying to do, I screw up often and catastrophically, so being able to segregate “experiments” so the successful ones can live on is a big deal.

To that end, in my spare time – there’s not a lot, so it’s going slowly – I’ve been working towards getting some kind of situation set up where I can have a server running off the Pi at my house, and then I can… do stuff with it. That’s about as fleshed out as it is right now. I’d like to use it as a resource for developing some apps I’ve been thinking about, and almost immediately when considering a dynamic app there needs to be some kind of server backing it. Earlier I had a LAMP server running on the Pi, but I kind of hate PHP. I had only a very limited exposure to it, but it really didn’t strike a chord with me. My first programming language was in high school – Turing, and that was a decent introduction. Actually, that’s not true. My FIRST first language was Forth, I had an introduction book from my father when I was young, but I never really did anything impressive with Forth, so I don’t really count it. My next language was C, which I found fascinating because of the raw (very raw) power you could wield. After that came C++, then briefly all of the languages in school – Python, Ruby, Scheme, SQL, etc, and then finally Java. With each and every one of them I had a moment of “well, this language has contributed to my greater understanding of software design and programming possibilities”. I feel like each one helped me grow technically but also creatively, as it broadened my problem solving palate. I didn’t get that with PHP. Maybe I need to give it another chance. I won’t.

Through work I had some exposure to Spring IO framework, and have found it extremely interesting. I’m a little intimidated by it though, there seems to be a massive amount to learn. Starting off with one of the sample projects goes a long way; they make it very easy to get something working so you can change bit by bit until it suits your purposes. The one big thing that kind of throws me is the extensive use of annotations. That’s something I’ve only used in passing before, and while it seems very powerful it also seems to hide a lot of functionality. As someone who doesn’t know what they’re doing, a single annotated line wiring together a massive amount of functionality is a bit frightening.

All that to say: following the Spring tutorial for creating a REST service I was able to get it running on my computer. Not only that, but using their Gradle tutorial I was able to get a very basic introduction to Gradle, which also seems extremely impressive. It doesn’t hurt that Android Studio uses Gradle (leaving behind the ADT bundle of Eclipse and Ant), so the knowledge would certainly help. Referencing the Consuming a REST Service with Android tutorial, in a couple hours I was able to build a Java server using a text editor (Sublime), do the same thing but using the Spring Tool Suite, and build an Android application that could interact with the server. The Spring documentation is pretty outstanding. Kudos to them. The next step will be to get the running on a Pi, then I suppose after that I can figure out what I can actually do with it…

A little MOOC with my Pi

Amidst a relatively large number of more spammy seeming emails, Oracle sent me one pertaining to a Massive Open Online Course (MOOC) that they were repeating: Develop Java Embedded Applications Using a Raspberry Pi. Apparently there had been an overwhelming response to it the first time around. My source for this is the Oracle site Based on the overwhelming response for the Java Embedded MOOC currently underway – we are offering the course again.”

Regardless, it seems right up my alley with respect to the other things I have going on in my life, so I figured I’d give it a shot. It also happens to be an excellent continuation for Cailyn as she had just started learning Java and was exploring the world of Arduino before we moved. She was working on a wireless temperature sensor, but that was pretty successfully interrupted by our huge life change. This seemed to both of us like an awesome way to get back on track.

They had one big kit of everything you needed for the course, fulfilled by Adafruit, which seemed pretty handy. You are able to buy the hardware kit bundled with a Raspberry Pi Model B, or without if you already own one. Cailyn and I both opted to get the pack with a Raspberry Pi, which leaves my first one open to the other half-baked side projects I’ve been trying with it. Unfortunately up until yesterday the expected wait time for either the pack was on the order of 15 – 30 business days, which is essentially unavailable. Yesterday I got a notification that they were available, and over the course of about 12 hours the stock dwindled to the same 15 – 30 business day availability. We went and found all of the components online and pieced it together ourselves, and the price ended up being similar, but not ideal. We paid more because nobody sells a single capacitor of exactly the type we need with no shipping charge, but it ended up in an acceptable ballpark.

EmbeddedJavaMOOC3

We bought most of it from Adafruit anyways, and that showed up promptly. A couple more stragglers were purchased from elsewhere, or shipped to Ogdensburg (we order quite a bit there). Here’s a view of everything we’ve gotten so far (plus the bonus breadboard that Adafruit shipped as a gift in the top left corner.

EmbeddedJavaMOOC2

Bill of materials

Sub-Total: $300.70
Sales Tax: $0.00
United Parcel Service (1 pkg x 4.74 lbs total – EXPRESS SAVER): $33.25

Total: $333.95

There was also some COD, but I have no idea how much that was yet. We’re waiting on a couple more pieces.

We got the BMP180 modules from ebay, because they were out of stock on Adafruit, which came out to $28.04 taxes and shippping in for the two of them. Ended up buying them from the UK, apparently as of ~4 months ago there was a global shortage of the sensors or something of that nature, so they were a little difficult to come across. It appears to be the same sensor that SparkFun stocks, but we’ll see when they get here. 

The last couple pieces we ended up buying through Amazon, and this is where we got more than we needed.

So all told we purchased ~422.74$ worth of stuff for the two of us after taxes and shipping. Had we been able to purchase the packs through Adafruit it would have been 2 * 149.95 + ~40$ shipping, or around 340$. A difference of around 80$, or 40$ each, is significantly more expensive, but our options were limited. You can’t really buy a single capacitor and expect it to be economical, but that only explains about 1/3 of the cost. In the end the rest of the difference comes from not being able to get it all in one place. It really makes sense to get tiny hardware bits all from the same source because even if the item is only a couple dollars the shipping adds up fast. All in all, not ideal, but we’re both super excited to be able to participate in this course and have the equipment. The only thing we’re still waiting on right now is the BMP180 modules, so I’m hoping they come soon…