Welcome to Raspberry Pi

This blog page is being created by the students of Swansea ITeC as part of a project funded by the RSC Wales Technology for Learning Small Grants Programme. We are working as a team to create a blog about Raspberry Pi. This blog post will have more information in the short future 🙂

Cobbler Kit

Raspberry Pi Cobbler kit

In order to allow the Raspberry pi to be used for circuit protyping without risks of shorts or bent pins we had to solder the cobbler kit together.

The tools I used for this task were a 12W/ 230V soldering Iron with a stand & damp sponge.
The Pi header kit came in numerous parts (http://www.amazon.co.uk/Adafruit-Cobbler-Breakout-Kit-Raspberry/dp/B0093K6QQ0) and I had to solder them together so we were able to connect to a breadboard.
To do this I had set up a workstation in a well lit and well ventilated area at one of the work benches as it is not recommened to solder whilst sitting incase you drop hot solder/ the iron on your lap.
To allow a clean connection it is important that the solder connecting the pins to the board do not touch each other, only touching the small copper area located around each hole. It is crucial to allow the solder to melt before you attempt to place it on the board to avoid mess.
After I had done I gave the kit a visual inspection to ensure that the solder was shiny and not touching anything it shouldnt be. I also got a second opinion from my tutor.
To record my information I took a before and after shot of the cobbler kit.
The kit was soldered for IteC as project for trainers.

Product spefications:
26 Pin Ribbon Cable, Custom PCB, Ribbon Cable Socket and Header Pins.

The majority of my work was spent with the other members of the group as we continued to prep for an upcoming exam until I broke off to the workstation to begin soldering, I had more experience in this area.






Flashing the onboard LED

Ever since going to the TechnoTeach in the Village where someone mentioned you could flash the onboard Status LED from the commandline I wanted to have a go.  Instant hardware hacking without waiting for ‘bits’ to arrive.

There’s some guidelines here (ignore the first answer which says ‘not possible’ Those Who Can appear later in the thread.  The gist is that it, by default shows the activity on the SD card, but you can override that and control it from GPIO pin 16.

echo none >/sys/class/leds/led0/trigger to turn off the default behaviour
echo mmc0 /sys/class/leds/led0/trigger to turn it back on (although I haven't tested that yet!)

Once that’s done you can control it from the commandline using the following commands

echo 1 >/sys/class/leds/led0/brightness will turn the LED on
echo 0 /sys/class/leds/led0/brightness will turn it off.

Or to flash it the following module and command will work:

modprobe ledtrig_heartbeat
echo heartbeat >/sys/class/leds/led0/trigger

Having got that working to my immense amusement it was time to look at incorporating this into a program.

Python was what most of the examples were written in – something I’d never used.  Happily the Raspberry Pi Users Guide was at hand (in Kindle form floating round the classroom on a couple of tablets) and that plus the sample code here was enough to get started.

Initial hurdle was to meddle withe GPIO you need to be running as root and the IDLE ‘Run module’ command doesn’t by default.  Relaunching the editor from commandline with sudo sorted that bit.

I fiddled with the sample code to try out timing then started wondering about more uses.  Flashing a Morse code seemed the obvious thing to try and since I only know two (BCN or STU for the Brecon and Strumble VORs!) I decided to try and make it flash the code for Brecon.

Things I instantly didn’t know…

How to write to the screen in Python (easy and guessable – print “Whatever”)

The timings for Morse (how much longer than a dot a dash is, how much space is between letters etc. (Wikipedia to the rescue there)

Things that worked well

It worked!  and I tweaked it a bit to put some info on the screen as well.

I needed to comment the code heavily to not loose track of which letter I was on.

Stuff to improve /add

More realistic timing.  It’s vvveerrryyy veeerryyy slow at the moment 1 second per dit.

Variables for the lengths of the ons and offs.  At the moment I’ve coded each characters individually.  Very inefficient!

More than one station!

Free text conversion into Morse sequences.

Find out if I can run those commandline setup and close down bits to make the LED accessible from within the program itself.

Code below (I learned about the WordPress shortcode wrapper for posting code without mangling it too!

Continue Reading