1. Arduino universal remote

Similar documents
C4DI Arduino tutorial 4 Things beginning with the letter i

Connecting Arduino to Processing a

IR Communication a learn.sparkfun.com tutorial

Lab 6 Introduction to Serial and Wireless Communication

Arduino Lesson 5. The Serial Monitor

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 16. Stepper Motors

Lecture 7: Programming for the Arduino

Arduino Lesson 1. Blink

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Arduino Internet Connectivity: Maintenance Manual Julian Ryan Draft No. 7 April 24, 2015

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Arduino Lesson 14. Servo Motors

Electronic Brick of Current Sensor

Tutorials for Arduino

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

ANDROID BASED FARM AUTOMATION USING GR-SAKURA

Home Security System for Automatic Doors

DEPARTMENT OF ELECTRONICS ENGINEERING

Arduino Microcontroller Guide W. Durfee, University of Minnesota ver. oct-2011 Available on-line at

Servo Motor API nxt_motor_get_count nxt_motor_set_count nxt_motor_set_speed

Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter)

MeshBee Open Source ZigBee RF Module CookBook

Programming the Arduino

Internet of Things with the Arduino Yún

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Wireless Communication With Arduino

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

MANUAL FOR RX700 LR and NR

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

Basic Pulse Width Modulation

Arduino Shield Manual

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

How To Control A Car With A Thermostat

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Software Manual RS232 Laser Merge Module. Document # SU Rev A

The Answer to the 14 Most Frequently Asked Modbus Questions

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Controlling a Dot Matrix LED Display with a Microcontroller

DS1307 Real Time Clock Breakout Board Kit

HANDLING SUSPEND MODE ON A USB MOUSE

CanSat Program. Stensat Group LLC

Arduino-Based Dataloggers: Hardware and Software David R. Brooks Institute for Earth Science Research and Education V 1.2, June, , 2015

Modbus and ION Technology

Measuring Resistance Using Digital I/O

A Practical Guide to Free Energy Devices

Arduino ADK Back. For information on using the board with the Android OS, see Google's ADK documentation.

Current Loop Tuning Procedure. Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) General Procedure AN-015

RS-485 Protocol Manual

Introduction to Arduino

User Manual. AS-Interface Programmer

GM862 Arduino Shield

Arduino DUE + DAC MCP4922 (SPI)

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

