thank you for the supportriaspire.com/wp-content/uploads/2018/07/mega-kit.pdf · download this...

58
RIAspire THANK YOU FOR THE SUPPORT . Tips on setting up the MEGA 2560 board if you are having problems: Install the driver located at http://www.arduined.eu/ch340g-converter- windows-7-driver-download/ for windows. Or http://kiguino.moos.io/2014/12/31/how-to-use-arduino-nano-mini-pro- with-CH340G-on-mac-osx-yosemite.html for mac. If your PC is still having issues detecting the board, try this: Download this driver file from the links above (which you already did): There will be a compressed file with two folders in it (INSTALL and CH341SER). Once you connect the board, go to device manager under control panel. Click the arrow on ports and expand it. Click update driver software and select manual install. Browse for the CH341SER folder and select it. Click OK. In the Arduino IDE, please make sure you have the following set up: Tools->Board->Arduino Genuino MEGA/MEGA2560 Tools->Programmer->AVR ISP Tools->Port->COM4 (or what that is available)

Upload: others

Post on 27-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

THANK YOU FOR THE SUPPORT

.

Tips on setting up the MEGA 2560 board if you are having problems: Install the driver located at http://www.arduined.eu/ch340g-converter-windows-7-driver-download/ for windows. Or http://kiguino.moos.io/2014/12/31/how-to-use-arduino-nano-mini-pro-with-CH340G-on-mac-osx-yosemite.html for mac. If your PC is still having issues detecting the board, try this:

Download this driver file from the links above (which you already did): There will be a compressed file with two folders in it (INSTALL and CH341SER). Once you connect the board, go to device manager under control panel. Click the arrow on ports and expand it. Click update driver software and select manual install. Browse for the CH341SER folder and select it. Click OK. In the Arduino IDE, please make sure you have the following set up: Tools->Board->Arduino Genuino MEGA/MEGA2560 Tools->Programmer->AVR ISP Tools->Port->COM4 (or what that is available)

Page 2: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Parts list and quantity to help you identify what you have.

Part Quantity Photo

Mega 2560 + USB Cable 1

UNO R3 Protoshield 1

5v DC Toy Hobby Motor 1

9g Tower Pro Servo 1

Page 3: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

5v DC Stepper Motor + ULN2003 Driver 1

Motion Sensor 1

1602 LCD with Blue Backlight 1

One Digit Digital LED Display 1

Ultrasonic Range Sensor 1

Page 4: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Four Digit Digital LED Display TM1637 1

DS3231 Real Time Clock 1

DHT11 Temperature & Humidity Sensor 1

MAX7219 8x8 Red LED Matrix 1

Sound Detection Module 1

Page 5: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

PS2 Controller Joystick 1

Remote Control & Infrared Receiver 1

1 Channel 5V Relay 1

Infrared Flame Sensor 1

RC522 RFID Card System 1

Page 6: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

4x4 Button Matrix 1

Rain + Snow Level Sensor 1

Ball / Tilt Angle Switch 1

Piezo Buzzer 1

Small Push Button 5

Page 7: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Large Push Button 2

720 Large Solderless Breadboard 1

Male-Male Breadboard Jumper Wire 65

Male-Female Jumper Wire

9V Battery Connector & Jack 1

Page 8: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

5MM LED 40

5MM RGB (red green blue) LED 5

220 Ohm Resistor 25

1k Ohm Resistor 10

10k Ohm Resistor 10

Page 9: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

1k & 10k Large Rotary Potentiometer 2

Photoresistor 5

0.1uf Ceramic Disk Capacitor 2

7HC595 Shift Register 1

2N3904 NPN Small Transistor 1

Page 10: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

TIP122 Power Transistor 1

MOSFET 1

3 Pin Slide On-Off Switch 2

Page 11: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

First things first. Here are some links that will be helpful in your Arduino endeavor. They are available online for free. Please also try googling/yahooing/Binging for other projects/examples and there will be plenty to find. Our goal is to have one file where you can find everything you ever need to learn Arduino and save some time searching online. We will keep adding more projects and resources to this file so please check back from time to time. If you have any other useful links, please let us know and we can add it in here so everyone can see. Arduino Programming Notebook http://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf

30 Arduino Projects for the Evil Genius http://www.fema.com.br/arduino/wp-content/uploads/2014/08/30.Arduino.Projects.pdf Arduino Starter Kit Manual by Earthshine Design http://math.hws.edu/vaughn/cpsc/226/docs/askmanual.pdf Intro to Arduino Book http://www.princeton.edu/~ffab/media___downloads_files/IntroArduinoBook.pdf

Page 12: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Part/Module Introduction Introduction to the parts in the Kit. Photo, quick introduction, pin connections and basic

