Hi there, I'm hoping someone can tell me if I set this up correctly, things seem to work with my arduino, but when I switch over to a raspberry it doesn't work anymore, so I'm thinking maybe I looked over something in the pcb part, and someone can give me a hint.
I have a remote that controls our fan system in the house, it looks like this:
I want to be able to use it from my mobile phone with openhab2.
Once I opened the remote, I had the idea to replace the buttons with PNP transistors, as you can see I replaced one button with some wire, to test it out on a breadboard:
and sure enough, when I pull the base low (putting the resistor in -) for a second, and then leave it floating, the button is triggered, and the fan starts running.
So far so good
After this small triumph, I desoldered 3 of the buttons and soldered a small pcb with the PNP transistors for the switch and the resistor for the base connection with the arduino this pcb will connect the arduino and the remote.
The blue wires are all - wires for the switch, the other colors are the + wires, the red and orange are + & - for power.
I connected the my arduino pins to the base pins on my small pcbs, and wrote this sketch:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(16, INPUT);
pinMode(18, INPUT);
pinMode(19, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//Receiving serial data, post to server
if (Serial.read() == '
This all works great!
But, now I would like to connect this board to my raspberry pi instead of the arduino, I wrote a similar script in shell, which does exactly the same (pull the output low for 200ms, than switch back to input)
And when connecting a led to + and a GPIO pin of the raspberry I see the led blinking for 200ms, so I know it works.
But the remote will not work with the raspberry.
I'm a beginner, So my question ultimately is, did I wire this up correctly? or did I forget anything?
)
{
String readData = captureSerial();
if(readData == "1"){
Serial.println("set to 1");
digitalWrite(16,LOW);
pinMode(16, OUTPUT);
delay(200);
pinMode(16, INPUT);
}
if(readData == "2"){
Serial.println("set to 2");
digitalWrite(18,LOW);
pinMode(18, OUTPUT);
delay(200);
pinMode(18, INPUT);
}
if(readData == "3"){
Serial.println("set to 3");
digitalWrite(19,LOW);
pinMode(19, OUTPUT);
delay(200);
pinMode(19, INPUT);
}
}
}
String captureSerial()
{
String readData = "";
for (int i = 0; i < 100; i++)
{
delay(10);
char curChar = Serial.read();
if (curChar == '#')
{
break;
}
readData += String(curChar);
}
return readData;
}
This all works great!
But, now I would like to connect this board to my raspberry pi instead of the arduino, I wrote a similar script in shell, which does exactly the same (pull the output low for 200ms, than switch back to input)
And when connecting a led to + and a GPIO pin of the raspberry I see the led blinking for 200ms, so I know it works.
But the remote will not work with the raspberry.
I'm a beginner, So my question ultimately is, did I wire this up correctly? or did I forget anything?