What is a Relay? A Relay is a electronic operated switch, relay’s uses an electromagnet mechanical to operate the switch and provide electrical isolation between two circuits. Is this lab project we don’t need to isolate one circuit from other,
Starter #15 Using Photo Resistor and LEDs
This sketch guide you to create a LED animation transition using LDR ( Light Dependent Resistor) with Arduino. Photo Resistor are variable resistor which change resistance depending on the light hitting the sensor. When you put your hand closer to
Installing drivers for Arduino Uno R3
It is important to follow the steps mentioned next to be able to use the Arduino Uno R3 and some other boards. Please check the Arduino website for up-to-date references. 1. Plug your board in and wait for Windows to
Installing drivers for Arduino Duemilanove, Nano, or Diecimilla
When you connect the board, Windows should initiate the driver installation process (if you haven’t used the computer with an Arduino board before). On Windows Vista, the driver should be automatically downloaded and installed. (Really, it works!) On Windows XP,
The Raspberry Pi Models and How to Address them
The Raspberry Pi Models and Version & the Difference. Lots of Makes, developers, hobbyist and engineers these days questioning what is the difference between Arduino & Raspberry. Even though both are made for solving difference problems. Raspberry Pi is a
Starter # 11 How to use 16×2 LCD Screen with Arduino with Source Code
This tutorial will show you how to use the LCD Screen 16×2 in Arduino. Electronic Parts Required ARDUINO UNO/MEGA/PRO 1x Potentiometer ( To adjust the Brightness, Contrast of the LCD) 1x LCD Screen 1602 Jumper wire
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. www.14core.com . ... . . ...... */ int LCD1602_RS=12; int LCD1602_RW=11; int LCD1602_EN=10; int DB[] = { 6, 7, 8, 9}; char str1[]="Welcome to"; char str2[]="www.14core.com"; char str3[]="this is the"; char str4[]="4-bit interface"; void LCD_Command_Write(int command) { int i,temp; digitalWrite( LCD1602_RS,LOW); digitalWrite( LCD1602_RW,LOW); digitalWrite( LCD1602_EN,LOW); temp=command & 0xf0; for (i=DB[0]; i <= 9; i++) { digitalWrite(i,temp & 0x80); temp <<= 1; } digitalWrite( LCD1602_EN,HIGH); delayMicroseconds(1); digitalWrite( LCD1602_EN,LOW); temp=(command & 0x0f)<<4; for (i=DB[0]; i <= 9; i++) { digitalWrite(i,temp & 0x80); temp <<= 1; } digitalWrite( LCD1602_EN,HIGH); delayMicroseconds(1); digitalWrite( LCD1602_EN,LOW); } void LCD_Data_Write(int dat) { int i=0,temp; digitalWrite( LCD1602_RS,HIGH); digitalWrite( LCD1602_RW,LOW); digitalWrite( LCD1602_EN,LOW); temp=dat & 0xf0; for (i=DB[0]; i <= 9; i++) { digitalWrite(i,temp & 0x80); temp <<= 1; } digitalWrite( LCD1602_EN,HIGH); delayMicroseconds(1); digitalWrite( LCD1602_EN,LOW); temp=(dat & 0x0f)<<4; for (i=DB[0]; i <= 9; i++) { digitalWrite(i,temp & 0x80); temp <<= 1; } digitalWrite( LCD1602_EN,HIGH); delayMicroseconds(1); digitalWrite( LCD1602_EN,LOW); } void LCD_SET_XY( int x, int y ) { int address; if (y ==0) address = 0x80 + x; else address = 0xC0 + x; LCD_Command_Write(address); } void LCD_Write_Char( int x,int y,int dat) { LCD_SET_XY( x, y ); LCD_Data_Write(dat); } void LCD_Write_String(int X,int Y,char *s) { LCD_SET_XY( X, Y ); //set address while (*s) //write the string { LCD_Data_Write(*s); s ++; } } void setup (void) { int i = 0; for (i=6; i <= 12; i++) { pinMode(i,OUTPUT); } delay(100); LCD_Command_Write(0x28); delay(50); LCD_Command_Write(0x06); delay(50); LCD_Command_Write(0x0c); delay(50); LCD_Command_Write(0x80); delay(50); LCD_Command_Write(0x01); delay(50); } void loop (void) { LCD_Command_Write(0x01); delay(50); LCD_Write_String(3,0,str1); //Row1, column4 delay(50); LCD_Write_String(1,1,str2); //Row2, column2 delay(5000); LCD_Command_Write(0x01); delay(50); LCD_Write_String(0,0,str3); delay(50); LCD_Write_String(0,1,str4); delay(5000); } |
Download the source code
Starter #10 Driving 7 Segment Digital Display with Arduino with Source Code
Here the steps how to wire and driving the 7 segment digital display using Arduino. Electronic Parts Required ARDUINO UNO/MEGA/PRO 4x Seven Segment Digital Display 8x 220 k Resistor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. www.14core.com . ... . . ...... */ int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; int p = 8; int d4 = 9; int d3 = 10; int d2 = 11; int d1 = 12; long n = 0; int x = 100; int del = 55; void setup() { pinMode(d1, OUTPUT); pinMode(d2, OUTPUT); pinMode(d3, OUTPUT); pinMode(d4, OUTPUT); pinMode(a, OUTPUT); pinMode(b, OUTPUT); pinMode(c, OUTPUT); pinMode(d, OUTPUT); pinMode(e, OUTPUT); pinMode(f, OUTPUT); pinMode(g, OUTPUT); pinMode(p, OUTPUT); pinMode(13,INPUT); } void loop() { clearLEDs(); pickDigit(1); pickNumber((n/x/1000)%10); delayMicroseconds(del); clearLEDs(); pickDigit(2); pickNumber((n/x/100)%10); delayMicroseconds(del); clearLEDs(); pickDigit(3); dispDec(3); pickNumber((n/x/10)%10); delayMicroseconds(del); clearLEDs(); pickDigit(4); pickNumber(n/x%10); delayMicroseconds(del); n++; /* When you need to put the numbers to zero, you may use this function ClearDigital(); */ //ClearDigital(); } void pickDigit(int x) { digitalWrite(d1, HIGH); digitalWrite(d2, HIGH); digitalWrite(d3, HIGH); digitalWrite(d4, HIGH); switch(x) { case 1: digitalWrite(d1, LOW); break; case 2: digitalWrite(d2, LOW); break; case 3: digitalWrite(d3, LOW); break; default: digitalWrite(d4, LOW); break; } } void pickNumber(int x) { switch(x) { default: zero(); break; case 1: one(); break; case 2: two(); break; case 3: three(); break; case 4: four(); break; case 5: five(); break; case 6: six(); break; case 7: seven(); break; case 8: eight(); break; case 9: nine(); break; } } void dispDec(int x) { digitalWrite(p, LOW); } void clearLEDs() { digitalWrite(a, LOW); digitalWrite(b, LOW); digitalWrite(c, LOW); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); digitalWrite(p, LOW); } void zero() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, LOW); } void one() { digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); } void two() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, LOW); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, LOW); digitalWrite(g, HIGH); } void three() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, HIGH); } void four() { digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); } void five() { digitalWrite(a, HIGH); digitalWrite(b, LOW); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); } void six() { digitalWrite(a, HIGH); digitalWrite(b, LOW); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); } void seven() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); } void eight() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); } void nine() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); } /* you can add a button, please refer to 14Core Starter #3 Button Control. keep the Pin13 all high. when push the button, it become LOW. n=0; */ void ClearDigital() { if(digitalRead(13)== LOW) { n=0; } } |
Download the source code here | 14Core Digital Display
Starter #9 Temperature Detection and Measuring with LM35
Lear how to detect Temperature using Arduino with LM35 Electronic parts requirements. Arduino UNO/MEGA/PRO 3x LED 3x 220k Resistor 1x LM35 Temperature Sensor Jumper wires
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. www.14core.com . ... . . ...... */ void setup() { pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); //defines all the LED pins to output Serial.begin(9600); } void loop() { int vol = analogRead(A0) * (5.0 / 1023.0*100); //analog read the temperature sensor voltage Serial.print(" The temperature is:"); Serial.println(vol); if (vol<=31) //if the temperature is low { digitalWrite(13, HIGH); digitalWrite(12, LOW); digitalWrite(11, LOW); } else if (vol>=32 && vol<=40) // if the temperature is middle { digitalWrite(13, LOW); digitalWrite(12, HIGH); digitalWrite(11, LOW); } else if (vol>=41) //If the temperature is HIGH { digitalWrite(13, LOW); digitalWrite(12, LOW); digitalWrite(11, HIGH); } delay(100); } |
Download the source code here | 14COre Temprature Measuring
Starter #9 Light Detection with (LDR) Light-Dependent Resistor with Arduino
Detecting a light or making a switch using Photoresistor interface with Arduino. Electronic Components Required Arduino UNO/MEGA/PRO 1x LED 1x 220k Ohm Resistor 1x 10k Resistor 1x LDR(Photo resistor)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. . ... . . ...... */ int photocellPin = 2;//define the LDR to D2; int ledPin =12; int val =0; //val to store the data; void setup(){ pinMode(ledPin,OUTPUT);//set the ledPin to output; Serial.begin(9600); } void loop(){ val = analogRead(photocellPin); Serial.println("current light is"); Serial.println(val); if (val<350){ //512 =2.5V, you can modify this to adjust the sensitivity; digitalWrite(ledPin,HIGH); } else{ digitalWrite(ledPin,LOW); } delay(1000); } |
Download the source code here | 14Core Light Detection
Starter #8 Using Analog in Arduino with Potentiometer
Working on Potentiometer in Arduino inalog. Electronic Part Requirements. Arduino UNO/MEGA/PRO/ 1x 10k Potentiometer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. 14core.com . ... . . ...... */ int potpin = 0 ; int ledpin = 13 ; int val = 0 ; void setup() { pinMode(ledpin,OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(ledpin,HIGH); delay(50); digitalWrite(ledpin,LOW); delay(50); val = analogRead(potpin); Serial.println(val) ; } |
Download the source code here | 14coreanalog
Starter #7 How to use Tilt Switch in Arduino with Sample Source Code
How to use the TILT switch using Arduino.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
int led=7; int tilt =2; void setup() { pinMode(led,OUTPUT); pinMode(tilt,INPUT); } void loop() { if(digitalRead(tilt)==HIGH) { digitalWrite(led,LOW);//turn off the LED } else { digitalWrite(led,HIGH);//turn on the LED } } |
Download the source code here | 14Core_Tilt_Switch
Starter #6 Using Buzzer in Arduino Sample Code
Sample Source code how to use a buzzer connected to Arduino, Electronic Parts you need 1x Arduino Uno / Mega / Pro 1x Buzzer or Beeper
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
int buzzer=7; void setup() { pinMode(buzzer,OUTPUT); } void loop() { unsigned char i,j; while(1) { for(i=0;i<80;i++) { digitalWrite(buzzer,HIGH); delay(1); digitalWrite(buzzer,LOW); delay(1); } for(i=0;i<100;i++) { digitalWrite(buzzer,HIGH); delay(2); digitalWrite(buzzer,LOW); delay(2); } } } |
Download the core here | 14CoreBuzzer