Arduino RC522 RFID Module

What you need:
1PCS Arduino UNO R3
1PCS USB Cable
1PCS RC522 RFID Module
7P Female to Male Dupont Cable

Connection:

 

Code:

/*

* ——————————————————————————————————————–

* Example sketch/program showing how to read data from a PICC to serial.

* ——————————————————————————————————————–

* This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid

*

* 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.

*

* @license Released into the public domain.

*

* Typical pin layout used:

* —————————————————————————————–

*             MFRC522      Arduino       Arduino   Arduino    Arduino          Arduino

*             Reader/PCD   Uno/101       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          // Configurable, see typical pin layout above

#define SS_PIN          10         // Configurable, see typical pin layout above

 

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

mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD – MFRC522 Card Reader details

Serial.println(F(“Scan PICC to see UID, SAK, 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));

}

Result:

amazon link   https://www.amazon.com/dp/B07PY38DMP
Any question please email sales@diymalls.com

Arduino MPU-6050 Accelerometer Gyro Sensor

   Arduino MPU-6050 Accelerometer Gyro Sensor

 What you need:
1PCS Arduino UNO R3
1PCS USB Cable
1PCS MPU-6050 Accelerometer Gyro Sensor
5P Female to Male Dupont Cable

Connection:

Code:
// MPU-6050 Short Example Sketch

// By Arduino User JohnChi

// August 17, 2014

// Public Domain

#include<Wire.h>

const int MPU_addr=0x68;  // I2C address of the MPU-6050

int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){

Wire.begin();

Wire.beginTransmission(MPU_addr);

Wire.write(0x6B);  // PWR_MGMT_1 register

Wire.write(0);     // set to zero (wakes up the MPU-6050)

Wire.endTransmission(true);

Serial.begin(9600);

}

void loop(){

Wire.beginTransmission(MPU_addr);

Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)

Wire.endTransmission(false);

Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers

AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)

AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)

AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)

Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)

GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)

GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)

GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)

Serial.print(“AcX = “); Serial.print(AcX);

Serial.print(” | AcY = “); Serial.print(AcY);

Serial.print(” | AcZ = “); Serial.print(AcZ);

Serial.print(” | Tmp = “); Serial.print(Tmp/340.00+36.53);  //equation for temperature in degrees C from datasheet

Serial.print(” | GyX = “); Serial.print(GyX);

Serial.print(” | GyY = “); Serial.print(GyY);

Serial.print(” | GyZ = “); Serial.println(GyZ);

delay(333);

}

Result:

amazon link    https://www.amazon.com/dp/B07PY38BCB

Any question please email  sales@diymalls.com

Arduino Sound Detection Sensor

What you need:
1PCS Arduino UNO R3
1PCS Sound Detection Sensor
3P Female to Male Dupont Cable

Pin Outs:

Connection:

Code:

//Henry’s Bench

//Arduino Sound Detection Sensor Module

 

int soundDetectedPin = 10; // Use Pin 10 as our Input

int soundDetectedVal = HIGH; // This is where we record our Sound Measurement

boolean bAlarm = false;

 

unsigned long lastSoundDetectTime; // Record the time that we measured a sound

 

 

int soundAlarmTime = 500; // Number of milli seconds to keep the sound alarm high

 

 

void setup ()

{

Serial.begin(9600);

pinMode (soundDetectedPin, INPUT) ; // input from the Sound Detection Module

}

void loop ()

{

soundDetectedVal = digitalRead (soundDetectedPin) ; // read the sound alarm time

 

if (soundDetectedVal == LOW) // If we hear a sound

{

 

lastSoundDetectTime = millis(); // record the time of the sound alarm

// The following is so you don’t scroll on the output screen

if (!bAlarm){

Serial.println(“LOUD, LOUD”);

bAlarm = true;

}

}

else

{

if( (millis()-lastSoundDetectTime) > soundAlarmTime  &&  bAlarm){

Serial.println(“quiet”);

bAlarm = false;

}

}

}

Result:

amazon link  https://www.amazon.com/dp/B07NQHC3PQ
website link  
http://www.diymalls.com/arduino-Sound-Detection-Sensor?search=sound

Any question please email sales@diymalls.com

 

 

DIYmall 28BYJ48 Stepper Motor 5V + ULN2003 Driver Board kit for Arduino Tutorial

5V-Stepper-Motor-ULN2003-Driver-Board

What you need :
1 X Arduino uno
1 X USB Cable
1 X stepper motor 28BYJ48 5V
1 X ULN2003
6 X Female to male cable

Connection:
ULN2003       Arduino
5V                         5V
GND                     GND
IN1                         8
IN2                        9
IN3                        10
IN4                        11

ULN2003 connect with stepper motor 28BYJ48

Once connection, connect Arduino uno r3 with computer via usb cable

Arduino code:
/*
BYJ48 Stepper motor code
Connect :
IN1 >> D8
IN2 >> D9
IN3 >> D10
IN4 >> D11
VCC … 5V Prefer to use external 5V Source
Gnd
written By :Mohannad Rawashdeh
https://www.instructables.com/member/Mohannad+Rawashdeh/
28/9/2013
*/