code to get it working. The main idea here is for you to test out all the parts in the kit. If

something is wrong, let us know and we can troubleshoot for you or send a replacement if

needed.

If you would like to copy and paste code, please download the PDF file. Otherwise

you could view it in the browser window.

All the code that is presented was obtained from examples online and also from

some of the links in this document. There are also other related links in this document

so feel free to check them out.

Please let us know if there is something we should add.

Information you may need to know beforehand.

How to install the Arduino IDE

https://www.arduino.cc/en/Main/Software

How to install a library https://arduino-info.wikispaces.com/Arduino-Libraries

Steps to test a part.

1. Connect the pins following the pin connection section

2. Download any libraries if required

3. Copy and paste the code into the Arduino IDE

4. Click Upload!

5. Check Serial Monitor unless stated otherwise

6. Have fun. Don’t get stressed, if something is not working, there usually a really

silly reason. Contact us, we do provide tech support.

Page 13: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Ultrasonic Range Sensor

This example will display the distance of an object that is in front of the sensor. Readings will be

displayed on the serial monitor.

Library

http://playground.arduino.cc/Code/NewPing

Parts

Ultrasonic Range Sensor

MEGA 250 Board

4x Male-Female Jumper Cable

Pin Connections

VCC -> 5V

GND -> Ground

Trig -> Digital Pin 12

Echo -> Digital Pin 11

Page 14: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

#include <NewPing.h>

#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.

#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.

#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters).

Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {

Serial.begin(9600); //

}

void loop() {

delay(50);

unsigned int uS = sonar.ping();

Serial.print("Ping: ");

int distance = (uS / US_ROUNDTRIP_CM);

Serial.print(distance); // Convert ping time to distance in cm and print result (0 =

outside set distance range)

Serial.println("cm");

}

Page 15: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources/Projects Ultrasonic Sensor with Buzzer and LEDs

http://www.instructables.com/id/Distance-Sensor-with-LEDs-and-buzzer/

http://www.instructables.com/id/Arduino-Distance-Detector-with-a-Buzzer-and-LEDs/

Target Distance with 1602 LCD

http://www.toptechboy.com/arduino/lesson-20-arduino-lcd-project-for-measuring-distance-

with-ultrasonic-sensor/

Ultrasonic Sensor and Arduino Tutorial

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

Radar Project

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

Page 16: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Servo

We will test the servo using the Sweep example available in the Arduino IDE. Servo will move from side

to side spanning 180 degrees.

Libraries (this library is already in your Arduino IDE you will not need to download it)

https://www.arduino.cc/en/Reference/Servo

Parts

Servo

3x Male-Male Jumper Wire

Arduino-Compatible Board

Pin Connections

Red – 5V

Brown/Black – Ground

Orange/Yellow (signal pin) – Digital Pin 2

Page 17: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code (Available in the Arduino IDE. Examples->Servo->Sweep)

// include servo library

#include <Servo.h>

// create servo object to control a servo

Servo myservo;

// variable to store the starting servo position

int pos = 0;

void setup() {

// attaches the servo on digital pin 2 on the Arduino

myservo.attach(2);

}

void loop() {

// goes from 0 degrees to 180 degrees in 1 degree steps

for (pos = 0; pos <= 180; pos += 1) {

// tell servo to go to position in variable 'pos'

myservo.write(pos);

// waits 15ms for the servo to reach the position

delay(15);

}

// goes from 180 degrees to 0 degrees

for (pos = 180; pos >= 0; pos -= 1) {

// tell servo to go to position in variable 'pos'

myservo.write(pos);

// waits 15ms for the servo to reach the position

delay(15);

}

}

Page 18: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources/Projects Basically everything you need to know about servos and Arduino

https://cdn-learn.adafruit.com/downloads/pdf/adafruit-arduino-lesson-14-servo-

motors.pdf

Similar to our example for the PS2 Controller

https://www.arduino.cc/en/Tutorial/Knob

You can always get more servos and potentiometers to try this

https://www.youtube.com/watch?v=R1w-tAXVzB0

Page 19: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

PS2 Joystick Controller

We will test the PS2 Joystick and display analog readings in the serial monitor for the x and y axis. This

module is has 2 potentiometers and one built in button. When the joystick is in the center, the x and y

value will read somewhere around 450-490. Push the joystick in any direction and the x and y value will

change. When the joystick is pressed down, serial monitor will print “button = 0” and “button = 1” when

nothing is pressed.

Parts

PS2 Joystick

Arduino Compatible Board

5x Male-Female Jumper wires

Pin Connections

VCC – 5V

GND – Ground

VRX – A0

