PiFace for Raspberry Pi and Ruby

I installed the PiFace daughterboard on the Raspberry Pi and then installed WiringPi to make it easier to access

WiringPi comes with a separate program to help manage the on-board GPIO interface as well as additional modules such as the PiFace and other devices like the Gertboard as well as generic GPIO expander type devices.

This program, called gpio, can also be used in scripts to manipulate the GPIO pins – set outputs and read inputs. It’s even possible to write entire programs just using the gpio command in a shell-script, although it’s not terribly efficient doing it that way… Another way to call it is using the system() function in C/C++ or it’s equivalent in other programming languages.

[From The GPIO utility | Wiring Pi]

If I now issue the command “gpio -p write 200 1” LED 0 on the board tuns on – and “gpio -p write 200 0” turns the same LED off.

All good so far.

Then I installed the “wiring” gem – but it seems (as of todays date) to not work with the PiFace board (does not allow use of any of the pin numbers associated with the board), so I ended of with a very short ruby script to test access :

require ‘shell/executer.rb’

puts “Starting…”

Shell.execute(‘gpio -p write 200 1 ‘).success?

puts “Sleeping”

sleep 10

Shell.execute(‘gpio -p write 200 0 ‘).success?

I did install the gem “shell_executer” first of course…And it works.
Fairly cumbersome for reading dynamic events of course – but that’s next step.

The Internet of nagging things

I got this email from my scales this morning :


Hi tor,

Your Aria battery level is low. Replace your batteries as soon as possible.

Your Aria scale is powered by 4 standard 1.5V AA batteries. This type of battery can be found wherever batteries are sold.

To replace the batteries in your Aria:

1. Turn the scale over and remove the battery door
2. Replace the batteries following the indicators in the battery compartment
3. Replace the battery door

Your Aria scale’s batteries should last approximately 6 months under normal use.

Happy stepping!

Apple’s Objective-C to Javascript Bridge

Hm! Interesting article

Nigel Brooke    |    May 14, 2013

A few month back, Apple quietly slipped a very nice Objective-C to Javascript bridge into WebKit. Since the first commit while we were busy celebrating New Year’s Eve, it has been fairly actively developed and improved. This new API supports straightforward embedding of the JavaScriptCore interpreter into native Objective-C projects, including reading and writing variables and object members with appropriate type coercion, calling methods on JavaScript objects, and directly binding Objective-C objects into JavaScript.

[From Steamclock Software – Apple’s new Objective-C to Javascript Bridge]

Wiring Pi === Arduino

Hm! How to use some of your Arduino software on a Raspberry Pi

WiringPi is a GPIO library written in C for the BCM2835 used in the Raspberry Pi. It’s released under the GNU LGPLv3 license which is usable from C and C++ and many other languages with suitable wrappers (See below)

You may be familiar with the Arduino… Briefly; Arduino is really two things; one is a hardware platform, the other software, and part of the software is a package called Wiring. Wiring is the core of the input and output for the Arduino, so I thought it would be good to replicate that functionality (or a good usable subset with Raspberry Pi extensions) on the Raspberry Pi.

The Raspberry Pi has a 26-pin General Purpose Input/Output (GPIO) connector and this carries a set of signals and buses. There are 8 general purpose digital I/O pins – these can be programmed as either digital outputs or inputs. One of these pins can be designated for PWM output too. Additionally there is a 2-wire I2C interface and a 4-wire SPI interface (with a 2nd select line, making it 5 pins in total) and the serial UART with a further 2 pins.

[From About | Wiring Pi]

Oslo’s So Good at Recycling that It’s Run Out of Trash

Interesting – especially the part of importing trash from the UK. And btw. – I refuse to believe that Oslo now has 1.4 mill pages – it used to be 600.000.

Oslo’s So Good at Recycling that It’s Run Out of Trash
Norway’s capital city has a serious waste management issue—they’re way too good at it. Half of Oslo’s 1.4 million residents rely on a steady stream of refuse to power their appliances and heat their homes. Problem is, there just isn’t enough trash to go around.

[From Oslo’s So Good at Recycling that It’s Run Out of Trash]