Controlling remote with pnp for openhab

I have a ventilation system in the house, which came with a RF remote:

I wanted to be able to control my ventilation system from anywhere in the house, and had some pnp transistors which I thought would be nice to use as a switch and replace the buttons.

First starrt off with a detailed sketch of your work 😉

Its a pretty basic setup

– connected to collector
+ connected to emitter
Base connected with 10k resistor to a gpio pin.

When the pin is high, the pnp transistor will be closed, when it is low the pnp transistor will pass current from the emitter to the collector.

I opened up the remote and desoldered the coincell holder & the first button and replaced them with wires to create a test setup:

Red & Orange are the power + & – sorry, no black wire left for gnd 🙁

The blue a d yellow wire replace the buttons – & +

To simulate a buttonpress I just pull the gpio pin low for 500ms and return it back high:

Test code, to see if my buttons work:

void setup() {

  //Setup my 3 pins for the buttons
  pinMode(16, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, OUTPUT);

void loop() {

  //This code is used to debug, you can toggle your switch through serial (
  if ( == "1")
      Serial.println("set to 1");
  if( == "2"){ 
      Serial.println("set to 2");
  if( == "3"){ 
      Serial.println("set to 3");



Testing it with my whisper node, and it worked!

I decided to put the pnps on a seperate pcb and connecting it to the remote and my raspberry pi.

More on using gpios and setting it up with openHAB in my next post.
After this I decided I will also make an esp8266 & AM2302 (wired DHT22) sensor, which will send humidity data to openHAB via MQTT. This way openHAB will be able to switch my ventilation system automatically when the shower is running, and the humidity is rising. 🙂

Leave a Reply

Your email address will not be published.