VRY – A1

SW – Digital Pin 2

Page 20: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

//declare variables for X and Y axis and also the Button

int VRXValue;

int VRYValue;

int Button;

void setup() {

//begin serial communication

Serial.begin(9600);

//declare pin number and type, A0 is for X axis, A1 is for Y axis and digital pin 2

for the button

pinMode(A0, INPUT);

pinMode(A1, INPUT);

//digital pin 2 for the button with pullup resistor enabled. The ATMEGA chip has a

built in pullup resistor for the button on the joystick

pinMode(2, INPUT_PULLUP);

}

void loop() {

//read values from pin and store into respective variables

VRXValue = analogRead(A0);

VRYValue = analogRead(A1);

Button = digitalRead(2);

//print values on serial monitor

Serial.print("x=");Serial.println(VRXValue);

Serial.print("y=");Serial.println(VRYValue);

Serial.print("button=");Serial.println(Button);

//delay for stability

delay(1000);

}

Page 21: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources/Projects Moving 2 servos with a joystick

http://www.instructables.com/id/Arduino-2-Servos-Thumbstick-joystick/

How to connect joystick to Arduino

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

Actual PS2 Controller with Arduino (pretty cool!)

http://www.billporter.info/2010/06/05/playstation-2-controller-arduino-library-v1-0/

Page 22: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

1602 LCD with Blue Backlight

We are going to test out the 1602 LCD by displaying a simple message, “Hello Super Awesome Person”.

You can also adjust the brightness with the potentiometer.

Libraries (this library should already be in your Arduino IDE, it’s called Liquid Crystal)

http://playground.arduino.cc/Main/LiquidCrystal

Parts

1x 1602 LCD

1x MEGA 2560 Board

17x Male-Male Jumper Wires

1x Breadboard

1x 1k Potentiometer

Page 23: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

LCD Pin Description (useful information)

Pin Connections

VSS – Ground

VDD – 5V

VE – Potentiometer Center Pin

4 (Register Select) – Digital Pin 8

5 (Read/Write) – Digital Pin 9

11 (Data 4) – Digital Pin 4

12 (Data 5) – Digital Pin 5

13 (Data 6) – Digital Pin 6

14 (Data 7) – Digital Pin 7

15 (Backlight Anode) – 5V

Page 24: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

16 (Backlight Cathode) – Ground

See diagram below. Please note that the breadboard we provide is a little different from the diagram.

The breadboard in the photo has 2 rails on both sides and ours has only one. We went ahead and use

the top rail as positive (5v) and the bottom rail as negative (ground).

Code

// include the library code:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

}

void loop() {

// set the cursor to column 0, line 0

// (note: line 0 is the first row, since counting begins with 0):

lcd.setCursor(0, 0);

lcd.print("HELLO SUPER");

lcd.setCursor(0, 1);

lcd.print("AWESOME PERSON:)");

}

Page 25: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources/Projects Basic tutorial on hooking up the LCD and Arduino

http://www.allaboutcircuits.com/projects/interface-an-lcd-with-an-arduino/

Creating custom characters with 1602 LCD

https://www.arduino.cc/en/Reference/LiquidCrystalCreateChar

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

1602 LCD with Light Sensor

http://www.dreamdealer.nl/tutorials/connecting_a_1602a_lcd_display_and_a_light_sensor_to_arduino

_uno.html

Arduino + LCD for stopwatch project

https://caesarandlouie.wordpress.com/2014/12/06/arduino-1602-lcd-stopwatch-project/

Page 26: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

MAX7219 LED Matrix

Let’s go ahead and test the LED matrix out. Note that this module comes with the MAX7219 Control

Chip which requires a library to use. The code below will just display a simple smiley face.

Library

https://github.com/wayoda/LedControl

Parts

MAX7219 LED Matrix

5 Male-Female Jumper Wires

MEGA 2560 Board

Pin Connections (on side closes to the MAX7219 Chip)

VCC – 5V

GND – Ground

CLK – Digital Pin 11

CS – Digital Pin 10

DIN – Digital Pin 12

Page 27: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Some notes about the code:

To turn a single led on, use this code

lc.setLed(0, col, row, true);

to turn on the LED on the top right corner

lc.setLed(0, 0, 0, true);

to turn on the LED on the bottom left corner

lc.setLed(0, 7, 7, true);

Remember, the first row or column is set by using the number 0. Row or column 8 is set with number 7.

The code below will display a smiley face. We are just turning the individual LEDs on to make the smiley

face.

Page 28: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

//Include the library

#include "LedControl.h"

//assign pins

LedControl lc=LedControl(12,11,10,1);

//wait between updates of the display

unsigned long delaytime=100;

