Ks0183 keyestudio Multi-purpose Shield V1: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 30: Line 30:
==Sample Code==
==Sample Code==


'''Download the Libraries of IRremote and dht11:'''  [http://www.keyestudio.com/files/index/download/id/1506751883/]
'''Download the Libraries of IRremote and dht11:'''  [https://drive.google.com/open?id=1uq5r1EiJnRwRkjKRFLdxZYzkREg8r6BI]


<pre>
<pre>

Revision as of 10:16, 8 August 2018

keyestudio Multi-purpose Shield V1


thumb

Introduction

Multi-purpose Shield V1 is a learning board based on Arduino. No need for soldering and connection. Download directly the program to complete experiment. It is multi-purpose and we offer code libraries of all modules that have been tested. You can use them directly. There are extended ports on the shield to help you to complete other experiment.


thumb

Specification

  • Compatible with main controller on the market,such as UNO R3 and MEGA2560
  • Using two-channel LED indicator to show the working condition of program for modulating program conveniently
  • Completing external interrupt experiment by two-channel keyswitch
  • One reset button
  • Measuring temperature and humidity with DHT11 temperature and humidity sensor module
  • Using revolving potentiometer to do analog input
  • Alarming and making sound by passive buzzer module
  • Full-color LED
  • Utilizing photovaristor to detect the brightness of light
  • Do temperature measuring experiment with LM35D temperature sensor
  • Detecting infrared receiving by infrared receiver
  • 2-channel digital port(D7、D8)
  • 1-channel analog port(A3)
  • One IIC interface
  • One TTL serial port

Connection Diagram

Upload program to keyestudio UNO R3 BOARD, and plug this shield into UNO R3 BOARD.

thumb

Sample Code

Download the Libraries of IRremote and dht11: [1]

#include <IRremote.h>
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4

//buzzer pin
int buzzer = 5;

//button pins
int KEY2 = 2;
int KEY3 = 3;

//pin definition of flowing light
int led5 = 13;
int led4 = 12;
int led3 = 11;
int led2 = 10;
int led1 = 9;

int RECV_PIN = 6; //define input pin on Arduino
IRrecv irrecv(RECV_PIN);
decode_results results;

char i=0,flag=2; 
void setup ()
{
  Serial.begin(9600);
  
  irrecv.enableIRIn(); // Start the receiver
  
  attachInterrupt(0, falling0, FALLING);
  attachInterrupt(1, falling1, FALLING);
  
  pinMode(buzzer,OUTPUT);
  digitalWrite(buzzer,HIGH);

  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT); 
  pinMode(led4,OUTPUT);
  pinMode(led5,OUTPUT);
  for(char i=9;i<14;i++)
   digitalWrite(i,LOW);    
}
  
void loop()
{
  if(flag==0)
  {
  buzzer_();                //testing buzzer
  led_display();            //testing LED
  }
  if(flag==1)
  { 
  Serial.println("status,  Hum(%),  Tem(C)      analog_val      light_val     lm35_val");
  DHT11();
  Serial.print("          ");
  analog();                //testing analog input
  Serial.print("            ");
  Light();
  Serial.print("           ");
  LM35();
  Serial.println("          ");
  delay(800);
  }
  if(flag!=0 & flag!=1)
  {
    if (irrecv.decode(&results))
     {
       Serial.println(results.value, HEX);
       irrecv.resume(); // Receive the next value
     }  
  }
}

void DHT11()
{
int chk;
chk = DHT.read(DHT11_PIN);    // READ DATA
switch (chk)
  {
    case DHTLIB_OK:  
                Serial.print("OK        "); 
                Serial.print(DHT.humidity,1);
                Serial.print("       ");
                Serial.print(DHT.temperature,1);
                break;
    case DHTLIB_ERROR_CHECKSUM: 
                Serial.print("Checksum error        "); 
                break;
    case DHTLIB_ERROR_TIMEOUT: 
                Serial.print("Time out error        "); 
                break;
    default: 
                Serial.print("Unknown error         "); 
                break;
  }
}

void buzzer_(void)
{
 char i;  
 for(i=0;i<80;i++)// output a frequency sound
 { 
  digitalWrite(buzzer,LOW);// sound
  delay(1);//delay1ms 
  digitalWrite(buzzer,HIGH);//not sound
  delay(1);//ms delay 
 } 
 for(i=0;i<100;i++)// output a frequency sound
 { 
  digitalWrite(buzzer,LOW);// sound
  digitalWrite(buzzer,HIGH);//not sound
  delay(2);//2ms delay 
 }
}

void led_display()
{
 digitalWrite(led1,HIGH);
 delay(500);
 digitalWrite(led1,LOW);
 digitalWrite(led2,HIGH);
 delay(500);
 digitalWrite(led2,LOW);
 digitalWrite(led3,HIGH);
 delay(500);
 digitalWrite(led3,LOW);
 digitalWrite(led4,HIGH);
 delay(500);
 digitalWrite(led4,LOW);
 digitalWrite(led5,HIGH);
 delay(500);
 digitalWrite(led5,LOW);
}

void analog()
{
int val;
val=analogRead(A0);
Serial.print(val);
}

void Light()
{
int val;
val=analogRead(A1);
Serial.print(val);
}

void LM35()
{
int val;
val=analogRead(A2);
Serial.print(val);
}

void falling0()
{
flag=0;
}
void falling1()
{
flag=1;
}

Result

After powering on, indicator D1 is on, TX light on the board is blinking and indicator of LED13 is always on. Press SW1 to start flowing light and buzzer, and then open serial port. You can directly detect IR receiving without pressing buttons, the monitor displaying value. Press SW2 when opening serial port to start functions of DHT11, analog input,photosensitive device and LM35 testing,the monitor displaying value.
If you need to test again, please close serial monitor and press reset button to repeat above steps.

Resources

Download Address of Libraries:

http://7326097.s21d-7.faiusrd.com/0/ABUIABAAGAAg96rVvQUo4Oy0hQI?f=KS0183+Libraties.zip&v=1471501687

PDF Format:

https://drive.google.com/open?id=1JpWm7bxEAxZNm8ZbqsUbIhkTi0n7U4bY

Get One Now

Official Website

http://www.keyestudio.com/keyestudio-multi-purpose-shield-v1.html