Showing posts with label library. Show all posts
Showing posts with label library. Show all posts
Sunday, August 28, 2016
Arduino Uno RFID RC522 MFRC522 library example DumpInfo
Arduino Uno RFID RC522 MFRC522 library example DumpInfo
This post show how Arduino Uno + RFID-RC522 (RFID reader) to dump info of RFID key and RFID card, using Arduino RFID Library for MFRC522.
Arduino library for MFRC522 and other RFID RC522 based modules (https://github.com/miguelbalboa/rfid) read and write different types of Radio-Frequency IDentification (RFID) cards on your Arduino using a RC522 based reader connected via the Serial Peripheral Interface (SPI) interface.
Install MFRC522 library to Arduino IDE:
You can download ZIP file from the library web page, and it to Arduino library, read the video below. After library added, it will be in the folder your_DocumentsArduinolibraries,
and fritzing parts is in your_DocumentsArduinolibraries fid-masterdocfritzing.

Connect Arduino Uno and RFID-RF522 module:

In Arduino IDE, Open Example of DumpInfo in MFRC522:
/*
* ----------------------------------------------------------------------------
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
* for further details and other examples.
*
* NOTE: The library file MFRC522.h has a lot of useful info. Please read it.
*
* Released into the public domain.
* ----------------------------------------------------------------------------
* Example sketch/program showing how to read data from a PICC (that is: a RFID
* Tag or Card) using a MFRC522 based RFID Reader on the Arduino SPI interface.
*
* When the Arduino and the MFRC522 module are connected (see the pin layout
* below), load this sketch into Arduino IDE then verify/compile and upload it.
* To see the output: use Tools, Serial Monitor of the IDE (hit Ctrl+Shft+M).
* When you present a PICC (that is: a RFID Tag or Card) at reading distance
* of the MFRC522 Reader/PCD, the serial output will show the ID/UID, type and
* any data blocks it can read. Note: you may see "Timeout in communication"
* messages when removing the PICC from reading distance too early.
*
* If your reader supports it, this sketch/program will read all the PICCs
* presented (that is: multiple tag reading). So if you stack two or more
* PICCs on top of each other and present them to the reader, it will first
* output all details of the first and then the next PICC. Note that this
* may take some time as all data blocks are dumped, so keep the PICCs at
* reading distance until complete.
*
* Typical pin layout used:
* -----------------------------------------------------------------------------------------
* MFRC522 Arduino Arduino Arduino Arduino Arduino
* Reader/PCD Uno Mega Nano v3 Leonardo/Micro Pro Micro
* Signal Pin Pin Pin Pin Pin Pin
* -----------------------------------------------------------------------------------------
* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
* SPI SS SDA(SS) 10 53 D10 10 10
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
*/
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 //
#define SS_PIN 10 //
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
ShowReaderDetails(); // Show details of PCD - MFRC522 Card Reader details
Serial.println(F("Scan PICC to see UID, type, and data blocks..."));
}
void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}
void ShowReaderDetails() {
// Get the MFRC522 software version
byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
Serial.print(F("MFRC522 Software Version: 0x"));
Serial.print(v, HEX);
if (v == 0x91)
Serial.print(F(" = v1.0"));
else if (v == 0x92)
Serial.print(F(" = v2.0"));
else
Serial.print(F(" (unknown)"));
Serial.println("");
// When 0x00 or 0xFF is returned, communication probably failed
if ((v == 0x00) || (v == 0xFF)) {
Serial.println(F("WARNING: Communication failure, is the MFRC522 properly connected?"));
}
}
- Similarly example run on Android: Android NFC: readBlock() for MifareClassic, to dump data in RFID tag
- Step-by-step to make MFRC522-python work on Raspberry Pi 2/raspbian Jessie, read RFID tags using RFID Reader, RFID-RC522.
- Raspberry Pi 2 + MFRC522-python - Dump RFID Tag data using mxgxw/MFRC522-python
Sunday, August 21, 2016
AltSoftSerial Library for Arduino Boards
AltSoftSerial Library for Arduino Boards
AltSoftSerial is a software emulated serial library for Arduino boards, using hardware timers for improved compatibility.

AltSoftSerial is particularly useful when simultaneous data flows are needed. It is capable of running up to 57600 baud on 16 MHz AVR with up to 9 µs interrupt latency from other libraries. Slower baud rates are recommended when other code may delay AltSoftSerials interrupt response by more than 9 µs.
AltSoftSerial Library can be installed to Arduino IDE using Library Manager.
Labels:
altsoftserial,
arduino,
boards,
for,
library
Thursday, August 11, 2016
AnyPixel js an open source software and hardware library to create big unusual interactive displays
AnyPixel js an open source software and hardware library to create big unusual interactive displays