#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11
int Steps = 0;
boolean Direction = true;// gre
unsigned long last_time;
unsigned long currentMillis ;
int steps_left=4095;
long time;
void setup()
{
Serial.begin(115200);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
// delay(1000);

}
void loop()
{
while(steps_left>0){
currentMillis = micros();
if(currentMillis-last_time>=1000){
stepper(1);
time=time+micros()-last_time;
last_time=micros();
steps_left–;
}
}
Serial.println(time);
Serial.println(“Wait…!”);
delay(2000);
Direction=!Direction;
steps_left=4095;
}

void stepper(int xw){
for (int x=0;x<xw;x++){
switch(Steps){
case 0:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
break;
case 1:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
break;
case 2:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
break;
case 3:
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
break;
case 4:
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
break;
case 5:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
break;
case 6:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
break;
case 7:
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
break;
default:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
break;
}
SetDirection();
}
}
void SetDirection(){
if(Direction==1){ Steps++;}
if(Direction==0){ Steps–; }
if(Steps>7){Steps=0;}
if(Steps<0){Steps=7; }
}

Video link  https://youtu.be/akoYIyD4ZVw

How to change logo to arduino code?

  1. Download  GIMP , link https://www.gimp.org/
  2. Open GIMP, then click file-open  choose the logo picture( you need edit your logo in photoshop first, to make the logo size almost full size of the whole picture)
  3. In GIMP, Colors-desaturate, to convert the logo color to black

  4. Image-mode-indexed, choose use black and white(1-bit) in palette
  5. File-export as-XBM
  6. Open the XBM file in textedit, you will get code like this:
    #define DIYmall_width 120
    #define DIYmall_height 64
    static char DIYmall_bits[] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xe0, 0xff,
    0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x07, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f,
    0x00, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00,
    0x80, 0xff, 0xff, 0x0f, 0x00, 0x10, 0xf0, 0x0f, 0x00, 0xe0, 0x07, 0x00,
    0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, 0xf0, 0xe0, 0x3f, 0x00,
    0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x01, 0xf0,
    0xc1, 0x7f, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0,
    0xff, 0x07, 0xf0, 0x07, 0xff, 0x00, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00,
    0x80, 0x3f, 0x00, 0xfc, 0x0f, 0xf0, 0x07, 0xfe, 0x03, 0xff, 0x01, 0x00,
    0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0xf0, 0x1f, 0xf0, 0x07, 0xfc, 0xc7,
    0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0xc0, 0x3f, 0xf8,
    0x07, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,
    0xc0, 0x3f, 0xf8, 0x07, 0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x80, 0x3f, 0x00, 0x80, 0x7f, 0xf8, 0x07, 0xc0, 0xff, 0x0f, 0x00, 0x02,
    0x00, 0x08, 0x03, 0x80, 0x3f, 0x00, 0x80, 0x7f, 0xf8, 0x0f, 0x80, 0xff,
    0x87, 0x87, 0x07, 0x00, 0x0c, 0x03, 0x80, 0x3f, 0x00, 0x80, 0x7f, 0xf8,
    0x0f, 0x00, 0xff, 0x83, 0x87, 0x07, 0x00, 0x0c, 0x03, 0x80, 0x3f, 0x00,
    0x80, 0x7f, 0xf8, 0x0f, 0x00, 0xff, 0x83, 0x8f, 0x07, 0x00, 0x0c, 0x03,
    0x80, 0x3f, 0x00, 0x80, 0x7f, 0xf8, 0x0f, 0x00, 0xff, 0x81, 0xcd, 0x07,
    0x3f, 0x0c, 0x03, 0x80, 0x3f, 0x00, 0xc0, 0x3f, 0xf8, 0x0f, 0x00, 0xfe,
    0x81, 0xcd, 0x86, 0x71, 0x0c, 0x03, 0x80, 0x3f, 0x00, 0xc0, 0x3f, 0xf8,
    0x0f, 0x00, 0xfe, 0x80, 0xcd, 0x86, 0x60, 0x0c, 0x03, 0x80, 0x3f, 0x00,
    0xe0, 0x1f, 0xf0, 0x0f, 0x00, 0xfe, 0x80, 0xd9, 0x06, 0x70, 0x0c, 0x03,
    0x80, 0x3f, 0x00, 0xf8, 0x0f, 0xf0, 0x07, 0x00, 0xfe, 0x80, 0xf9, 0x06,
    0x7f, 0x0c, 0x03, 0x80, 0x3f, 0x80, 0xff, 0x07, 0xf0, 0x07, 0x00, 0xfe,
    0x80, 0x79, 0x86, 0x61, 0x0c, 0x03, 0x80, 0xff, 0xff, 0xff, 0x03, 0xf0,
    0x07, 0x00, 0xfe, 0x80, 0x79, 0xc6, 0x70, 0x0c, 0x03, 0x80, 0xff, 0xff,
    0xff, 0x00, 0xf0, 0x07, 0x00, 0xfe, 0x80, 0x71, 0xc6, 0x79, 0x0c, 0x03,
    0x80, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0x03, 0x00, 0xfe, 0x80, 0x31, 0x86,
    0x6f, 0x0c, 0x03, 0x00, 0xfc, 0xff, 0x03, 0x00, 0xe0, 0x01, 0x00, 0x78,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  7. Save the arduino code

    Link http://www.instructables.com/id/Change-Adafruit-Library-OLED-Logo/