Ks0190 keyestudio Environment Monitoring Kit

From Keyestudio Wiki
Revision as of 16:01, 26 August 2016 by Keyestudio (talk | contribs) (Created page with "==keyestudio Environment Monitoring Kit== <br>500px|frameless|thumb<br> ==1. Kit Introduction== keyestudio Environment Monitoring Kit is the latest env...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

keyestudio Environment Monitoring Kit


thumb

1. Kit Introduction

keyestudio Environment Monitoring Kit is the latest environmental study kit which is developed by keyestudio. It greatly lowers the difficulty in program learning for enthusiasts. All computer language and professional grammars of a program can be simplified into blocks. Compiling is as easy as block building. Interactive with Arduino development board, they can achieve exciting works.

The open source feature of Arduino makes it extremely popular. You can find a many learning communities on the Internet. Ardublock is a programming environment, just like blocks building, which greatly lowers the learning difficulty for starters. As long as you love it, everyone can play with Arduino without professional knowledge or relevant background. As for parents who stress on the education of next generation, this will be one of your best way to interact with your children.


2. Project List

Project 1: Hello Word!
Project 2: LED Blinking
Project 3: PWM Light Control
Project 4: Traffic Light
Project 5: LED Chasing Effect
Project 6: Button-controlled LED
Project 7: Responder
Project 8: Active Buzzer
Project 9: Passive Buzzer
Project 10: RGB LED
Project 11: Analog Value Reading
Project 12: 74HC595
Project 13: 1-digit LED Segment Displays
Project 14: 4-digit LED Segment Displays
Project 15: 8*8 LED Dot Matrix

Projects of Modules
Project 1 LED Blinking
Project 2 Active Buzzer Module
Project 3 Soil Module
Project 4 Vapor Sensor
Project 5 MQ 135 Gas Sensor
Project 6 PIR Motion Sensor
Project 7 GUVA-S12SD 3528 Ultraviolet Sensor
Project 8 TEMT6000 Ambient Light Sensor
Project 9 DHT11 Temperature and Humidity Sensor
Project 3 GP2Y10 Dust Sensor
Project 11 I2C1602 Liquid Crystal Display Module
Project 12 Ambient Light Sensor to Control Brightness of LED
Project 13 Ultraviolet Sensor to Alarm
Project 14 Displaying Temperature and Humidity on LCD


3. Project Details

Project 1: Hello World

Introduction:

As for starters, we will begin with something simple. In this project, you only need an Arduino and a USB cable to start the "Hello World!" experiment. This is a communication test of your Arduino and PC, also a primer project for you to have your first try of the Arduino world!

Hardware Required:
1. Arduino board x1
2. USB cable x1

Sample Code:
After installing driver for Arduino, let's open Arduino software and compile code that enables Arduino to print "Hello World!" under your instruction. Of course, you can compile code for Arduino to continuously echo "Hello World!" without instruction. A simple If () statement will do the instruction trick. With the onboard LED connected to pin 13, we can instruct the LED to blink first when Arduino gets an instruction and then print "Hello World!”.

int val;//define variable val
int ledpin=13;// define digital interface 13
void setup()
{
  Serial.begin(9600);// set the baud rate at 9600 to match the software set up. When connected to a specific device, (e.g. bluetooth), the baud rate needs to be the same with it.
  pinMode(ledpin,OUTPUT);// initialize digital pin 13 as output. When using I/O ports on an Arduino, this kind of set up is always needed.
}
void loop()
{
  val=Serial.read();// read the instruction or character from PC to Arduino, and assign them to Val.
  if(val=='R')// determine if the instruction or character received is “R”.
  {  // if it’s “R”,    
    digitalWrite(ledpin,HIGH);// set the LED on digital pin 13 on. 
    delay(500);
    digitalWrite(ledpin,LOW);// set the LED on digital pin 13 off.    delay(500);
    Serial.println("Hello World!");// display“Hello World!”string.
  }
}

Result:
Screenshot


thumb

Click serial port monitor
Input R
LED 13 will blink once;
PC will receive information from Arduino: Hello World


thumb

After you choosing the right port, the experiment should be easy for you!


Project 2: LED Blinking

Introduction:

Blinking LED experiment is quite simple. In the "Hello World!" program, we have come across LED. This time, we are going to connect an LED to one of the digital pins rather than using LED13, which is soldered to the board. Except an Arduino and an USB cable, we will need extra parts as below:

Hardware Required:
1. Red M5 LED*1
2. 220Ω resistor*1
3. Breadboard*1
4. Breadboard jumper wires* several

We follow below diagram from the experimental schematic link. Here we use digital pin 10. We connect LED to a 220 ohm resistor to avoid high current damaging the LED.

Connection for UNO R3:
thumb

Connection for 2560 R3:
thumb

Sample Code:

int ledPin = 10; // define digital pin 10.
void setup()
{
pinMode(ledPin, OUTPUT);// define pin with LED connected as output.
}
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on.
delay(1000); // wait for a second.
digitalWrite(ledPin, LOW); // set the LED off.
delay(1000); // wait for a second
}

