Sunday, 29 June 2014

Raspberry Pi GPIO:101

My brother always gives me interesting presents. He's got a head start as we both like and do similar stuff.

One of these was a Raspberry Pi T-cobbler kit, which is essentially a way to extend the GPIO connector outside of a case and  plug it into a breadboard for prototyping.

Wiring up simple inputs and outputs to microcontrollers is bread and butter for my projects but I've never actually done this with a Pi. So this morning I pulled the T-cobbler out, soldered it up and did a bit of messing around.

I'm finishing up a project which has a Pi embedded at the moment. It uses a slave Arduino Nano to do most of its interface to the real world and it's going to be properly embedded with the expectation you don't normally have a screen, keyboard or network available.

So despite the presence of the Arduino I want to be able to have some basic control and feedback from the Pi that doesn't rely on anything else working. The python script on the Pi that does the heavy lifting occasionally crashes and while I'm making it more stable some of it is just V4L being  flaky rather than anything I can actually fix in my code. At least that's my excuse.

So I want the following directly linked to the Pi.

  • Shutdown button so it can be cleanly shut down rather than just yanking the power. No good will come of that eventually. For this I need GPIO really and I'll probably do it like this.
  • Status light that shows the state of the main script, again more GPIO.
  • One or two buttons to change the state/behaviour of the main script
  • Reset button. Easy, just connect a switch to short jumper P6.

What I've done this morning is connect three buttons and an RGB LED to the GPIO. Pushing each button lights up one of the colours of the LED using a simple Python script.

This is easy peasy stuff that anybody could do with a little looking on Google but it's on these foundations that you can build something that actually 'does stuff'.

I took my medical scanner prop to a UKLTA lasertag game yesterday and people cooed over it again. Given the 'cottage industry' the UKLTA has going building guns for the hobby I'm surprised there aren't more things like it floating around. Some of the people there are far more capable at building things than I am. There seem to be a lot of people around who think this stuff is voodoo when if they set their mind to it could actually turn out some really cool stuff.

No comments:

Post a Comment