Micro SD TF Card Memory Module [S059]



https://www.youtube.com/watch?v=Sn58KLbRQpA


*GitHubhttps://github.com/rdiot/rdiot-s059.git


* Specs

Features:

Support Micro SD Card, Micro SDHC card (high-speed card)

The level conversion circuit board that can interface level is 5V or 3.3V

Communication interface is a standard SPI interface

Control Interface: A total of six pins (GND, VCC, MISO, MOSI, SCK, CS), GND to ground,

VCC is the power supply, MISO, MOSI, SCK is the SPI bus, CS is the chip select signal pin;

3.3V regulator circuit: LDO regulator output 3.3V as level converter chip, Micro SD card supply;

Level conversion circuit: Micro SD card into the direction of signals into 3.3V, MicroSD card toward the direction of the control interface MISO signal is also converted to 3.3V, general AVR microcontroller system can read the signal;

Micro SD card connector: yes since the bomb deck for easy card insertion and removal.

Positioning holes: 4 M2 screws positioning hole diameter of 2.2mm, easy to install positioning, to achieve inter-module combination;


Specifications:

Power supply:4.5V - 5.5V, 3.3V voltage regulator circuit board

Positioning holes: 4 M2 screws positioning hole diameter of 2.2mm

Control Interface: GND, VCC, MISO, MOSI, SCK, CS

Size:45 x 28mm

Net weight:6g


* Contents

- Connect

CS   ----- D4

SCK  ----- D13

MOSI ----- D11

MISO ----- D12

VCC  ----- 5V

GND  ----- GND

 

- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

#include <SPI.h>

#include <SD.h> // include the SD library


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


File myFile;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  delay(1000);

  lcd.clear();


  lcd.setCursor(0,0);

  lcd.print("S059:microSD Adapter");


  lcd.setCursor(0,1);

  lcd.print("Initializing SD Card");


  if (!SD.begin(4)) {

    lcd.setCursor(0,1);

    lcd.print("Initialize Failed   ");

    return;

  }


  lcd.setCursor(0,1);

  lcd.print("Initialization done");


  myFile = SD.open("test5.txt", FILE_WRITE);


  // if the file opened okay, write to it:

  if (myFile) {


    lcd.setCursor(0,1);

    lcd.print("Writing to test.txt ");

    myFile.println("text");

    

    // close the file:

    myFile.close();

    lcd.setCursor(0,2);

    lcd.print("writing done.");

  } else {


    lcd.setCursor(0,2);

    lcd.print("error opening test.txt");

  }


  // re-open the file for reading:

  myFile = SD.open("test5.txt");

  if (myFile) {

    lcd.setCursor(0,3);

    lcd.print("Read test.txt:");


    // read from the file until there's nothing else in it:

    while (myFile.available()) {

      lcd.write(myFile.read());


    } 

    // close the file:

    myFile.close();

  } else {

    // if the file didn't open, print an error:

    lcd.setCursor(0,2);

    lcd.print("error opening test.txt");

  }


}

Posted by RDIoT
|

DS3231 AT24C32 IIC Clock Module (DS3231SN) [S174] 




https://www.youtube.com/watch?v=hYUx6N5KAhI


*GitHubhttps://github.com/rdiot/rdiot-s174.git


* Specs

Overview

DS3231 is a low cost and extremely accurate I2C real-time clock, with an integrated crystal and temperature-compensated crystal oscillator (TCXO).  DS3231 can be operated using supply voltages ranging from 2.3 V to 5.5 V and it also features battery backup capabilities.

The DS3231 features an integrated crystal, 2 programmable time-of-day alarms, a temperature sensor, and 32.768 kHz signal output pin.

The AT24C32 EEPROM is a 32K EEPROM that can be used to add non-volatile data storage to your electronic projects and prototypes.

The module also features a battery holder, allowing you to add a backup battery to ensure continuous operation.


Features

Can be connected directly to the microcontroller IO ports

Standard 2.54 mm pins for input and output connections

Two calendars and alarm clock

Two programmable square-wave outputs

Real time clock generator for seconds, minutes, hours, day, date, month, and year timing

Valid until 2100 with leap year compensation

Can be cascaded with other I2C devices

The address can be set using the pins A0/A1/A2 (the default address is 0x57)

Battery socket compatible with LIR2032 batteries

I2C interface

Specifications


Operating voltage: 3.3 V to 5.5 V

Real-time clock chip: DS3231

Clock accuracy: 2 ppm

Memory chip: AT24C32 (32 Kb storage capacity)

On-chip temperature sensor with an accuracy of ±3 ℃