void setup() {

//The MAX72XX is in power-saving mode on startup, so 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);

}

void loop(){

//mouth

lc.setLed(0, 0, 6, true);

lc.setLed(0, 1, 6, true);

lc.setLed(0, 2, 6, true);

lc.setLed(0, 3, 6, true);

lc.setLed(0, 4, 6, true);

lc.setLed(0, 5, 6, true);

lc.setLed(0, 6, 6, true);

lc.setLed(0, 7, 6, true);

lc.setLed(0, 0, 5, true);

lc.setLed(0, 7, 5, true);

//right eye

lc.setLed(0, 1, 1, true);

lc.setLed(0, 1, 2, true);

lc.setLed(0, 2, 1, true);

lc.setLed(0, 2, 2, true);

//left eye

lc.setLed(0, 5, 1, true);

lc.setLed(0, 5, 2, true);

lc.setLed(0, 6, 1, true);

lc.setLed(0, 6, 2, true);

}

Page 29: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources/Projects LCD matrix with Arduino

http://www.instructables.com/id/LED-Matrix-with-Arduino/

How to use 8x8 LED matrix with Arduino

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

How to scroll text using multiple LED Matrix modules

https://brainy-bits.com/tutorials/scroll-text-using-the-max7219-led-dot-matrix/

Arduino Pong with MED matrix (you can pull the LED matrix out from its mount)

http://www.itopen.it/arduino-pong-with-8x8-led-matrix-and-max7219/

Page 30: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

DHT11 Temperature and Humidity Sensor

We will test the DHT11 temperature sensor and display the temperature and humidity in the serial

monitor.

Libraries

https://github.com/adafruit/DHT-sensor-library

Parts

DHT11 temperature sensor

Arduino-Compatible Board

3x Male-Female Jumper Wire

Pin Connections

VCC- 5V

GND – Ground

DATA – Digital Pin 2

Code

Page 31: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

// Example testing sketch for various DHT humidity/temperature sensors

// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 2 // what digital pin we're connected to

// Uncomment whatever type you're using!

#define DHTTYPE DHT11 // DHT 11

//define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321

//#define DHTTYPE DHT21 // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);

Serial.println("DHTxx test!");

dht.begin();

}

void loop() {

// Wait a few seconds between measurements.

delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

float h = dht.readHumidity();

// Read temperature as Celsius (the default)

float t = dht.readTemperature();

// Read temperature as Fahrenheit (isFahrenheit = true)

float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).

if (isnan(h) || isnan(t) || isnan(f)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

// Compute heat index in Fahrenheit (the default)

float hif = dht.computeHeatIndex(f, h);

// Compute heat index in Celsius (isFahreheit = false)

float hic = dht.computeHeatIndex(t, h, false);

Serial.print("Humidity: ");

Serial.print(h);

Serial.print(" %\t");

Serial.print("Temperature: ");

Serial.print(t);

Serial.print(" *C ");

Serial.print(f);

Serial.print(" *F\t");

Serial.print("Heat index: ");

Serial.print(hic);

Serial.print(" *C ");

Serial.print(hif);

Serial.println(" *F");

}

Additional Resources/Projects

Page 32: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Simple DHT11 hookup to Arduino

http://www.hobbyist.co.nz/?q=documentations/wiring-up-dht11-temp-humidity-sensor-to-

your-arduino

https://arduino-info.wikispaces.com/PROJECT-Temp-Humidity-Display

Display temperature with web interface

http://www.instructables.com/id/Arduino-TempHumidity-with-LCD-and-Web-

Interface/

Weather station over internet and data analysis (ESP8266 Wifi Module Required)

http://www.internetoflego.com/weather-station-dht11-mqtt-node-red-google-chart-oh-

my/

Humidity and Temperature measurement with Arduino

http://circuitdigest.com/microcontroller-projects/arduino-humidity-measurement

Tweeting Thermostat

https://www.hackster.io/gatoninja236/tweeting-thermostat-with-arduino-e3eda0

Control fan speed with Arduino and DHT11

http://www.electroschematics.com/9540/arduino-fan-speed-controlled-temperature/

Page 33: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

DS3231 Real Time Clock

We will test this clock to display the time and date and day in the serial monitor. This device stores the

time, date and day of week once it is set. This means you can unplug the power cord and the clock will

still keep counting.

Libraries

http://www.rinkydinkelectronics.com/library.php?id=73

Parts

DS3231 Clock

4x Male-Female Jumper Wires

MEGA 2560 Board

Pin Connections

VCC – 5V

GND – Ground

SDA – Digital Pin 20

SCL – Digital Pin 21

Ignore other pins

