Twitter

Thursday, 2 June 2016

Networking to a Raspberry Pi Zero (camera enabled) WITHOUT a linux machine - hahahaha!!!!

So... After I posted Tuesday's update, I got a phonecall. One of those phonecalls that you get after 9pm. From your Dad. Who knows everything there is to know about coding. Oh god. He left a voicemail. "Let's talk -- tonight or tomorrow. Whichever's easier". Of course it was blog-post related as I'd just sent him a link, but I had a horrible sinking feeling that there was some dangerous error in my plan. Oh god.

So I called back. That night. Dad is wonderfully supportive, and he's been that way since I can remember, but there is something about having put something out into the world that your dad happens to be a massive, genius-expert in, when you've hashed together an idea from no experience at all, that is a little...disquieting.

The first thing he said was this:

I think you're absolutely on the right track.

That was like hearing that last bit of the 1812 Symphony where everyone starts bounding about and the cannons kick off. But with beginner's hackery. Whatever he said next could not deflate the Alex balloon of joy.

Then he said:

I think we can simplify things.

From a man who appears to make code and hardware do WHATEVER HE WANTS, this is a very exciting suggestion. But as well as explaining this, he also explained how I'd made an easy-to-make assumption that was going to scupper me wildly. I'm going to try and explain what that was in a bit.

BUT FIRST...

My original plan was this:

Connect my Raspberry Pi B to my laptop and get it up and running and online. So I'd need a wifi dongle.

Format my microSD card using the Raspberry Pi B (I'd need another SD card as the memory for my Pi B if I was to use my microSD for my Zero. I'd also need an SD card reader to attach to my Pi B - problem: would at this point be short of a USB drive as I'd forgotten that I'd need a laptop connected to actually do the coding - giant error here, but keep reading. I promise I'll explain later).

Insert the newly formatted, internet-ready SD card into the Zero.

Get the Zero up-and-running and onto the internet, connecting via my laptop and via PuTTY to control it headlessly. Ta daaah!

So yes. The error. To connect to the Pi B, I needed a laptop. But to program the Pi B, I needed my laptop.. I was planning on networking my laptop...to itself essentially. I had TOTALLY forgotten that I was going to need a monitor, mouse and keyboard. Fortunately I can use the tv as the monitor and have the other two, so woo :)

The fix:

After all that, and explaining that I was going to need more peripherals, Dad made this suggestion: cut out the middleman. Ditch the Pi B - I had missed a trick - My microSD comes joyfully pre-loaded with NOOBS (RaspberryPi's own 'new out of the box software) thanks to the lovely people at Pimoroni from where I purchased my starter kit -- NO FORMATTING NECESSARY. Get a multi-port USB hub and use it to connect the peripherals and the dongle. Get the Zero onto the net that way, then proceed to locate it and control it via PuTTY as before.

SO. MUCH. EASIER.

I've bought a 3-way hub with ethernet access from Pimoroni. It's their recommended hub for the Zero and it's white like the other bits that are going to be hanging off my little Zero, which for a sense of continuity, I quite like.

Hoping to take delivery of all the new kit today. If not then it'll be tomorrow. So excited - I can actually see how it's all going to happen now.

Thanks, Dad - to you and the rest of the lovely people reading I ask, as always:

Wish me luck!

Tuesday, 31 May 2016

Raspberry Pi camera project - day 1 - brb - I need to go find a yak to shave.

Hello, World.

This awesome cartoon by the ever-beloved XKCD sums up how I'm worried this week is going to go for my shiny little Raspberry Pi Zero and the security camera project I've earmarked it for.

Have you ever heard the phrase 'yak-shave'? It's very much a Dad-ism for me - Dad introduced the term to me when it was still in relatively new usage, and still uses it today. This is a reasonably simple explanation of what I mean by yak-shave:

"An activity which, in an of itself, seems pointless, but is needed as part of a chain of similarly pointless activities to solve the real issue that cannot be fixed until the pointless activities are accomplished".