AnyPixel.js is an open source software and hardware library created here at Google, making it possible to use the web to create big, unusual, interactive displays out of all kinds of things. Anyone can take the code and the schematics to create their own display at any scale or level of expertise.
The first display using this platform is in the 8th Avenue lobby at the Google NYC office. To create this installation, we used 5880 off-the-shelf arcade buttons as our pixels.
Learn more about the project and how to create your own AnyPixel.js display at https://goo.gl/anypixel
3 2 480 x 320 TFT LCD Shield install UTFT library and test with Arduino Mega 2560
3 2 480 x 320 TFT LCD Shield install UTFT library and test with Arduino Mega 2560
Its 3.2" 480 x 320 TFT color screen support Arduino Mega 2560, named QDM320B.
According to the seller:
Overview
QD320DB16NT8357RA module is 3.2" TFT LCD with 262K color 480x320 resolutions.
The controller of this LCD module is HX8357B, it supports 16-wires DataBus interface. Moreover, this module includes the 5V -3.3V power conversion circuit and Level Level conversion circuit, This Module can Directly inserted into the Arduino Mega2560 Board, it also includes the SD card socket and SPI FLASH circuit.
Features
- Support Arduino Mega2560 Directly inserted
- With Full-angle IPS TFT panel
- OnBorad level conversion chip for 5V/3.3V MCU
- Compatible with 3.3/5V operation voltage level
- Compatible with Arduino-Series development Board.
- Compatible with UTFT / UTFT_Buttons /Utouch Library for arduino.
- provided 12-examples with Arduino ,3-examples with STM32 ??
- With SD Card Socket
- With SPI FLASH circuit
This video show how to install UTFT library (from http://www.rinkydinkelectronics.com/) and test example on Arduino Mega 2560.
More examples:
- Draw bitmap on 3.2" 480 x 320 TFT LCD Shield using UTFT
- Arduino Mega read string from Serial, display on 3.2" 480 x 320 TFT LCD Shield
Thursday, August 4, 2016
esp8266 OLED esp8266 Arduino library for I2C OLED displays
esp8266 OLED esp8266 Arduino library for I2C OLED displays
esp8266-OLED is an esp8266-Arduino library for I2C-OLED displays. This post show how to download and install to Arduino IDE, and test with example.
- Its assumed you are programming NodeMCU on Arduino Software, with ESP8266 core for Arduino installed.
- Connect I2C OLED to NodeMCU.

OLED VCC - NodeMCU 3v3
OLED GND - NodeMCU GND
OLED SCL - NodeMCU D1
OLED SDA - NodeMCU D2
(reamrk: the Fritzing parts of can OLED_SSD1306_I2C_128x64 can be download HERE)
- Add esp8266-OLED library to Arduino Software:
visit https://github.com/klarsys/esp8266-OLED, follow the steps to install the library:
- Click on the Download ZIP button in the top right corner.
- Uncompress it.
- Rename the uncompressed folder to OLED.
- Check that the OLED folder contains OLED.cpp and OLED.h files.
- Place the OLED folder in your <arduinosketchfolder>/libraries/ folder - you may need to create the libraries subfolder if it is your first library.
- Restart the IDE.
Open the example,
File > Examples > ESP8266-OLED Display Library > example
In order to match with our connection, we have to modify it to correct SDA and SCL pins:
change the code:
OLED display(2, 14);
to
OLED display(4, 5);
where 4, 5 correspond to NodeMCU D2 and D1. Refer to the "The pin definition" in NodeMCU - ESP8266/CP2102.
// Example sketch for testing OLED display
// We need to include Wire.h for I2C communication
#include <Wire.h>
#include "OLED.h"
// Declare OLED display
// display(SDA, SCL);
// SDA and SCL are the GPIO pins of ESP8266 that are connected to respective pins of display.
OLED display(4, 5);
void setup() {
Serial.begin(9600);
Serial.println("OLED test!");
// Initialize display
display.begin();
// Test message
display.print("Hello World");
delay(3*1000);
// Test long message
display.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
delay(3*1000);
// Test display clear
display.clear();
delay(3*1000);
// Test message postioning
display.print("TOP-LEFT");
display.print("4th row", 4);
display.print("RIGHT-BOTTOM", 7, 4);
delay(3*1000);
// Test display OFF
display.off();
display.print("3rd row", 3, 8);
delay(3*1000);
// Test display ON
display.on();
delay(3*1000);
}
int r = 0, c = 0;
void loop() {
r = r % 8;
c = micros() % 6;
if (r == 0)
display.clear();
display.print("Hello World", r++, c++);
delay(500);
}
Result:
Related:
- Another library of I2C OLED for ESP8266 core for Arduino - Adafruit SSD1306 library
- esp8266-oled-ssd1306 library
Monday, August 1, 2016
adk h No such file or directory and Install USBHost library to Arduino IDE
adk h No such file or directory and Install USBHost library to Arduino IDE
adk.h (Accessory Development Kit) is part of USBHost library. In current Arduino IDE 1.6.5, its not included by default.
To install USBHost:
> Sketch > Include Library > Manage Libraries
> Search to install USBHost.


Saturday, July 30, 2016
Arduino Uno MAX7219 8x8 LED Matrix via SPI using LedControl Library
Arduino Uno MAX7219 8x8 LED Matrix via SPI using LedControl Library

We can add LedControl Library to Arduino IDE, to control 8*8 LED Matrix with MAX7219 via SPI. LedControl is a library for the MAX7219 and the MAX7221 Led display driver.
(ref: http://wayoda.github.io/LedControl/)

Open the File > Examples > LedControl > LCDemoMatrix
LCDemoMatrix.ino
//We always have to include the library
#include "LedControl.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,11,10,1);
/* we always wait a bit between updates of the display */
unsigned long delaytime=100;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
/*
This method will display the characters for the
word "Arduino" one after the other on the matrix.
(you need at least 5x7 leds to see the whole chars)
*/
void writeArduinoOnMatrix() {
/* here is the data for the characters */
byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};
byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};
byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};
byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000};
byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110};
byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};
/* now display them one by one with a small delay */
lc.setRow(0,0,a[0]);
lc.setRow(0,1,a[1]);
lc.setRow(0,2,a[2]);
lc.setRow(0,3,a[3]);
lc.setRow(0,4,a[4]);
delay(delaytime);
lc.setRow(0,0,r[0]);
lc.setRow(0,1,r[1]);
lc.setRow(0,2,r[2]);
lc.setRow(0,3,r[3]);
lc.setRow(0,4,r[4]);
delay(delaytime);
lc.setRow(0,0,d[0]);
lc.setRow(0,1,d[1]);
lc.setRow(0,2,d[2]);
lc.setRow(0,3,d[3]);
lc.setRow(0,4,d[4]);
delay(delaytime);
lc.setRow(0,0,u[0]);
lc.setRow(0,1,u[1]);
lc.setRow(0,2,u[2]);
lc.setRow(0,3,u[3]);
lc.setRow(0,4,u[4]);
delay(delaytime);
lc.setRow(0,0,i[0]);
lc.setRow(0,1,i[1]);
lc.setRow(0,2,i[2]);
lc.setRow(0,3,i[3]);
lc.setRow(0,4,i[4]);
delay(delaytime);
lc.setRow(0,0,n[0]);
lc.setRow(0,1,n[1]);
lc.setRow(0,2,n[2]);
lc.setRow(0,3,n[3]);
lc.setRow(0,4,n[4]);
delay(delaytime);
lc.setRow(0,0,o[0]);
lc.setRow(0,1,o[1]);
lc.setRow(0,2,o[2]);
lc.setRow(0,3,o[3]);
lc.setRow(0,4,o[4]);
delay(delaytime);
lc.setRow(0,0,0);
lc.setRow(0,1,0);
lc.setRow(0,2,0);
lc.setRow(0,3,0);
lc.setRow(0,4,0);
delay(delaytime);
}
/*
This function lights up a some Leds in a row.
The pattern will be repeated on every row.
The pattern will blink along with the row-number.
row number 4 (index==3) will blink 4 times etc.
*/
void rows() {
for(int row=0;row<8;row++) {
delay(delaytime);
lc.setRow(0,row,B10100000);
delay(delaytime);
lc.setRow(0,row,(byte)0);
for(int i=0;i<row;i++) {
delay(delaytime);
lc.setRow(0,row,B10100000);
delay(delaytime);
lc.setRow(0,row,(byte)0);
}
}
}
/*
This function lights up a some Leds in a column.
The pattern will be repeated on every column.
The pattern will blink along with the column-number.
column number 4 (index==3) will blink 4 times etc.
*/
void columns() {
for(int col=0;col<8;col++) {
delay(delaytime);
lc.setColumn(0,col,B10100000);
delay(delaytime);
lc.setColumn(0,col,(byte)0);
for(int i=0;i<col;i++) {
delay(delaytime);
lc.setColumn(0,col,B10100000);
delay(delaytime);
lc.setColumn(0,col,(byte)0);
}
}
}
/*
This function will light up every Led on the matrix.
The led will blink along with the row-number.
row number 4 (index==3) will blink 4 times etc.
*/
void single() {
for(int row=0;row<8;row++) {
for(int col=0;col<8;col++) {
delay(delaytime);
lc.setLed(0,row,col,true);
delay(delaytime);
for(int i=0;i<col;i++) {
lc.setLed(0,row,col,false);
delay(delaytime);
lc.setLed(0,row,col,true);
delay(delaytime);
}
}
}
}
void loop() {
writeArduinoOnMatrix();
rows();
columns();
single();
}
Connect MAX7219 8x8 LED Matrix to Arduino Uno as stated in the example:
- pin 12 is connected to the DataIn
- pin 11 is connected to the CLK
- pin 10 is connected to LOAD (its cs marked on my sample)
- +5V to VCC
- GND to GND

Run.
Check the video:
Subscribe to:
Posts (Atom)