Page 34: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Note that the photo of the clock module in the diagram below is different from the module you have. Its

ok, just make sure the pins are connected following the section above.

Page 35: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code (Don’t forget to set the day, time and date in the void setup() section)

#include <DS3231.h>

// Initialize the DS3231 using the hardware interface

DS3231 rtc(SDA, SCL);

void setup()

{

// Setup Serial connection

Serial.begin(9600);

// Initialize the rtc object

rtc.begin();

// Set the Day, Time and Date here

rtc.setDOW(WEDNESDAY); // Set Day-of-Week WEDNESDAY

rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)

rtc.setDate(1, 1, 2014); // Set the date to January 1st, 2014

}

void loop()

{

// Send Day-of-Week

Serial.print(rtc.getDOWStr());

Serial.print(" ");

// Send date

Serial.print(rtc.getDateStr());

Serial.print(" -- ");

// Send time

Serial.println(rtc.getTimeStr());

// Wait one second before repeating :)

delay (1000);

}

Page 36: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

IR Flame Sensor

The Flame sensor is useful for determining the status, distance, or intensity of a flame. Whether it be a

pilot light on a water heater or the intensity of a campfire.

How it works – the IR Diode converts a flame’s light into a voltage (much like a solar cell). This low

voltage is amplified by the comparator which also triggers the Digital pin after the flame reaches a

certain intensity set by the user (with the built in potentiometer).

Power – 5v or 3.3v

Signal Type –

Analog Read – Connecting the flame sensors analog pin to any analog pin on the Arduino is

useful for determining the exact distance or intensity of a flame.

Digital Read – Connecting the flame sensors digital pin to the Arduino to know when the

intensity has hit a certain point. Useful if running out of analog pins on the Arduino or just

wanting to know when a flame has occurred.

Data Type –

Analog Read – Integer (values 0-1023)

Digital – Boolean

Pros – Simple to use, repeatable, directional.

Cons – Limited distance, nonlinear output

Projects and Uses – Monitor a Pilot Light, Flame detection if a stove or furnace is on

Page 37: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Lets test it out.

Parts

IR Flame Sensor

3x Male-Female Jumper Wire

Mega 2560 Board

Lighter

Pin Connections

VCC - 5V

GND-> Ground on UNO

D0-> Digital Pin 2 (Any digital pin will work)

Ignore the A0 Pin for now

Page 38: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

int FlameSensorPin = 2;

int FlameSensor;

void setup() {

Serial.begin(9600);

pinMode(FlameSensor, INPUT);

pinMode(13, OUTPUT);

}

void loop() {

FlameSensor = digitalRead(FlameSensorPin);

Serial.println(FlameSensor);

digitalWrite(13,FlameSensor);

delay(1); // delay in between reads for stability

}

Page 39: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

4 Digit Display TM1637

Lets’ test out the 4 digit display. We will set a random number to be displayed.

Libraries (there are multiple libraries for this device, we are using the avishorp library)

https://github.com/avishorp/TM1637

Parts

4 Digit Display Tm1637

Mega 2560 Board

4x Male-Female Jumper Wires

Pin Connections

VCC – 5V

GND – Ground

CLK – Digital Pin 2

DIO – Digital Pin 3

Page 40: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

#include <TM1637Display.h>

const int CLK = 2; //Set the CLK pin connection to the display

const int DIO = 3; //Set the DIO pin connection to the display

int setnumber;

TM1637Display display(CLK, DIO); //set up the 4-Digit Display.

void setup()

{

display.setBrightness(0x0a); //set the diplay to maximum brightness

}

void loop()

{

setnumber = 1234; //set the number to display here

display.showNumberDec(setnumber); //Display the Variable value;

}

Page 41: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

4x4 Button Matrix

This test will try all the buttons on the matrix. When you press a button, it will display the button that is

pressed on the serial monitor assigned in the diagram. You can always change the assignments on them.

Library

http://playground.arduino.cc/Code/Keypad

Parts

4x4 Button Matrix

Mega 2560 Board

8x Male Female Jumper Wires

Pin Connections

1 – Digital Pin 21

2 – Digital Pin 20

3 – Digital Pin 19

4 – Digital Pin 18

5 – Digital Pin 17

6 – Digital Pin 16

7 – Digital Pin 15

8 – Digital Pin 14

Page 42: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

#include <Keypad.h>

const byte numRows= 4; //number of rows on the keypad

const byte numCols= 4; //number of columns on the keypad

//keymap defines the key pressed according to the row and columns just as appears on

the keypad

char keymap[numRows][numCols]=

{

{'D', '#', '0', '*'},

{'C', '9', '8', '7'},

{'B', '6', '5', '4'},

{'A', '3', '2', '1'}

};