ZX-NUNCHUK (# )

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

Modbus and ION Technology

Pulse Width Modulation

AirCasting Particle Monitor Bill of Materials

Work with Arduino Hardware

Computer Architectures

Arduino Shield Manual

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows:

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Digital and Analog I/O

H-Bridge Motor Control

Modern Robotics, Inc Core Device Discovery Utility. Modern Robotics Inc, 2015

Arduino Lesson 17. Sending Movement Detector

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

Arduino Library for the Pololu QTR Reflectance Sensors

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

DK40 Datasheet & Hardware manual Version 2

Arduino Lesson 4. Eight LEDs and a Shift Register

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

Ocean Controls RC Servo Motor Controller

UPiS - Uninterruptible Power intelligent Supply

Chapter 6: From Digital-to-Analog and Back Again

Electronics 5: Arduino, PWM, Mosfetts and Motors

Introduction to Arduino

STIM202 Evaluation Kit

Accurate Measurement of the Mains Electricity Frequency

Arduino/Seeeduino, Arduino Mega, and Seeeduino Mega compatible 2.8 Size QVGA Display Resistive Touch Screen

FFT Frequency Detection on the dspic

Sending an SMS with Temboo

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

ABB Drives. User s Manual HTL Encoder Interface FEN-31

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

Embedded Systems Design Course Applying the mbed microcontroller

Advanced LED Controller (LED Chaser)

What is a multimeter?

Specification: 1 Specification

Wireless Security Camera with the Arduino Yun

Special Lecture. Basic Stamp 2 Programming. (Presented on popular demand)

BT LE RFID Reader v1.0

LCD I 2 C/Serial RX Backpack. Data Sheet. LCD to I2C/Serial RX Backpack I2C or Serial RX communication with Standard 16 Pin LCD modules

Transcription:

Arduino Projects from theorycircuit.com April 2016-top 5 1. Arduino universal remote Source:: http://www.theorycircuit.com/arduino-universal-remote/ By using arduino and IR Receiver TSOP 1738 (in our project, you can use any ir receiver available) we can decode any infrared remote code into hex or some other format. Before constructing the circuit check datasheet of IR receiver having in your hand, hence you can connect proper bias pins and output pin. (IR = Infra Red light)

Circuit Diagram To read the IR rays from remote control by arduino board we need external library that is IRremote library, you can get IRremote library here. (how to insert new library in arduino IDE) In this project first we have executed the IRrecvDemo example program from the arduino IR library example and decoded IR rays from remote. (Note: If you have any error while running this library, remove IRremoteTools.cpp from libraries\robotirremote\irremotetools.cpp) Arduino Code for Receiving IR as Hex code #include <IRremote.h> int RECV_PIN = 11; IRrecv irrecv(recv_pin); decode_results results; void setup()

{ Serial.begin(9600); irrecv.enableirin(); // Start the receiver void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); // Receive the next value Screenshot Then we used decoded data as switching condition in arduino sketch to turn on and off the three LEDs.

Arduino Code For IR remote Control #include <IRremote.h> int RECV_PIN = 11; // int output1 = 2; int output2 = 4; int output3 = 6; int itsonled[] = {0,0,0,0; #define code1 0xFF807F // #define code2 0xFFA05F // #define code3 0xFF906F // IRrecv irrecv(recv_pin); decode_results results; void setup() { Serial.begin(9600); // irrecv.enableirin(); // pinmode(output1, OUTPUT); pinmode(output2, OUTPUT); pinmode(output3, OUTPUT);

void loop() { if (irrecv.decode(&results)) { unsigned int value = results.value; switch(value) { case code1: if(itsonled[1] == 1) { // digitalwrite(output1, LOW); // itsonled[1] = 0; // else { // digitalwrite(output1, HIGH); // itsonled[1] = 1; // break; case code2: if(itsonled[2] == 1) { digitalwrite(output2, LOW); itsonled[2] = 0; else { digitalwrite(output2, HIGH); itsonled[2] = 1; break; case code3: if(itsonled[3] == 1) { digitalwrite(output3, LOW); itsonled[3] = 0;

else { digitalwrite(output3, HIGH); itsonled[3] = 1; break; Serial.println(value); // you can comment this line irrecv.resume(); // Receive the next value In this arduino sketch we used code1 as 0xFF807F code2 as 0xFFA05F code3 as 0xFF906F you can change these code according to your remote key code received at arduino serial Monitor from first arduino sketch. (Arduino Code for Receiving IR as Hex code) Screenshot

Prototype Youtube Channel:: https://youtu.be/ipfuxr8xt94 Source:: http://www.theorycircuit.com/arduino-universal-remote/ 2. Arduino Capacitance meter Source:: http://www.theorycircuit.com/arduino-capacitance-meter/ By using arduino digital pins and serial monitor we can measure unknown capacitor value. This is calculation based technique, by charging and discharging capacitor through known value resistor and by calculating the time delay we can measure unknown capacitance value in farad.

C = Tc/R Tc time constant of capacitor (in seconds) R resistance of the circuit (in ohms) C the capacitance The same method is used in arduino circuit to find out unknown capacitor value. Here digital pin 13 used as charge pin for capacitor and digital pin 11 acts as discharge pin the time constant output fed into analog read pin A0. Arduino Code // Initialize Pins int analogpin = 0; int chargepin = 13;

int dischargepin = 11; //speeds up discharging process, not necessary though // Initialize Resistor int resistorvalue = 560; // Initialize Timer unsigned long starttime; unsigned long elapsedtime; // Initialize Capacitance Variables float microfarads; float nanofarads; void setup() { pinmode(chargepin, OUTPUT); digitalwrite(chargepin, LOW); Serial.begin(9600); // Necessary to print data to serial monitor over USB void loop() { digitalwrite(chargepin, HIGH); // Begins charging the capacitor starttime = millis(); // Begins the timer

while(analogread(analogpin) < 648) { // Does nothing until capacitor reaches 63.2% of total voltage elapsedtime= millis() - starttime; // Determines how much time it took to charge capacitor microfarads = ((float)elapsedtime / resistorvalue) * 1000; Serial.print(elapsedTime); Serial.print(" ms "); if (microfarads > 1) // Determines if units should be micro or nano and prints accordingly { Serial.print((long)microFarads); Serial.println(" microfarads"); else { nanofarads = microfarads * 1000.0; Serial.print((long)nanoFarads); Serial.println(" nanofarads"); delay(500); digitalwrite(chargepin, LOW); // Stops charging capacitor

pinmode(dischargepin, OUTPUT); digitalwrite(dischargepin, LOW); // Allows capacitor to discharge while(analogread(analogpin) > 0) { // Do nothing until capacitor is discharged pinmode(dischargepin, INPUT); // Prevents capacitor from discharging Prototype Source::http://www.theorycircuit.com/arduino-capacitance-meter/ 3. Increasing arduino PWM pins Source:: http://www.theorycircuit.com/increasing-arduino-pwm-pins/ If we need more PWM pins in arduino board, then we can convert digital arbitrary pin to PWM pin by using wiring library (softpwm library).

By using this softpwm library we can generate up to 20 PWM channels with the single hardware timer (Timer 2). We can create separate fade rates for on and off pulse. Arduino Code #include <SoftPWM.h> void setup() { SoftPWMBegin(); SoftPWMSet(13, 0); SoftPWMSetFadeTime(13, 1000, 1000); void loop() { SoftPWMSet(13, 255); delay(1000); SoftPWMSet(13, 0); delay(1000); You can get softpwm library here (Note: refer library page before using servo)

Prototype Youtube channel::https://youtu.be/-dcm2fzvjrm Source:: http://www.theorycircuit.com/increasing-arduino-pwm-pins/ 4. Arduino Serial Command LED Source::http://www.theorycircuit.com/arduino-serial-command-led/ In this project we used arduino serial monitor to command the LED On/Off and know the status of LED condition. By using simple measurement switch case codes and alpha numeric key we can drive digital pins of arduino.

Here we programmed arduino to turn On/Off LED that is connected in digital pin 12. Then the arduino sketch reads the status of digital pin 12 and serial prints value as either LED is now Activated or Deactivated. You can use this concept to control any output device connected with arduino digital pin. Arduino Code #define LED 12 char rxchar= 0; void setup(){ Serial.begin(9600); pinmode(led, OUTPUT); Serial.println("--- Command list: ---"); Serial.println("! -> Print this HELP"); Serial.println("o -> LED On \"activate\""); Serial.println("f -> LED Off \"deactivate\""); Serial.println("s -> LED \"status\""); Serial.flush(); void loop(){ if (Serial.available() >0){ rxchar = Serial.read(); Serial.flush(); switch (rxchar) {

case 'o': case 'O': if (digitalread(led) == LOW){ digitalwrite(led,high); Serial.println("LED turned On"); else Serial.println("LED already On!"); break; case 'f': case 'F': if (digitalread(led) == HIGH){ digitalwrite(led,low); Serial.println("LED turned Off"); else Serial.println("LED already Off!"); break; case 's': case 'S': if (digitalread(led) == HIGH) Serial.println("LED status: On"); else Serial.println("LED status: Off"); break;

case '!': Serial.println("--- Command list: ---"); Serial.println("! -> Print this HELP"); Serial.println("o -> LED On \"activate\""); Serial.println("f -> LED Off \"deactivate\""); Serial.println("s -> LED \"status\""); break; default: Serial.print("'"); Serial.print((char)rxChar); Serial.println("' is not a command!");

Prototype Source::http://www.theorycircuit.com/arduino-serial-command-led/ 5. Arduino serial data plotter Source:: http://www.theorycircuit.com/arduino-serial-data-plotter/ We can create graph by using received serial data from arduino Serial Monitor. Transfer arduino or genuine serial data to computer by using processing program and get graph result.

For to do this you need to program arduino to read any one sensor and direct the data to serial port terminal. In our case we use Force Sensitive Resistor 0.5 as analog input sensor and directed output to the Serial Monitor. Arduino Code to Read Analog Sensor void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorvalue = analogread(a0); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability Processing Code (paste in processing IDE) import processing.serial.*; Serial myport; // The serial port int xpos = 1; // horizontal position of the graph float inbyte = 0; void setup () { // set the window size: size(400, 300); // List all the available serial ports // if using Processing 2.1 or later, use Serial.printArray() println(serial.list()); // I know that the first port in the serial list on my mac

// is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myport = new Serial(this, Serial.list()[0], 9600); // don't generate a serialevent() unless you get a newline character: myport.bufferuntil('\n'); // set inital background: background(0); void draw () { // draw the line: stroke(127, 34, 255); line(xpos, height, xpos, height - inbyte); // at the edge of the screen, go back to the beginning: if (xpos >= width) { xpos = 0; background(0); else { // increment the horizontal position: xpos++;

void serialevent (Serial myport) { // get the ASCII string: String instring = myport.readstringuntil('\n'); if (instring!= null) { // trim off any whitespace: instring = trim(instring); // convert to an int and map to the screen height: inbyte = float(instring); println(inbyte); inbyte = map(inbyte, 0, 1023, 0, height); Put the program code in processing application, be careful to select console number as shown in image, if you have more than one port available follow the order as 0 = first port (com 1) 1 = second port (com 6) 2 = third port (com 8) 3 = fourth port (com 14) Here the port number com 1,6, are given for examples you may have different numbers. Look at the Serial Monitor of arduino and select the console number same as to arduino serial monitor port number and replace the index in Serial.list()[0].

Prototype Note: do not run serial monitor and processing at the same time, any one at a time.

Steps to Follow Step 1: Connect any sensor with arduino board. Step 2: Upload sensor reading sketch on arduino board (here the arduino code given for to read analog sensor connected in A0 pin), the arduino code should direct output to serial monitor serial.println Step 3: Paste the given processing code in Processing IDE, if you don t have processing IDE google it to get one. Step 4: Remember to select correct console number as mentioned in this tutorial. Step 5: Now Use only processing run option you will get graph output for sensor reading connected with arduino. Source:: http://www.theorycircuit.com/arduino-serial-data-plotter/ Thank you For your Interest! Hope to See you at theorycircuit.com