Uatu and Grace and figuring out the Raspberry Pi

Uatu and Grace and figuring out the Raspberry Pi

There tend to be 2 ways I work on projects where there’s a ton of learning involved:

  1. Total immersion & obsessive tinkering
  2. Think it partway through, then walk away and focus my conscious mind on anything else, while my subconscious takes over and gets ideas

With the Rube Goldbot project, I’ve been using both of those strategies. Hodor, the brawn, was mostly the first strategy. Constant tinkering with electronic components and the Arduino etc., and I have him more or less working (or at least have proven that I’m on the right track with getting him working).

Uatu (the eyes) and Grace (the brain) are a bit trickier, so I’ve been taking more of the second approach. My initial plans were to use Uatu and Grace as opportunities to learn more about the Rapberry Pi and also to pick up some familiarity with both Haskell and Lisp so that I would have exposure to “functional” languages. After thinking about it a bit more, I’m not entirely sure that’s the best idea.

Yes, I will still use at least one Raspberry Pi for them – I got a CanaKit Raspberry Pi 3 and a nifty camera for the Pi, and given the vastly larger capacity of the Pi vs. the Arduino it makes sense to use the Pi to house the “smarter” aspects of Rube. This morning I took the first steps at getting the Pi together (namely plugging in the camera and putting everything in a case – it’s a lazy Saturday morning and I’m saving actually using the Pi for later) and reading up a bit on how to install various languages etc.

But no, I will not be using Haskell or Lisp for either of them – I’m going to go with one language, Racket. In part I like the name, in part I can extend it with the FFI (Foreign Function Interface) and consume some pretty good QR Code processing tools, and in part because learning one new language for both tasks should allow me to learn more about functional programming without having to deal with the confusion of multiple different syntaxes.

So! My goals for today are pretty simple:

  1. Get my Pi physically set up/in it’s case/camera attached
  2. Get my Pi OS installed (going with Raspbian)
  3. Get my Pi configured to use my network and so on
  4. Get Racket installed and do some “Hello, World!” type stuff in it

Get my Pi physically set up
This part was pretty simple – there’s a board, there’s a plastic case as part of my kit and there are heat sinks in the kit. Kind of only one way to get this done, so boom, board in case! Now to install the camera… Oh, shit, right, case makes it a little tricky to install the camera. Pop the Pi out of the case, attach the camera, boom, case is working on correctly! The CanaKit case also has a little dealy on the top that allows me to jack the camera into it for stability, so I did that, too. Easy.

Get Raspbian installed
This was a bit more tricky – the instructions with the kit said I needed to install something called NOOBS onto the microsd card that came with the kit, and to do that I had to download and format the card. Problem is, there seems to be an issue with OS X El Capitan that makes it think the card is read only. I didn’t realize this was an OS X issue, so I emailed Cana (on a Saturday!) and they got back in a couple of hours and told me what the deal was and that I could actually just plug the card into my Pi because it already had NOOBS installed.

So I plugged the card into my Pi, connected the HDMI on the Pi to my TV, plugged in a mouse and keyboard and… SUCCESS! Easy set up screen to pick Raspbian and then it took maybe 10 minutes to install. To me, this was sorcery; I’d tried using Linux back in 2001 or so, and it was an absolute nightmare to get things up and running. I tried going with Linux again in 2010, and once more it was just annoying as hell to get things set up, had video card and networking problems, and blah blah blah. I had been halfway expecting everything to fail, but it worked easily.

Configure the Pi to get on the network etc.
This part¬†was also rather easy – there’s a GUI, it’s got a little network icon in the upper right corner, so I hit that and jackpot, it sees my wifi. Logged in and then opened the browser and went to YouTube and watched the Star Wars: Rogue Squadron trailer – sound worked! Video worked! Everything just… worked.

Next up was checking to make sure the cam worked. Enabled the camera in settings, then went to a terminal window and used raspi – that worked too. Took a few short videos, a couple of stills, and all’s awesome.

Next step was setting up VNC. I installed TightVNC onto the Pi, but I couldn’t seem to connect to it via any VNC client on OS X, so said hell with it and will settle for SSH. I don’t need a GUI, it’s just that I’m used to one. SSH was simple – changed the password from the default and then logged in from my Mac. Great success!

Install Racket and do Hello, World stuff
So far, so good. SSH in to the pi, apt-get install racket and… Dammit. Right. SUDO apt-get install racket and it works. Need to set up an alias for “shit” that just re-runs the previous command but with sudo prepended. Racket took a good 5-10 minutes to get installed and configured, and I thought maybe it had frozen, but nope, it was chugging along.

After installation, I started up the interactive interpreter by typing “racket” and I’m at the prompt. I futzed around for a few minutes having it echo strings, find substrings, and very basic stuff. Then I was ready to be done and typed “exit” – no luck. “quit” – no luck. Hmmm…. ctrl+c? Ctrl+x? Nope. Finally realized “exit” is a command or function so typed “(exit)” and lo, it worked.

Overall, I expected this whole process to be much more difficult than it actually was. The next steps are going to be getting Uatu up and running Рthat part should be pretty straightforward, I hope. Keep the camera running and then when it detects a QR code, decode it and send that to Grace, who will probably just act like a pass-through to Hodor who will light up if Grace got an event.

Leave a Reply

Your email address will not be published. Required fields are marked *