Hi! I’m trying to make an RFID scanner with Blynk Terminal. All that I have to do is to make the RFID scanner print the UID hex on the RFID tag to the Blynk Terminal.
Hi,
There are plenty of Blynk Terminal Widget examples in the forum. Why don’t you share the code you have so far and we may be able to help?
cul
billd
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <WiFiUdp.h> //for OTA update
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
String sdata;
char auth[] = "5Sk2Xw-K7XDi3qOVJ02ZaF2dzM9lfZSY";
char ssid[] = "PLDTHOMEFIBRKYv3m";
char pass[] = "PLDTWIFIjFZq3";
#include <Adafruit_MLX90614.h>
#define EspSerial Serial1
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10
MFRC522 rfid(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
byte nuidPICC[4];
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
int red_light_pin= 4;
int green_light_pin = 5;
int blue_light_pin = 6;
const int buzzer = 8;
void setup()
{;
Serial.begin(9600);
pinMode(7,OUTPUT);
digitalWrite(7,LOW);
pinMode(6,OUTPUT);
digitalWrite(6,LOW);
pinMode(buzzer, OUTPUT);
pinMode(red_light_pin, OUTPUT);
pinMode(green_light_pin, OUTPUT);
pinMode(blue_light_pin, OUTPUT);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
SPI.begin(); // Init SPI bus
Serial.println("ArduTrace by Ace Canacan");
mlx.begin();
Serial.begin(9600);
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init MFRC522
for (byte i = 0; i < 6; i++) {
key.keyByte[i] = 0xFF;
}
}
void loop() {
Serial.begin(9600);
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! rfid.PICC_IsNewCardPresent())
return;
// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
return;
{
// Store NUID into nuidPICC array
for (byte i = 0; i < 4; i++) {
nuidPICC[i] = rfid.uid.uidByte[i];
}
Serial.print(F("Card Holder: "));
printHex(rfid.uid.uidByte, rfid.uid.size);
Serial.println();
}
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
if ( ! rfid.PICC_ReadCardSerial())
{
delay(0); RGB_color(0, 255, 0); // Red
delay(1000); RGB_color(0, 0, 0); // Red
tone(buzzer, 2000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
}
if ( ! rfid.PICC_ReadCardSerial())
{
delay(1000); RGB_color(255, 0, 0); // Red
delay(1500); Serial.print("Card Holder Temp: ");Serial.print(mlx.readObjectTempC());
delay(2500); RGB_color(0, 0, 0); // Red
tone(buzzer, 2000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
}
}
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{
analogWrite(red_light_pin, red_light_value);
analogWrite(green_light_pin, green_light_value);
analogWrite(blue_light_pin, blue_light_value);
}
void printHex(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], HEX);
}
}
Ohhh Kayyy . . .
Read this first . . .
Second . . . Does your sketch work? Do you get errors? What are they?
cul
billd
PS. You need Blynk.run() in your void Loop() . . .