@PtrBld Would love to see something similar, but using NFC instead of a button?
e.g. I use NFC on my phone and a sticker on the mirror, to simulate the button press and send the command to the module(s)
I think this should work as long as your phone is connected to the same network as the mirror. And we need to create a simple Android / IOS Service which sends the commands to the mirror. However I do not see any possibility to directly connect the NFC chip to the mirror without using an app service…
So this is quite a lot of work to do. If I find time I will take a look at it, but don´t expect this too soon. If you want to try it you can surely ask me if you need any help!
Or you can use one of these boards.
Im running MMM-Button Modul und GPIO PIN 9. Everything is working fine. But sometimes my Tagesschauvideo starts without my hand. I did nothing and “pm2 logs mm” sad to me: button pressed. Any idea why this happens?
Here a picture of my pm2 logs over the night:
I never pressed the button
What’s listening for the button? How is it configured? How is the GPIO pin configured?
a) the button is faulty
b) the button is left
A bit of lesson here:
In order for a button to get registered, the controller needs to be able to detect a voltage differential. Whether that’s 0V to 3.3V, or -5V to 0V. This means that the button needs to be at a known level compared to what the controller is set to register a trigger. If the controller is meant to detect a
1, then the button must be referenced to ground, or 0V. If the controller is set to detect a
0, then the button must be referenced to the pin’s high voltage, 3.3V or 5V. This is called pulling the button UP or DOWN. When the button is pushed, it will then register the voltage difference that the controller will recognize.
A button that has no reference to either a
HIGHis called a
FLOATINGbutton. This is bad! A floating button will randomly trigger and the controller will “see” random triggers from it.
So, how is the button set up, how is the GPIO set up, what’s the code that’s attempting to read the button?
And to complement @KirAsh4 comment: probably the cause is some voltage / EMI feedback, likely due to the wires and switches.
From what I see, the Pi does not have protective diodes on the inputs like the AVR chips (and Arduino) do. As a result, feedback to the Pi can probably cause the behaviour which you experienced. Try to switch on/off some lights and electrical devices and see the result.
To correct this condition, use a combination of current limiting, filtering and shielding.
You could use for current limiting, a 1K resistor in line with the switch, installed on a PCB inches from the Pi. Also use a low-pass filter made up of another pull-up / pull-down resistor and a capacitor alternatively to the build in PULL-UP and PULL-DOWN resistors of the PI.
Here are some additional links:
Both, thank you for your answer. I will try to give you more informations. The following button from Ebay are used:
At first, I tryed the configuration from PtrBld´s howto:
After the false positiv pressed buttons, I tryed the actually config:
But the problem is always the same.
@CGabo, I will have a look to your links tomorrow. But I am not an electrican, so I hope to understand.
Thank you in advance!
Yeah, that’s a floating button. You need a pull-down on it, a known state, so the rpi can detect a change. You can either do that in software with RPi.GPIO and configuring it as such:
GPIO.setup(PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
Or through hardware:
Okay, now I have a script button.py which starts with rc.local after boot.
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(9, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.cleanup() # clean up GPIO on normal exit
But it´s also not working. Did I miss something?