I was going to find a quote to explain it on a popular, informal online dictionary famous for having colloquialisms aplenty explained, not always politely. I chose not to link there as I do not wish to be held responsible for what else you might read.

Instead, here is Seth Godin's very pleasing explanation of how the term came to be. It's well-written, and has the added benefit that while I tend to overembellish when I tell my version to the detriment fo the story, he does not. So you've dodged a mind-bullet there (tiny yak-related reference to Tenacious D's 'Wonderboy'). You also get to avoid the impolite colloquialism depot mentioned above. So points all round to Mr. Godin.

So my concern is this: I've got to get Motion (a motion sensing software that's hackable for Raspberry Pi) onto my Raspberry Pi zero. Which is fine. Except that the Pi Zero doesn't come as internet accessible. So I'm going to need to make it internet accessible. This, too, presents a problem. Its micro-USB port is going to be used up by my connecting the Pi Zero to my laptop to parasitise its keyboard and monitor. So I can't get a dongle in that way.

The most reasonable-sounding solution I've been able to find so far is this one, from David Maitland, who suggests that I SSH (Secure Socket Shell - or remotely access) the pi zero from another linux machine. I don't have another linux machine available immediately, but I do have a very old Raspberry Pi which I could get up and running.

My thinking is, I'm best off getting the original Pi (model B) going (so I'll need another SD card). I'll use that to format my Pi Zero's Micro SD Card (so I'll need an SD card reader) so that it can be accessed via home WiFi (to get it there, I'll of course need a WiFi dongle). After that, I'll be installing PuTTY on my Windows machine so that I can use it to SSH to my Pi Zero directly.

Gosh. To a total newbie, this is all a bit daunting, but I'm slightly heartened by the fact that once again, the Raspberry Pi community has made the inaccessible accessible. I can organise the above into a series of small-ish, achievable goals. Let's see if they work out. Do feel free to get in touch if you can see me making an egregious error in the above and would like to rescue me from disaster.

As always, wish me luck!

Sunday, 22 May 2016

Learning to code with games

Disaster has struck - my Raspberry Pi Zero arrived while I was out, and thanks to the unexpectedly summery British Saturday, nobody was in to take delivery, not even the neighbours, so it's now whiling away its weekend in the local sorting office - what with it being Clerkenwell Design Week, with a number of engagements scheduled in the evenings, it looks like I'm not going to be able to start building until next weekend.

I decided not to be too downhearted about it, though. I've had an interesting afternoon instead. While I'm keen to dive right in and get some pre-existing code that I plan to retroactively analyse installed on my pi zero, I figured that I could really use a bit of a refresher in programming.

The big problem I had was that, without any immediate problems (save the fact that the sorting office doesn't open on Sundays, which isn't fixable with code to the best of my knowledge), and without much hardware about the place, I didn't really have a specific coding goal in mind.

Then I thought of Scratch - MIT's programming platform for kids. I haven't played with Scratch for years, but I had a go and sort of enjoyed it, but realised that once again, I didn't have a specific goal in mind, so didn't accomplish much other than fooling around with a few commands (I made a cat do a silly dance).

I then wondered if there are any games that teach coding in order to accomplish gameplay. The two I came across were:
https://codecombat.com/ (Code Combat) and https://code.org/mc (Hour of Code - Minecraft edition)

Firstly, while both aimed at kids, they're definitely games I enjoyed playing. But one thing stood out: I could very easily construct my Hour of Code by dragging and dropping tiles to build JavaScript without ever really understanding what I was doing. CodeCombat was a little better from that perspective: it gave instructions about what different commands were for, but it didn't go into much detail about why they worked.

This is something I'd like to see more of in any 'learn to code' environment. It flies in the face of the way I've planned to build my PiCam, and that has led me to want to review the code before I even get my hands on the machine itself. I'm hoping to be able, with a great deal of help, to be able to begin to understand the code that's going to make my PiCam work. Once again, it's diving in headfirst, but this little afternoon of exploration has got me to a really interesting place: I'm starting to realise the type of questions I'm going to need to be able to ask to get better at this fast.

That, to me, has always been the sign that I'm on the right track.