Result:
After downloading this program, in the experiment, you will see the LED connected to pin 10 turning on and off, with an interval approximately one second. The blinking LED experiment is now completed. Thank you!


Project 3: PWM Light Control

Introduction:

PWM, short for Pulse Width Modulation, is a technique used to encode analog signal level into digital ones. A computer cannot output analog voltage but only digital voltage values such as 0V or 5V. So we use a high resolution counter to encode a specific analog signal level by modulating the duty cycle of PMW. The PWM signal is also digitalized because in any given moment, fully on DC power supply is either 5V (ON), or 0V (OFF). The voltage or current is fed to the analog load (the device that uses the power) by repeated pulse sequence being ON or OFF. Being on, the current is fed to the load; being off, it's not. With adequate bandwidth, any analog value can be encoded using PWM. The output voltage value is calculated via the on and off time. Output voltage = (turn on time/pulse time) * maximum voltage value

thumb
PWM has many applications: lamp brightness regulating, motor speed regulating, sound making, etc. The following are the three basic parameters of PMW:
thumb
1. The amplitude of pulse width (minimum / maximum)
2. The pulse period (The reciprocal of pulse frequency in 1 second)
3. The voltage level(such as:0V-5V)
There are 6 PMW interfaces on Arduino, namely digital pin 3, 5, 6, 9, 10, and 11. In previous experiments, we have done "button-controlled LED", using digital signal to control digital pin, also one about potentiometer. This time, we will use a potentiometer to control the brightness of the LED.
Hardware Required:
1. Potentiometer*1
2. Red M5 LED*1
3. 220Ω resistor
4. Breadboard*1
5. Breadboard jumper wires*several

The input of potentiometer is analog, so we connect it to analog port, and LED to PWM port. Different PWM signal can regulate the brightness of the LED.
Connection for UNO R3:
thumb

Sample Code:
In the program compiling process, we will use the analogWrite (PWM interface, analog value) function. In this experiment, we will read the analog value of the potentiometer and assign the value to PWM port, so there will be corresponding change to the brightness of the LED. One final part will be displaying the analog value on the screen. You can consider this as the "analog value reading" project adding the PWM analog value assigning part. Below is a sample program for your reference.

int potpin=0;// initialize analog pin 0
int ledpin=11;//initialize digital pin 11(PWM output)
int val=0;// Temporarily store variables' value from the sensor
void setup()
{
pinMode(ledpin,OUTPUT);// define digital pin 11 as “output”
Serial.begin(9600);// set baud rate at 9600
// attention: for analog ports, they are automatically set up as “input”
}
void loop()
{
val=analogRead(potpin);// read the analog value from the sensor and assign it to val
Serial.println(val);// display value of val
analogWrite(ledpin,val/4);// turn on LED and set up brightness(maximum output of PWM is 255)
delay(10);// wait for 0.01 second
}


thumb
Result:
After downloading the program, when we rotate the potentiometer knob, we can see changes of the displaying value, also obvious change of the LED brightness on the breadboard.