Read the statement by Michael Teeuw here.
MYMIRROR - From Modena
-
@sdetweil , don’t forget you helped me with serial notifications with Arduino…
-
@s-monti-74 said in MYMIRROR - From Modena:
MMM-Serial-Notifications
Very interested on this as well i have some rfid rings that i want to use and the rfid-rc522 and arduino uno. So basically everything needed.
I gave a try to this https://forum.magicmirror.builders/topic/9983/profile-switcher-rc522-rfid?page=1 but i could not get it to work can you please guide me how to use the rfid to switch profilesDenis
-
This post is deleted! -
This post is deleted! -
I have done in this way.
I Have installed Arduino IDE on RPI and to run on Arduino the program to send via serial communication ten information of the RFID it’s reading
This in the programo uploaded on Arduino
I use two RFID tags (TAG1 and TAG2) -
This post is deleted! -
---------------------------------------------------- #include <SPI.h> #include <RFID.h> #define SDA_DIO 10 // 53 per Mega #define RESET_DIO 9 #define delayRead 1000 // Time of delay #define delayLed 2000 #define ledVerde 3 #define ledRosso 4 RFID RC522(SDA_DIO, RESET_DIO); String TAG1= "975318736"; String TAG2= "976A15D37"; void setup() { Serial.begin(9600); /* Abilita SPI*/ SPI.begin(); /* Viene inizilizzato RFID reader */ RC522.init(); /*Serial.println("Setup");*/ pinMode(ledVerde,OUTPUT); pinMode(ledRosso,OUTPUT); } void loop() { /* Temporary loop counter */ byte i; // Se viene letta una tessera if (RC522.isCard()) { RC522.readCardSerial(); String codiceLetto =""; for(i = 0; i <= 4; i++) { codiceLetto+= String (RC522.serNum[i],HEX); codiceLetto.toUpperCase(); } if (codiceLetto.equals(TAG1)){ Serial.println("S"); accendiLed(ledVerde); } if (codiceLetto.equals(TAG2)){ Serial.println("G"); accendiLed(ledVerde) delay(delayRead); } } boolean verificaCodice(String codiceLetto){ if(codiceLetto.equals(codiceAutorizzato)){ return true; }else{ return false; } } void accendiLed(int ledPin){ digitalWrite(ledPin,HIGH); delay(delayLed); digitalWrite(ledPin,LOW); } ----------------------------------------------------
-
this program sends via serial communication the value “S” if i use TAG1 and “G” if I usa TAG2
Then you have to use, on magic mirror, the module MMM-Serial-Notifications to read the value:{ module: 'MMM-Serial-Notifications', config: { devices: { '/dev/ttyACM0': { messages: { 'S': [ { notification: 'CURRENT_PROFILE', payload: 'S', }, ], 'A': [ { notification: 'CURRENT_PROFILE', payload: 'G', } ] } } } } },
and the module MMM-ProfileSwitcher to manage all other modules:
{ module: 'MMM-ProfileSwitcher', classes: 'default', header: "Profile", config: { enterMessages: { "G": "Ciao, G", "S": "Ciao, S" }, leaveMessages: { "G": "Ciao G, ci vediamo alla prossima", "S": "Ciao S, ci vediamo alla prossima", }, timers: { "S": { time: 10 * 1000 }, "G": { time: 10 * 1000 } } } },
BYE
Stefano -
@s-monti-74 So do you use an Arduino Uno or not??
Why do you download the Arduino IDE on the Rpi?? Is it just for programming the UNO (i use the IDE on my Windows machine) or to read the serial commands??
How do you connect the RFID board RC522 to the Rpi or to the UNO?? … the board has 7 used pins and 1 unused, assuming we are talking about the RFID-RC522 boardGracie
Denis -
@s-monti-74 Stefano One more question if you use the Arduino Uno how do you connected it to the Rpi??