Wish me luck.

Tuesday, 17 May 2016

Mmmmmm.... Pi.... or, selecting my microcomputer

Hello, World

Today I am continuing to march towards coding glory - to be able to solve an actual, real-world problem with a micro-computer and some peripherals. Or so goes the plan.

I'm over the rosy-glow of idealised problem-fixing with tech today - it's all about actually beginning to solve the issue, which means some genuine weighing up of possibilities. Less fun than Knight-In-Shining-Armouring, but necessary. The big decision I made today was this: what's going to actually do the 'thinking' behind the camera?

I knew right away that I was going to want to use a Raspberry Pi, which is a very small computer (the original was about the same size as a credit card) that runs on Linux and is easily powerful enough for this project. It's been designed for novices (school kids, in fact) and so is easy to program with more than one language, and has heaps and heaps of pre-written code, projects and trouble-shooting hints shared by very smart people who want to make the world a better place.

So what's the issue? Sounds like my mind is made up, right? The problem was initially, which Raspberry Pi to use - there's the original Pi, the Pi 2, the Pi 3 and the Pi Zero (about half the size of the others and released shortly before the Pi 3). In the end, the decision was made for me - yesterday, the latest iteration of the Raspberry Pi Zero was released. It's just as powerful as its predecessor, but somehow, due to some clever reorganisation by its creators, it's grown a camera port. Sold.

As this is a very new version, it hasn't got its own camera yet, so I've picked up a Raspberry Pi-designed camera called the Noir - perfect for my project because it lacks an Infra-red filter and so is much better for getting shots in low light (perfect for a murky hallway). I've also had to get it an adaptor cable, but if I'm honest, the extra length of cable should give me some manoeuvrability when it comes to installing my little project in its new home.

So far, it's been pretty easy to find out what I want to know. In true philosophical style, though, the process of learning a little is showing me just the very top reaches of the vast, gaping chasms of my own ignorance on and around this subject. Somehow, though, I don't feel intimidated.

The communities who share their own codes, schematics and ideas online really do make it feel incredibly accessible, and on any forum, there is always someone who knows just as little as you do, who has their questions patiently answered by microcomputing whizzkids from around the world.

As a first dabble into doing a project like this for myself, without watching over someone else's shoulder, I can honestly say I'm really looking forward to getting started. I know that there's a whole community of people out there who honestly seem to want to see me succeed.


Monday, 16 May 2016

Why Coding and Dinosaurs?

Hello, World.

I've decided that I want to get better at coding. I have a little experience in making pretty lights blink on the Arduino, and can make a nightmarishly early 00's looking webpage in HTML if I have to, but really can't do more than that. 

I want to get better at coding because I want to expand my horizons, and solve a few small everyday problems of my own while I'm at it. I'm also acutely aware that as a loud and proud advocate of #WomenInSTEM and #GirlsWhoCode, it's high time I got more involved. 

Against popular recommendation, I will be doing everything in my power to run before I can walk. Historically, I've found that diving in on a higher level project with a huge amount of support available works for me: I love the challenge, and if it doesn't work out, at least I had a go at doing something ridiculous. If it does work, once completed I can go back over it and make sense of what I've done. Plus it makes a hell of an origin story. 

That's why I'm planning on diving in headfirst with a practical Pi project. I want to help a friend construct a low- cost security camera. That will be project #1. My blinky-lights equivalent  (not that there's anything wrong with blinky lights - the massive LED in the Arduino experimenters kit is the best blinky light ever).

I'll be reviewing the process - how easy it is for a moderately practical but easily distracted human being to create a fairly tricky-sounding project with pre-existing code. I'll then try to understand the code and ideally adapt it to my friend's needs. 

So that's why coding, but why dinosaurs? Just as I know a little about coding, I know a lot about dinosaurs, but I haven't worked in prehistoric public engagement for a while and have got out of touch with the latest discoveries. So I'll be sharing some of those, too. Who doesn't love dinosaurs?

So there you go. Coding and Dinosaurs, explained.

Wish me luck.