//Code that shows the the keypad connections to the arduino terminals

byte rowPins[numCols] = {21,20,19,18}; //Rows 0 to 3

byte colPins[numRows]= {17,16,15,14}; //Columns 0 to 3

//initializes an instance of the Keypad class

Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup()

{

Serial.begin(9600);

}

//If key is pressed, this key is stored in 'keypressed' variable

//If key is not equal to 'NO_KEY', then this key is printed out

//if count=17, then count is reset back to 0 (this means no key is pressed during the

whole keypad scan process

void loop()

{

char keypressed = myKeypad.getKey();

if (keypressed != NO_KEY)

{

Serial.print(keypressed);

}

}

Page 43: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

IR Remote and Receiver

Let’s test the IR remote. We will press a button on the remote and the serial monitor will display the

button that was pressed.

Libraries

https://github.com/z3t0/Arduino-IRremote

How to install library

https://arduino-info.wikispaces.com/Arduino-Libraries

Pin Connections for the Receiver (little module with 3 pins and a receiver soldered on)

VCC – 5V

GND – Ground

D0 – Digital Pin 11

Page 44: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

#include "IRremote.h"

/*-----( Declare Constants )-----*/

int receiver = 11; // pin 1 of IR receiver to Arduino digital pin 11

/*-----( Declare objects )-----*/

IRrecv irrecv(receiver); // create instance of 'irrecv'

decode_results results; // create instance of 'decode_results'

/*-----( Declare Variables )-----*/

void setup() /*----( SETUP: RUNS ONCE )----*/

{

Serial.begin(9600);

Serial.println("IR Receiver Raw Data + Button Decode Test");

irrecv.enableIRIn(); // Start the receiver

}/*--(end setup )---*/

void loop() /*----( LOOP: RUNS CONSTANTLY )----*/

{

if (irrecv.decode(&results)) // have we received an IR signal?

{

// Serial.println(results.value, HEX); UN Comment to see raw values

translateIR();

irrecv.resume(); // receive the next value

}

}/* --(end main loop )-- */

/*-----( Declare User-written Functions )-----*/

void translateIR() // takes action based on IR code received

// describing Car MP3 IR codes

{

switch(results.value)

{

case 0xFFA25D:

Serial.println(" CH- ");

break;

case 0xFF629D:

Serial.println(" CH ");

break;

case 0xFFE21D:

Serial.println(" CH+ ");

break;

case 0xFF22DD:

Serial.println(" PREV ");

break;

case 0xFF02FD:

Serial.println(" NEXT ");

break;

Page 45: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code continues..

case 0xFFC23D:

Serial.println(" PLAY/PAUSE ");

break;

case 0xFFE01F:

Serial.println(" VOL- ");

break;

case 0xFFA857:

Serial.println(" VOL+ ");

break;

case 0xFF906F:

Serial.println(" EQ ");

break;

case 0xFF6897:

Serial.println(" 0 ");

break;

case 0xFF9867:

Serial.println(" 100+ ");

break;

case 0xFFB04F:

Serial.println(" 200+ ");

break;

case 0xFF30CF:

Serial.println(" 1 ");

break;

case 0xFF18E7:

Serial.println(" 2 ");

break;

case 0xFF7A85:

Serial.println(" 3 ");

break;

case 0xFF10EF:

Serial.println(" 4 ");

break;

case 0xFF38C7:

Serial.println(" 5 ");

break;

case 0xFF5AA5:

Serial.println(" 6 ");

break;

case 0xFF42BD:

Serial.println(" 7 ");

break;

case 0xFF4AB5:

Serial.println(" 8 ");

break;

Page 46: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code continues..

case 0xFF52AD:

Serial.println(" 9 ");

break;

default:

Serial.println(" other button ");

}

delay(500);

} //END translateIR

Page 47: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Sound Sensor

We are testing the Sound Sensor with Digital Input by displaying the result on the serial monitor whena

sound is detected. When the sensor detects a sound, the serial monitor will print 1 and when there is no

sound, it will print 0.

Parts

Sound Sensor

3x Male-Female Jumper Wire

Mega 2560 Board

Pin Connections

VCC->5V on UNO

GND-> Ground on UNO

OUT-> Any Digital Pin (Pin 2 in this example)

Page 48: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

int SoundSensorPin = 2;

int SoundSensor;

void setup() {

Serial.begin(9600);

pinMode(SoundSensorPin, INPUT);

pinMode(13, OUTPUT);

}

void loop() {

SoundSensor = digitalRead(SoundSensorPin);

Serial.println(SoundSensor);

digitalWrite(13,SoundSensor);

delay(1); // delay in between reads for stability

}

Page 49: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

