caferacer-forum.de - Das Forum für Petrolheads, Garagenschrauber, Ölfinger, Frickelracer und Alteisentreiber
Projekt RFID Zündschloss Eigenbau
- Nickel
- Beiträge: 606
- Registriert: 28. Mär 2016
- Motorrad:: Honda CB400N cafe brat umbau.
- Wohnort: Arnis an der Schlei
Re: Projekt RFID Zündschloss Eigenbau
Wenn das für dich ok ist. Ich will dir nicht in die parade fahren!
It's all about the details!
Why should I go a straight way, when a curve offers much more possibilities?
Why should I go a straight way, when a curve offers much more possibilities?
Re: Projekt RFID Zündschloss Eigenbau
Aber sicher ist das okay
LG Roland
LG Roland
- Nickel
- Beiträge: 606
- Registriert: 28. Mär 2016
- Motorrad:: Honda CB400N cafe brat umbau.
- Wohnort: Arnis an der Schlei
Re: Projekt RFID Zündschloss Eigenbau
Ich würde die sachen halt gern zusammen verkaufen. Sind dann ausreichend teile für zwei basteleien + fehlversuche. ^^
It's all about the details!
Why should I go a straight way, when a curve offers much more possibilities?
Why should I go a straight way, when a curve offers much more possibilities?
-
- Beiträge: 9
- Registriert: 18. Mai 2017
- Motorrad:: Suzuki GSX 750 EF, Bj. 86
Honda VT1100C2, Bj. 96
Re: Projekt RFID Zündschloss Eigenbau
Klingt gut für mich [emoji16]
Gesendet von meinem D5803 mit Tapatalk
Gesendet von meinem D5803 mit Tapatalk
-
- Beiträge: 9
- Registriert: 18. Mai 2017
- Motorrad:: Suzuki GSX 750 EF, Bj. 86
Honda VT1100C2, Bj. 96
Re: Projekt RFID Zündschloss Eigenbau
@Nickel
Ich würde dir die Teile gerne abnehmen.
Gesendet von meinem D5803 mit Tapatalk
Ich würde dir die Teile gerne abnehmen.
Gesendet von meinem D5803 mit Tapatalk
Re: Projekt RFID Zündschloss Eigenbau
Hallo, Freunde des elektronischen Motorsports.
Ich habe daran gedacht und den Code mal rausgekramt.
Pinbelegung ist für ATTiny85. Verbesserungsoptionen könnt ihr hier gerne diskutieren, ich halte mich jedoch raus.
Bin kein begnadeter Programmierer und es reicht mir so, wie es ist
LG Roland
Ich habe daran gedacht und den Code mal rausgekramt.
Pinbelegung ist für ATTiny85. Verbesserungsoptionen könnt ihr hier gerne diskutieren, ich halte mich jedoch raus.
Bin kein begnadeter Programmierer und es reicht mir so, wie es ist
Code: Alles auswählen
/*
ATTiny PB3=Eingang RFID
ATTiny PB1=Ausgang Relais
ATTiny PB0=Ausgang LED
ProgrammMode = LED AN
Slave1 programmiert 1xBlinken (Freq 1Sek)
Slave2 programmiert 2xBlinken (Freq 1Sek)
Slave3 programmiert 3xBlinken (Freq 1Sek)
Speicher voll: 3xBlinken (Freq 300ms)
Zwei Ausgänge sind über, eventuell OLED als Anzeige
Aktueller Stromverbrauch gemessen mit Multimeter Metex M3900: 0,040 A
Ohne Sleepfunktion
*/
#include <EEPROM.h>
#include "ReceiveOnlySoftwareSerial.h"
ReceiveOnlySoftwareSerial RFID = ReceiveOnlySoftwareSerial(PB3);
byte buffer[100];
byte RFID_Master[10] = {'0', '2', '0', '0', '6', 'E', '2', 'F', 'E', '0'}; //the master RFID fob (key) to look for
byte RFID_Slave1[10], RFID_Slave2[10], RFID_Slave3[10];
byte i;
byte i2;
byte checkPosition;
boolean RFID_Master_Correct;
boolean RFID_Slave1_Correct, RFID_Slave2_Correct, RFID_Slave3_Correct;
boolean RFID_SaveNextRead;
const int PIN_RELAIS = 1;
const int PIN_LED = 0;
void setup() {
RFID.begin(9600);
pinMode(PIN_RELAIS, OUTPUT);
pinMode(PIN_LED, OUTPUT);
digitalWrite(PIN_RELAIS, LOW);
digitalWrite(PIN_LED, LOW);
EEPROM_Read_Slaves(); //Varible used to read EEPROM
i = 1; //sets the varible to 1, and thereby skip the start byte (0x0A)
}
void loop() { //the main loop
// Seriel data
while (RFID.available() > 0) { //check if the RFID reader sends anything
// Serial.println(buffer[0]);
if (buffer[0] != 2) { //check if it the start bit is 0x0A
buffer[0] = RFID.read(); //write bit to buffer
} else {
//Modtag
buffer[i] = RFID.read(); //write next bit to buffer
if (buffer[i] == 3) { //if end bit is send, disable the RFID reader temporary
RFID.end();
RFID_Master_Correct = true;
RFID_Slave1_Correct = true;
RFID_Slave2_Correct = true;
RFID_Slave3_Correct = true;
//RFID
// We have read all bytes - we are now going to check them
for (checkPosition = 0; checkPosition < 10; checkPosition++) {
if (buffer[checkPosition + 1] == RFID_Slave1[checkPosition] && RFID_Slave1_Correct == true) { // compares the written bits to "RFID1"
RFID_Slave1_Correct = true; //Slave1 RFID tag is detected
} else {
RFID_Slave1_Correct = false; //Slave1 RFID tag is not detected
}
if (buffer[checkPosition + 1] == RFID_Slave2[checkPosition] && RFID_Slave2_Correct == true) { // compares the written bits to "RFID2"
RFID_Slave2_Correct = true; //Slave2 RFID tag is detected
} else {
RFID_Slave2_Correct = false; //Slave2 RFID tag is not detected
}
if (buffer[checkPosition + 1] == RFID_Slave3[checkPosition] && RFID_Slave3_Correct == true) { // compares the written bits to "RFID3"
RFID_Slave3_Correct = true; //Slave3 RFID tag is detected
} else {
RFID_Slave3_Correct = false; //Slave3 RFID tag is detected
}
//Master
if (buffer[checkPosition + 1] == RFID_Master[checkPosition] && RFID_Master_Correct == true) { // compares the written bits to "Master"
RFID_Master_Correct = true; //Master RFID tag is detected
} else {
RFID_Master_Correct = false; //Master RFID tag is detected
}
}
if (RFID_SaveNextRead == false && (RFID_Slave1_Correct == true || RFID_Slave2_Correct == true || RFID_Slave3_Correct == true) && RFID_Master_Correct == false) { //see if the right RFID fob (key) is detected
digitalWrite(PIN_RELAIS, HIGH);
delay(1000);
digitalWrite(PIN_RELAIS, LOW);
delay(1000); // Wait for you to remove the RFID fob (key)
} else if (RFID_Master_Correct == true && RFID_SaveNextRead == false) { // If the Master Card is scanned when not in programming mode
delay(1000);
RFID_SaveNextRead = true; // Enable programming mode
digitalWrite(PIN_LED, HIGH); // PROGRAMM MODE
} else if (RFID_Master_Correct == false && RFID_SaveNextRead == true) { // If another card is scanned when in programming mode
// Save the Card
if (RFID_Slave1[0] == 0) { // Is the Slave1 Card slot empty?
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave1[checkPosition] = buffer[checkPosition + 1]; // Save the scanned card as Slave1
}
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
} else if (RFID_Slave2[0] == 0) { // Is the Slave2 Card slot empty?
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave2[checkPosition] = buffer[checkPosition + 1]; // Save the scanned card as Slave2
}
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
} else if (RFID_Slave3[0] == 0) { // Is the Slave3 Card slot empty?
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave3[checkPosition] = buffer[checkPosition + 1]; // Save the scanned card as Slave3
}
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
digitalWrite(PIN_LED, HIGH);
delay(1000);
digitalWrite(PIN_LED, LOW);
delay(1000);
} else {
digitalWrite(PIN_LED, LOW);
delay(300);
digitalWrite(PIN_LED, HIGH);
delay(300);
digitalWrite(PIN_LED, LOW);
delay(300);
digitalWrite(PIN_LED, HIGH);
delay(300);
digitalWrite(PIN_LED, LOW);
delay(300);
digitalWrite(PIN_LED, HIGH);
delay(300);
digitalWrite(PIN_LED, LOW);
}
EEPROM_Save_Slaves();
RFID_SaveNextRead = false;
//Master
} else if (RFID_Master_Correct == true && RFID_SaveNextRead == true) { // If the Master Card is scanned when in programming mode
delay(1000);
// Remove all Slave Cards
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave1[checkPosition] = 0;
}
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave2[checkPosition] = 0;
}
for (checkPosition = 0; checkPosition < 10; checkPosition++) { //Read bit fra 0-9
RFID_Slave3[checkPosition] = 0;
}
EEPROM_Save_Slaves();
RFID_SaveNextRead = false;
digitalWrite(PIN_LED, LOW);
}
RFID.begin(9600);
EmptySerialBuffer(); //erase the buffer
}
i++; //used in the beginning to write to each bit in the buffer
}
}
}
void EmptySerialBuffer() { //replaces all bits in the buffer with zeros
while (RFID.available()) {
RFID.read();
}
for (i2 = 0; i2 <= i; i2++) {
buffer[i2] = 0;
}
i = 0;
}
void EEPROM_Read_Slaves() {
byte EPROMaddr;
for (EPROMaddr = 0; EPROMaddr < 10; EPROMaddr++) { //Read bit from 0-9
RFID_Slave1[EPROMaddr] = EEPROM.read(EPROMaddr);
}
for (EPROMaddr = 10; EPROMaddr < 20; EPROMaddr++) { //Read bit from 0-9
RFID_Slave2[EPROMaddr - 10] = EEPROM.read(EPROMaddr);
}
for (EPROMaddr = 20; EPROMaddr < 30; EPROMaddr++) { //Read bit from 0-9
RFID_Slave3[EPROMaddr - 20] = EEPROM.read(EPROMaddr);
}
}
void EEPROM_Save_Slaves() {
byte EPROMaddr;
for (EPROMaddr = 0; EPROMaddr < 10; EPROMaddr++) { //Read bit from 0-9
EEPROM.write(EPROMaddr, RFID_Slave1[EPROMaddr]);
}
for (EPROMaddr = 10; EPROMaddr < 20; EPROMaddr++) { //Read bit from 0-9
EEPROM.write(EPROMaddr, RFID_Slave2[EPROMaddr - 10]);
}
for (EPROMaddr = 20; EPROMaddr < 30; EPROMaddr++) { //Read bit from 0-9
EEPROM.write(EPROMaddr, RFID_Slave3[EPROMaddr - 20]);
}
}
- GalosGarage
- Beiträge: 4951
- Registriert: 22. Aug 2013
- Motorrad:: Ducati ST2 Umbau ( 9½ )
Cagiva Alazzurra (Caffè Corretto) im Aufbau
digitaler Umbau Ducati 750ss (emozione) später mal
Cagiva-Duc-BMW Mix (Quattro Stagioni) im Aufbau - Wohnort: 41564 Kaarst
Re: Projekt RFID Zündschloss Eigenbau
Danke fürs einstellen des Codes.
aber... was ist das für ne LIB?
#include "ReceiveOnlySoftwareSerial.h"
die kenn ich nicht. muss ich mal im www nach schnöfen wo ich die finde.
galo
aber... was ist das für ne LIB?
#include "ReceiveOnlySoftwareSerial.h"
die kenn ich nicht. muss ich mal im www nach schnöfen wo ich die finde.
galo
Re: Projekt RFID Zündschloss Eigenbau
Hallo Galo,
wenn die nicht findest, schrei einfach.
Ich schicke sie dir.
LG Roland
wenn die nicht findest, schrei einfach.
Ich schicke sie dir.
LG Roland
- GalosGarage
- Beiträge: 4951
- Registriert: 22. Aug 2013
- Motorrad:: Ducati ST2 Umbau ( 9½ )
Cagiva Alazzurra (Caffè Corretto) im Aufbau
digitaler Umbau Ducati 750ss (emozione) später mal
Cagiva-Duc-BMW Mix (Quattro Stagioni) im Aufbau - Wohnort: 41564 Kaarst
Re: Projekt RFID Zündschloss Eigenbau
komm ich bei zeiten gern drauf zurück.
galo
galo
Re: Projekt RFID Zündschloss Eigenbau
Wenn ich mal wieder im Büro bin werde ich hoffentlich an Dich denken
LG Roland
LG Roland