I2C bus interface maximum speed: 400 kHz

Size: 38 x 22 x 14 mm



* Contents

- DataSheet : http://datasheets.maximintegrated.com/en/ds/DS3231.pdf

- Library : https://github.com/kriswiner/DS3231RTC

- Connect

DS3231 Breakout --------- Arduino

3.3V --------------------- 3.3V

SDA ----------------------- A4

SCL ----------------------- A5

GND ---------------------- GND


- Key Code

   // If device is not busy, read time, date, and temperature

   byte c = readByte(DS3231_ADDRESS, STATUS) & 0x04;

   if(!c) {  // if device not busy

 

  // These interrupts require constant polling of the STATUS register which takes a lot of time, 

  // which the microcontroller might not be able to spare. If the micrcontroller has a lot of other things to do

  // or we want to save power by only waking up the microcontroller when something requires its attention, use the 

  // hardware interrupt routine alarmChange().

   c = readByte(DS3231_ADDRESS, STATUS);           // Read STATUS register of DS3231 RTC

   if(c & 0x01) {                                  // If Alarm1 flag set, take some action

     digitalWrite(outPin1, HIGH);                  // Turn on extenal LED

 

  // play song1

     for (uint8_t entry = 0; entry < 32; entry++) {

       uint8_t data = readEEPROM(AT24C32_ADDRESS, 1, entry);

       tone(outPin2, data, 50);  delay(50);

     }

     noTone(outPin2);                              // End song1

 

     digitalWrite(outPin1, LOW);                   // Turn off external LED

     writeByte(DS3231_ADDRESS, STATUS, c & ~0x01); // clear Alarm 1 flag if already set

   }

   if(c & 0x02) {                                  // If Alarm 2 flag set, take some action

     digitalWrite(outPin1, HIGH);                  // Turn on extenal LED

 

  // play song1

     for (uint8_t entry = 0; entry < 32; entry++) {

       uint8_t data = readEEPROM(AT24C32_ADDRESS, 1, entry);

       tone(outPin2, data, 50); delay(50); 

     }

     noTone(outPin2);                              // End song1

     

     digitalWrite(outPin1, LOW);                   // Turn off extenal LED

     writeByte(DS3231_ADDRESS, STATUS, c & ~0x02); // clear Alarm 2 flag if already set

   }

 

    // get time

    seconds = readSeconds();

    minutes = readMinutes();

    hours   = readHours();

    PM      = readPM();

    

    day     = readDay();

    date    = readDate();

    month   = readMonth();

    year    = readYear();

    century = readCentury();

   

    // get temperature

    temperature = readTempData();  // Read the temperature

   }  

 

    // Serial print and/or display at 0.5 s rate independent of data rates

    delt_t = millis() - count;

    if (delt_t > 300) { // update LCD once per half-second independent of read rate

    digitalWrite(blinkPin, blinkOn);

    

    display.clearDisplay();

  

    display.setCursor(0, 0); display.print("DS3231 RTC");

    

    display.setCursor(0, 10); 

    if(hours < 10)   {display.print("0"); display.print(hours);}   else display.print(hours);

    display.print(":"); 

    if(minutes < 10) {display.print("0"); display.print(minutes);} else display.print(minutes);

    display.print(":"); 

    if(seconds < 10) {display.print("0"); display.print(seconds);} else display.print(seconds);

    if(PM) display.print(" PM"); else display.print(" AM"); 

    

    display.setCursor(0, 20); display.print(month); display.print("/"); display.print(date); display.print("/20"); display.print(year); 

 

    display.setCursor(0, 30); 

    if(day == 1) display.print("Monday");   

    if(day == 2) display.print("Tuesday");  

    if(day == 3) display.print("Wednesday");

    if(day == 4) display.print("Thursday");   

    if(day == 5) display.print("Friday");  

    if(day == 6) display.print("Saturday");  

    if(day == 7) display.print("Sunday");   

    

    display.setCursor(0, 40); display.print("T = "); display.print(temperature, 2); display.print(" C"); 

    display.display();

    

    blinkOn = ~blinkOn;

    count = millis();  

}

'2) Sensor > RTC' 카테고리의 다른 글

RTC DS1302 Module (DS1302) [S030]  (0) 2016.09.11
Tiny RTC DS1307 I2C Module (DS1307) [S029]  (0) 2016.09.11
Posted by RDIoT
|

SiteMap

카테고리 없음 2016. 9. 11. 10:10
sitemap.xmlsitemap.xml


sitemap.xml

sitemap.xml



sitemap_20170828.xml


 

Posted by RDIoT
|