RC 522 RFID Card System

We are going to test out the RFID Card System. You will need to solder some headers on the receiver.

How it works – RFID stands for Radio Frequency Identification.

Signal Type – Digital

Data Type – Boolean

Pros – repeatable, each card has unique ID, allow multiple users access to a system

Cons – Code requires library to use

Library

https://github.com/miguelbalboa/rfid

Parts

1x RFID Reader

1x Card

1x FOB Keychain

7x Male-Female Jumper Wires

1x Mega 2560 Arduino-Compatible Board

Page 50: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Card Reader Connection

3.3V – 3.3V

GND – GND

SDA – Digital Pin 53

SCK – Digital Pin 52

MOSI – Digital Pin 51

MISO – Digital Pin 50

RST – 5

Ignore IRQ Pin

Code

Directions for the code. Once you have connected the reader, upload this code. Open the serial monitor

and swipe your card/keychain. The serial monitor will say “access denied” and also print the UID tag.

This happens because it does not know the ID for the card you are scanning. The UID Card that was

printed on the serial monitor is the ID for the card you swiped. Now go into the code and insert that UID

where is says “PLACE UID HERE”, leaving the quotations in place. The system should recognize the card

you are using now.

Page 51: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

#include <SPI.h>

#include <MFRC522.h>

#define SS_PIN 53

#define RST_PIN 5

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

void setup()

{

Serial.begin(9600); // Initiate a serial communication

SPI.begin(); // Initiate SPI bus

mfrc522.PCD_Init(); // Initiate MFRC522

Serial.println("Place your card or FOB keychain on the card reader");

Serial.println();

}

void loop()

{

// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent())

{

return;

}

// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial())

{

return;

}

//Show UID on serial monitor

Serial.print("UID tag :");

String content= "";

byte letter;

for (byte i = 0; i < mfrc522.uid.size; i++)

{

Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");

Serial.print(mfrc522.uid.uidByte[i], HEX);

content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));

content.concat(String(mfrc522.uid.uidByte[i], HEX));

}

Serial.println();

Serial.print("Message : ");

content.toUpperCase();

if (content.substring(1) == "PLACE CARD UID HERE")

//insert the UID of the card you swiped up here

{

Serial.println("Authorized access");

Serial.println();

delay(3000);

}

else {

Serial.println(" Access denied");

Serial.println();

delay(3000);

}

}

Page 52: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

5V DC Stepper Motor

https://arduino-info.wikispaces.com/SmallSteppers

Page 53: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

5V Relay

Let’s test the relay out. All we are going to do is turn it on or off. When it’s on, the green LED on the

relay will light up. Code is the same as the blink example.

Parts Needed

Relay

3x Male-Female Jumper Wires

MEGA 2560 Board

Pin Connections

VCC – 5V

GND – Ground

In – Digital Pin 2 (or any digital pin)

Page 54: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Code

// the setup function runs once when you press reset or power the board

