[Solved] Raspberry Pi Model B P5 Header

Hi guys,

For space reasons I’m using the additional header on an old Pi Model B Rev 2:
http://elinux.org/RPi_Low-level_peripherals#P5_header

I thought I was being really clever in maximising the use of my old board by adding a screen and a shiny new case, but now I realise than Blynk can’t write to anything above GPIO27 (P5 uses GPIO28-31).

Can I create some sort of re-route through a Virtual pin instead? If not, can these be added in?

As I am still learning how to use my own Model B Rev 2 (with stock headers) I will not be able to provide programming help (on the RPi). But I can confirm that it is unlikely Blynk will add more direct pin access.

That said, it would be completely unnecessary, thanks to virtual pins. Think of them as variables for hardware (pressing button using virtual pin Vx activates program function Vx which activates/deactivates as many physical pins as needed).

Convert your sketch to use virtual pins between app and sketch, and program the sketch to access all of the hardware pins that you have/need.

Here is an example code the @Costas gave me… it shows virtual pins being used to display data on app and use button to toggle a relay on a GPIO.

This is of course providing that you are using the NODE method of Blynk connection… if you are using wiringPI, then that uses a different type of code, that I am even less familiar with (i.e… have no examples to learn from).

var Blynk = require('blynk-library');
var AUTH = '9ae42d15xxxxxxxxxxda5832f1';
var blynk = new Blynk.Blynk(AUTH, options = {
 connector : new Blynk.TcpClient()
});
var v1 = new blynk.VirtualPin(1);  // Button widget
var v9 = new blynk.VirtualPin(9);  // Display widget
v1.on('write', function(param) {
 console.log('V1:', param[0]);
});
v9.on('read', function() {
 v9.write(new Date().getSeconds());  // sends out seconds count to display widget
});
var Gpio = require('/usr/local/lib/node_modules/onoff').Gpio,
  relay = new Gpio(23, 'out');  // Pi BCM # 23

var v2 = new blynk.VirtualPin(2);  // virtual pin to control GPIO 23

v2.on('write', function() {
        if(relay.readSync() == 0) {  // toggle gpio 23 from high to low
                relay.writeSync(1);
        }
        else {
                relay.writeSync(0);
        }
});

@Gunner maybe @Jason is already using all the pins on the regular header?

As I understood it, he is! But switching to virtual pins is generally still the way to go for many applications (preaching to the pastor here :stuck_out_tongue: )

OK, so he doesn’t HAVE to convert his existing GPIO allocations :smiley: … but he will need virtual pins to use the added pins. I don’t think switching RPi types in the app would suffice (and probably screw up existing pin arrangements anyhow).

Correct on all counts, the whole header is used by the PiTFT board and while it provides a supplementary header to utilise the unused pins there is very little space between the two boards to fit any wires so I’d need an IDC cable and a breadboard, too messy!

In any case that’s exactly the answer I was hoping for, I’m quite new to Blynk as well so I appreciate the help from others in the community.

For some context, this is to trigger a relay (Powerswitch Tail) that is already automated by a python script but I want a simple on/off button widget on my phone as well.

@Gunner worked a treat, thanks for the code!