void setup() {

// initialize digital pin 2 as an output.

pinMode(2, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(2, HIGH); // turn the relay on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(2, LOW); // turn the relay off by making the voltage LOW

delay(1000); // wait for a second

}

Page 55: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Additional Resources

Video tutorials for Arduino setup and coding introduction Tutorial 01: Hardware Overview: Arduino Course for Beginners https://www.youtube.com/watch?v=09zfRaLEasY

Tutorial 02: Download and install the Arduino IDE: Arduino Course for Beginners https://www.youtube.com/watch?v=w55Pd4dU5-w

Tutorial 03: Arduino IDE and Sketch Overview: Arduino Course for Beginners https://www.youtube.com/watch?v=YDkdVZ7e3OY

Tutorial 04: Understanding Arduino Syntax: Arduino Course for Beginners https://www.youtube.com/watch?v=AJkEQ9t4WfY

Tutorial 05: Understanding Variables: Arduino Course for Beginners https://www.youtube.com/watch?v=QNTaQ5qjniE

Tutorial 06: How to Blink an LED: Arduino Course for Beginners https://www.youtube.com/watch?v=33sNhlekRV8

Tutorial 07: digitalRead() and the Serial Port: Arduino Course for Beginners https://www.youtube.com/watch?v=CIrN2CaO6bo

Tutorial 08: analogRead() and the Serial Port: Arduino Course for Beginners https://www.youtube.com/watch?v=CPMQSXrsaO8

Tutorial 09: How to read voltages with analogRead(): Arduino Course for Beginners https://www.youtube.com/watch?v=_H16GYL08Ik

Tutorial 10: Fade an LED: Arduino Course for Beginners https://www.youtube.com/watch?v=wpTqiEcHwwQ Tutorial 11: If Statement Conditionals: Arduino Course for Beginners https://www.youtube.com/watch?v=w-yfj1VXW8I Tutorial 12: For Loop Iteration: Arduino Course for Beginners https://www.youtube.com/watch?v=bMsT8FeMQ-k Arduino Library (1) https://www.youtube.com/watch?v=fsMg6F6yYlo Arduino Library (2) https://www.youtube.com/watch?v=171RSh0az5A

Page 56: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Let’s start with the LEDs: Arduino Tutorial #1 - Digital Inputs and Outputs - Button & LED https://www.youtube.com/watch?v=YWY_Is0L7fE Note: We provide 220 ohms resistors for the LEDs and 10K ohm resistors for the buttons. Without a resistor, an LED would burn due to the access current going through the LED(resistors limit the amount of current that flows through a circuit). Now let’s us discover an RGB (Red Green Blue) LEDs https://www.youtube.com/watch?v=Q72DvmcCe4I 74HC595 shift register with LEDs https://www.youtube.com/watch?v=bqfPZXEuyuc 74HC595 shift register with 7 segment LEDs https://www.youtube.com/watch?v=cHA-fwiA4Qo IR Remote sensor with 7 segment LEDs https://www.youtube.com/watch?v=caMW1RRPOGE Note: the IR configuration is different from what we have. However they share the same ideas. You can find the link for the code under the video. Photo sensor/Photo resistor (Photo cell in the video) with LED https://www.youtube.com/watch?v=vfn02TZDl_Q Now we can try and play with the LED Matrix to do more cool stuff. https://www.youtube.com/watch?v=TOuKnOG8atk Servo https://www.youtube.com/watch?v=TmpGXfVRd2A Potentiometer with Servo https://www.youtube.com/watch?v=xWjkuYSQcoI Joystick https://www.youtube.com/watch?v=MlDi0vO9Evg Servo could also be controlled using the Joy stick analog input signal, just like the Potentiometer with Servo example above. Stepper Motor and ULN2003 Driver https://www.youtube.com/watch?v=B86nqDRskVU

Page 57: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

Flame Sensor http://www.himix.lt/?p=644 Note: The video used an Arduino Nano board. The code can be also used with the Uno. You could hook up the piezo buzzer to test the sensor with a lighter. Here is how a piezo buzzer works https://www.youtube.com/watch?v=0ELhkUkVOXo DHT 111 Temperature Sensor https://www.youtube.com/watch?v=OogldLc9uYc DS3231 Clock module https://www.youtube.com/watch?v=q4gV1Y28Ywg Note: Library needed for this module You can also use the 1602 LCD to display the time and temperature (super cool!) Here is an intro to using the 1602 LCD (other resolution LCD’s work the same way). Intro to using LCDs with Arduino | Video #1 | Liquid Crystal Display and Arduino Series https://www.youtube.com/watch?v=dvfaKXV9Lpk Setting up LCDs with Arduino | Video #2 | Liquid Crystal Display and Arduino Series https://www.youtube.com/watch?v=WlhqhmCwXXc Arduino LCD Library Functions (Part A) | Video #3 | Liquid Crystal Display and Arduino Series https://www.youtube.com/watch?v=bHGEoC-sLf4 Arduino LCD Library Functions (Part B) | Video #4 | Liquid Crystal Display and Arduino Series https://www.youtube.com/watch?v=XQTYpvrsIg8

Rain level sensor:

https://www.youtube.com/watch?v=uDdiMMdVb90 RC522 RFID Card Module https://www.youtube.com/watch?v=XJjOZpdOcqk

Page 58: THANK YOU FOR THE SUPPORTriaspire.com/wp-content/uploads/2018/07/Mega-Kit.pdf · Download this driver file from the links above (which you already did): There will be a compressed

RIAspire

4x4 Keypad Matrix Download the library here: http://playground.arduino.cc/Code/Keypad#Example

More resources. Some of these links will have tutorials on some parts that are not in your kit.

Arduino Programming Notebook http://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf

30 Arduino Projects for the Evil Genius http://www.fema.com.br/arduino/wp-content/uploads/2014/08/30.Arduino.Projects.pdf Arduino Starter Kit Manual by Earthshine Design http://math.hws.edu/vaughn/cpsc/226/docs/askmanual.pdf Intro to Arduino Book http://www.princeton.edu/~ffab/media___downloads_files/IntroArduinoBook.pdf Any questions on these tutorials and videos are highly welcome.

Also please subscribe, share or like the videos you find here as the creators of these tutorials work

hard to make our lives easier.

If you find these videos hard to follow, there are many other tutorials out there that you can use

as well. Google is your friend and we can help too.

Happy creating!