Components and supplies
ESC 30A
Arduino UNO
AC current sensor
RFID-RC522
Male/Female Jumper Wires
Arduino Nano R3
Slide Switch
DC current sensor
Enclosure for Raspberry Pi 3 Model B
Rechargeable Battery, Lithium Ion
Monitor, LCD
Solderless Breadboard Half Size
7 segment
Alphanumeric LCD, 20 x 4
l 298n dc motor driver
Alphanumeric LCD, 16 x 2
Axial Fan, 12 VDC
Board-To-Board Connector, 2 mm
HC-12
HC-05 Bluetooth Module
Toggle Switch, SPDT
DC voltage sensor
AC to DC converter
relay 1 channal
3.7V 7800mAh Rechargeable Lithium Battery Red
Tools and machines
Solder Wire, Lead Free
Soldering iron (generic)
Apps and platforms
circuito.io
Arduino IDE
Project description
Code
part10
arduino
1#include <Wire.h> 2#include <SoftwareSerial.h> 3SoftwareSerial hc12(5,4); // RX,TX 4const int currentPin = A0; 5int sensitivity = 66; 6int adcValue= 0; 7int offsetVoltage = 2500; 8double adcVoltage = 0; 9double currentValue = 0; 10void setup() 11{ 12 Serial.begin(9600); 13 hc12.begin(9600); 14} 15void loop() 16{ 17 adcValue = analogRead(currentPin); 18 adcVoltage = (adcValue / 1024.0) * 5000; 19 currentValue = ((adcVoltage - offsetVoltage) / sensitivity); 20 Serial.print("\ Current = "); 21 Serial.println(currentValue,3); 22 /*lcd.setCursor(0,0); 23 lcd.print("Current = "); 24 lcd.setCursor(10,0); 25 lcd.print(currentValue,2); 26 lcd.setCursor(14,0); 27 lcd.print("A"); 28 delay(2500);*/ 29 hc12.println(currentValue); 30}
part3
arduino
1#include <LiquidCrystal_I2C.h> 2LiquidCrystal_I2C lcd(0x27,16,2); 3float analog; 4int digital; 5//int analog1; 6//int sw; 7void setup() { 8 // put your setup code here, to run once: 9 Serial.begin(9600); 10 lcd.init(); 11 lcd.backlight(); 12 //lcd.init(); 13 /*pinMode(11,INPUT); 14 pinMode(2,INPUT);*/ 15 pinMode(12,INPUT); 16} 17void loop() { 18 // put your main code here, to run repeatedly: 19 delay(500); 20analog=analogRead(1); 21digital=digitalRead(12); 22Serial.println(analog); 23//analog1=digitalRead(1); 24//sw=digitalRead(12); 25lcd.setCursor(0,0); 26lcd.print("analog:"); 27lcd.setCursor(8,0); 28lcd.print(analog,3); 29lcd.setCursor(0,1); 30lcd.print("digital:"); 31lcd.setCursor(9,1); 32lcd.print(digital);
part11
arduino
1#include <SPI.h> 2#include <MFRC522.h> 3#define SS_PIN 10 4#define RST_PIN 9 5MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 6void setup() 7{ 8 9 Serial.begin(9600); // Initiate a serial communication 10 SPI.begin(); // Initiate SPI bus 11 mfrc522.PCD_Init(); // Initiate MFRC522 12 //Serial.println("Approximate your card to the reader..."); 13 //Serial.println(); 14 pinMode(3,OUTPUT); 15} 16void loop() 17{ 18 // Look for new cards 19 if ( ! mfrc522.PICC_IsNewCardPresent()) 20 { 21 return; 22 } 23 // Select one of the cards 24 if ( ! mfrc522.PICC_ReadCardSerial()) 25 { 26 return; 27 } 28 //Show UID on serial monitor 29// Serial.print("UID tag :"); 30 String content= ""; 31 byte letter; 32 for (byte i = 0; i < mfrc522.uid.size; i++) 33 { 34 Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 35 Serial.print(mfrc522.uid.uidByte[i], HEX); 36 content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 37 content.concat(String(mfrc522.uid.uidByte[i], HEX)); 38 } 39 Serial.println(); 40 //Serial.print("Message : "); 41 content.toUpperCase(); 42 if (content.substring(1) == "5B C6 01 22") //change here the UID of the card/cards that you want to give access 43 { 44 Serial.println("hatm"); 45 digitalWrite(3,1); 46 47 } 48else{ 49 digitalWrite(3,0); 50} 51 if (content.substring(1) == "5B 4E FA 21") //change here the UID of the card/cards that you want to give access 52 { 53 Serial.println("jafar"); 54 digitalWrite(3,1); 55 } 56else{ 57 digitalWrite(3,0); 58}}
part5
arduino
1#include <TM1637Display.h> 2#include "dht.h" 3#include <Wire.h> 4#define dht_apin A0 5const int CLK = 9; //Set the CLK pin connection to the display 6const int DIO = 8; //Set the DIO pin connection to the display 7TM1637Display display(CLK, DIO); //set up the 4-Digit Display. 8int s; 9dht DHT; 10//*************************************************************************** 11void setup() { 12 display.setBrightness(0x0a); 13 Serial.begin(9600);//set the diplay to maximum brightness 14 pinMode(7,INPUT); 15 pinMode(12,OUTPUT); 16} 17void loop() { 18 // put your main code here, to run repeatedly: 19 Serial.print("temperature ="); 20 Serial.print("\ 21"); 22 Serial.print(DHT.temperature); 23 //Serial.println(s); 24DHT.read11(dht_apin); 25s=digitalRead(7); 26display.showNumberDec( DHT.temperature); 27if(s == 1){ 28 digitalWrite(12,1); 29} 30else{ 31 digitalWrite(12,0); 32}}
part2
arduino
1#include <LiquidCrystal_I2C.h> 2#include <Wire.h> 3#include <SoftwareSerial.h> 4SoftwareSerial hc12(5,4); // RX, TX 5LiquidCrystal_I2C lcd(0x27, 20, 4); 6int button; 7float arr[3]; 8float res; 9float power; 10float ACres; 11float ACpowW; 12float showpower; 13//************************************* 14void setup() { 15 hc12.begin(9600); 16 Serial.begin(9600); 17 lcd.init(); 18 lcd.backlight(); 19 pinMode(12,INPUT); 20} 21void loop() { 22 button=digitalRead(12); 23 /*lcd.setCursor(0,0); 24 lcd.print("Hello, world!"); 25 lcd.setCursor(0,1); 26 lcd.print("Hello, world!"); 27 lcd.setCursor(0,2); 28 lcd.print("Hello, world!"); 29 lcd.setCursor(0,3); 30 lcd.print("Hello, world!"); 31button=digitalRead(12);*/ 32/*lcd.setCursor(0,0); 33lcd.print("steps:-"); 34lcd.setCursor(0,8); 35lcd.print(s); 36*/ 37//Serial.println(button); 38//********************************************************** 39if(button == 1){ 40 if (hc12.available()) { 41 //int curr=hc12.read(); 42 Serial.print(hc12.read()); 43 ACres=220/curr; 44 ACpowW=220*curr*0.9; 45 showpower=220*curr; 46lcd.setCursor(0,0); 47 lcd.print("AC-current="); 48 lcd.setCursor(0,12); 49 lcd.print(curr); 50 lcd.setCursor(0,1); 51 lcd.print("AC-resistance="); 52 lcd.setCursor(14,1); 53 lcd.print(ACres); 54 lcd.setCursor(0,2); 55 lcd.print("AC-power="); 56 lcd.setCursor(9,2); 57 lcd.print(ACpowW); 58 lcd.setCursor(0,3); 59 lcd.print("Ac-S.power="); 60 lcd.setCursor(11,3); 61 lcd.print(showpower); 62 63 64 }} 65//********************************************************** 66else{ 67 if (Serial.available()) { 68 for (int i=0; i<=3; i++){ 69 arr[i] = Serial.parseFloat(); 70 } 71 72// char to_char[16]; 73// itoa(arr, to_char, 10); 74 } 75 float cur=arr[1]; 76 float volt=arr[3];*/ 77 Serial.println(cur); 78 Serial.println('\ 79'); 80 Serial.println(volt);*/ 81 res=cur/volt; 82 power=cur*volt; 83 lcd.setCursor(0,0); 84 lcd.print("Current="); 85 lcd.setCursor(9,0); 86 lcd.print(cur); 87 lcd.setCursor(0,1); 88 lcd.print("Voltage="); 89 lcd.setCursor(9,1); 90 lcd.print(volt); 91 lcd.setCursor(0,2); 92 lcd.print("Power="); 93 lcd.setCursor(7,2); 94 lcd.print(power); 95 lcd.setCursor(0,3); 96 lcd.print("Resistance="); 97 lcd.setCursor(12,3); 98 lcd.print(res); 99}}
part8
arduino
1#include <Servo.h> 2Servo ESC; // create servo object to control the ESC 3int potValue; // value from the analog pin 4int button; 5void setup() { 6 // Attach the ESC on pin 9 7ESC.attach(9,1000,2000);// (pin, min pulse width, max pulse width in microseconds) 8Serial.begin(9600); 9pinMode(11,INPUT);//button 10pinMode(12,OUTPUT);//relay 11} 12void loop() { 13button= digitalRead(11); 14 potValue = analogRead(A2); // reads the value of the potentiometer (value between 0 and 1023) 15 potValue = map(potValue, 0, 1023, 0, 180); // scale it to use it with the servo library (value between 0 and 180) 16 ESC.write(potValue); // Send the signal to the ESC 17if(button == 1){ 18 digitalWrite(12,0); 19} 20 else{ 21 digitalWrite(12,1); 22 }}
part10
arduino
1#include <Wire.h> 2#include <SoftwareSerial.h> 3SoftwareSerial hc12(5,4); // RX,TX 4const int currentPin = A0; 5int sensitivity = 66; 6int adcValue= 0; 7int offsetVoltage = 2500; 8double adcVoltage = 0; 9double currentValue = 0; 10void setup() 11{ 12 Serial.begin(9600); 13 hc12.begin(9600); 14} 15void loop() 16{ 17 adcValue = analogRead(currentPin); 18 adcVoltage = (adcValue / 1024.0) * 5000; 19 currentValue = ((adcVoltage - offsetVoltage) / sensitivity); 20 Serial.print("\ Current = "); 21 Serial.println(currentValue,3); 22 /*lcd.setCursor(0,0); 23 lcd.print("Current = "); 24 lcd.setCursor(10,0); 25 lcd.print(currentValue,2); 26 lcd.setCursor(14,0); 27 lcd.print("A"); 28 delay(2500);*/ 29 hc12.println(currentValue); 30}
part11
arduino
1#include <SPI.h> 2#include <MFRC522.h> 3#define SS_PIN 10 4#define RST_PIN 9 5MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 6void setup() 7{ 8 9 Serial.begin(9600); // Initiate a serial communication 10 SPI.begin(); // Initiate SPI bus 11 mfrc522.PCD_Init(); // Initiate MFRC522 12 //Serial.println("Approximate your card to the reader..."); 13 //Serial.println(); 14 pinMode(3,OUTPUT); 15} 16void loop() 17{ 18 // Look for new cards 19 if ( ! mfrc522.PICC_IsNewCardPresent()) 20 { 21 return; 22 } 23 // Select one of the cards 24 if ( ! mfrc522.PICC_ReadCardSerial()) 25 { 26 return; 27 } 28 //Show UID on serial monitor 29// Serial.print("UID tag :"); 30 String content= ""; 31 byte letter; 32 for (byte i = 0; i < mfrc522.uid.size; i++) 33 { 34 Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 35 Serial.print(mfrc522.uid.uidByte[i], HEX); 36 content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 37 content.concat(String(mfrc522.uid.uidByte[i], HEX)); 38 } 39 Serial.println(); 40 //Serial.print("Message : "); 41 content.toUpperCase(); 42 if (content.substring(1) == "5B C6 01 22") //change here the UID of the card/cards that you want to give access 43 { 44 Serial.println("hatm"); 45 digitalWrite(3,1); 46 47 } 48else{ 49 digitalWrite(3,0); 50} 51 if (content.substring(1) == "5B 4E FA 21") //change here the UID of the card/cards that you want to give access 52 { 53 Serial.println("jafar"); 54 digitalWrite(3,1); 55 } 56else{ 57 digitalWrite(3,0); 58}}
part9
arduino
1#include <Stepper.h> 2#include <Servo.h> 3Servo myservo; 4const int stepsPerRevolution = 200; 5int val; 6int button; 7Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); 8int changeres; 9int stepCount = 0; 10//.................................................................... 11void setup() { 12 // nothing to do inside the setup 13 pinMode(11,INPUT); 14 myservo.attach(5); 15} 16void loop() { 17 changeres=analogRead(5); 18 if(button == 1){ 19 int sensorReading = analogRead(A0); 20 int motorSpeed = map(sensorReading, 0, 1023, 0, 100); 21 if (motorSpeed > 0) { 22 myStepper.setSpeed(motorSpeed); 23 myStepper.step(stepsPerRevolution / 100); 24 } 25 } 26 else{ 27 myStepper.step(1); 28 Serial.print("steps:"); 29 Serial.println(stepCount); 30 stepCount++; 31 delay(500); 32 } 33 val = map(changeres, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) 34 myservo.write(val); 35}
part6
arduino
1#include <SoftwareSerial.h> 2SoftwareSerial mySerial(12, 13); // RX, TX 3char x; 4void setup() { 5 // Open serial communications and wait for port to open: 6 Serial.begin(9600); 7 //Serial.println("Goodnight moon!"); 8 mySerial.begin(9600); 9// mySerial.println("Hello, world?"); 10} 11void loop() { // run over and over 12 if (mySerial.available()) { 13 x=mySerial.read(); 14 Serial.write(x); 15 } 16 if(x == 'a'){ 17 Serial.println("LED1 off"); 18} 1949 20 else if(x == 'A'){ 21 Serial.println("LED1 on"); 22} 23 else if(x =='b'){ 24 Serial.println("LED2 off"); 25} 26 else if(x == 'B'){ 27 Serial.println("LED2 on"); 28} 29 else if(x == 'c'){ 30 Serial.println("LED3 on"); 31} 32 else if(x == 'C'){ 33 Serial.println("LED3 off"); 34}
part3
arduino
1#include <LiquidCrystal_I2C.h> 2LiquidCrystal_I2C lcd(0x27,16,2); 3float analog; 4int digital; 5//int analog1; 6//int sw; 7void setup() { 8 // put your setup code here, to run once: 9 Serial.begin(9600); 10 lcd.init(); 11 lcd.backlight(); 12 //lcd.init(); 13 /*pinMode(11,INPUT); 14 pinMode(2,INPUT);*/ 15 pinMode(12,INPUT); 16} 17void loop() { 18 // put your main code here, to run repeatedly: 19 delay(500); 20analog=analogRead(1); 21digital=digitalRead(12); 22Serial.println(analog); 23//analog1=digitalRead(1); 24//sw=digitalRead(12); 25lcd.setCursor(0,0); 26lcd.print("analog:"); 27lcd.setCursor(8,0); 28lcd.print(analog,3); 29lcd.setCursor(0,1); 30lcd.print("digital:"); 31lcd.setCursor(9,1); 32lcd.print(digital);
part4
arduino
1int pin2,pin3,pin6,pin7,pin10,pin11; 2//................................................................................... 3void setup() { 4 //and 5pinMode(2,INPUT); 6pinMode(3,INPUT); 7pinMode(4,OUTPUT); 8pinMode(5,OUTPUT); 9//or 10pinMode(6,INPUT); 11pinMode(7,INPUT); 12pinMode(8,OUTPUT); 13pinMode(9,OUTPUT); 14//not 15pinMode(10,INPUT); 16pinMode(11,INPUT); 17pinMode(12,OUTPUT); 18pinMode(13,OUTPUT); 19} 20//........................................................................................... 21void loop() { 22 // AND 23pin2=digitalRead(2); 24pin3=digitalRead(3); 25//OR 26pin6=digitalRead(6); 27pin7=digitalRead(7); 28//NOT 29pin10=digitalRead(10); 30pin11=digitalRead(11); 31//........................................................................................ 32//THE AND GATE 33if(pin2==0 && pin3==0){ 34 digitalWrite(4,0); 35 digitalWrite(5,0); 36} 37else if(pin2==1 && pin3==0){ 38 digitalWrite(4,0); 39 digitalWrite(5,0); 40} 41else if(pin2==0 && pin3==1){ 42 digitalWrite(4,0); 43 digitalWrite(5,0); 44} 45else if(pin2==1 && pin3==1){ 46 digitalWrite(4,1); 47 digitalWrite(5,1); 48} 49else{ 50 digitalWrite(4,0); 51 digitalWrite(5,0); 52} 53//............................................................................... 54//THE OR GATE 55if(pin6==0 || pin7==0){ 56 digitalWrite(8,0); 57 digitalWrite(9,0); 58} 59else if(pin6==1 || pin7==0){ 60 digitalWrite(8,1); 61 digitalWrite(9,1); 62} 63else if(pin6==0 || pin7==1){ 64 digitalWrite(8,1); 65 digitalWrite(9,1); 66} 67else if(pin6==1 || pin7==1){ 68 digitalWrite(8,1); 69 digitalWrite(9,1); 70} 71else{ 72 digitalWrite(8,0); 73 digitalWrite(9,0); 74} 75//..................................................................................... 76//THE NOT GATE 77if(pin10==0){ 78 digitalWrite(12,1); 79} 80else{ 81 digitalWrite(12,0); 82} 83if(pin11==0){ 84 digitalWrite(13,1); 85} 86else{ 87 digitalWrite(13,0); 88}}
part1
arduino
1#include <LiquidCrystal_I2C.h> 2LiquidCrystal_I2C lcd(0x27,16,2); 3const int voltageSensor = A0; 4const int currentPin = A1; 5float vOUT = 0.0; 6float vIN = 0.0; 7float R1 = 30000.0; 8float R2 = 7500.0; 9int value = 0; 10//******************************** 11#define VIN A1 // define the Arduino pin A0 as voltage input (V in) 12const float VCC = 5.0;// supply voltage is from 4.5 to 5.5V. Normally 5V. 13const int model = 2; // enter the model number (see below) 14float cutOffLimit = 1.01;// set the current which below that value, doesn't matter. Or set 0.5 15float sensitivity[] ={ 16 0.185,// for ACS712ELCTR-05B-T 17 0.100,// for ACS712ELCTR-20A-T 18 0.066// for ACS712ELCTR-30A-T 19 }; 20const float QOV = 0.5 * VCC;// set quiescent Output voltage of 0.5V 21float voltage;// internal variable for voltage 22//************************************* 23void setup() { 24 Serial.begin(9600); 25 lcd.init(); 26 lcd.backlight(); 27 pinMode(7,OUTPUT); 28} 29void loop() { 30//voltagepin=analogRead(0); 31/* adcValue = analogRead(currentPin); 32 adcVoltage = (adcValue / 1024.0) * 5000; 33 currentValue = ((adcVoltage - offsetVoltage) / sensitivity); 34 Serial.print("Raw Sensor Value = " ); 35 Serial.print(adcValue);*/ 36 float voltage_raw = (5.0 / 1023.0)* analogRead(VIN);// Read the voltage from sensor 37 voltage = voltage_raw - QOV + 0.012 ;// 0.000 is a value to make voltage zero when there is no current 38 float current = voltage / sensitivity[model]; 39float cur=current*0.1; 40 if(abs(current) > cutOffLimit ){ 41 lcd.setCursor(0,0); 42lcd.print("Amp:"); 43lcd.setCursor(5,0); 44lcd.print(cur,2); 45lcd.setCursor(12,0); 46lcd.print("mA"); 47 }else{ 48 /* lcd.setCursor(0,0); 49 lcd.print("No Current");*/ 50 } 51 //************************************************* 52 value = analogRead(voltageSensor); 53 vOUT = (value * 5.0) / 1024.0; 54 55 vIN = vOUT / (R2/(R1+R2)); 56lcd.setCursor(0,1); 57lcd.print("volt:"); 58lcd.setCursor(6,1); 59lcd.print(vIN); 60lcd.setCursor(12,1); 61lcd.print("VOLT"); 62}
part9
arduino
1#include <Stepper.h> 2#include <Servo.h> 3Servo myservo; 4const 5 int stepsPerRevolution = 200; 6int val; 7int button; 8Stepper myStepper(stepsPerRevolution, 9 8, 9, 10, 11); 10int changeres; 11int stepCount = 0; 12//.................................................................... 13void 14 setup() { 15 // nothing to do inside the setup 16 pinMode(11,INPUT); 17 myservo.attach(5); 18} 19void 20 loop() { 21 changeres=analogRead(5); 22 if(button == 1){ 23 int sensorReading 24 = analogRead(A0); 25 int motorSpeed = map(sensorReading, 0, 1023, 0, 100); 26 27 if (motorSpeed > 0) { 28 myStepper.setSpeed(motorSpeed); 29 myStepper.step(stepsPerRevolution 30 / 100); 31 } 32 } 33 else{ 34 myStepper.step(1); 35 Serial.print("steps:"); 36 37 Serial.println(stepCount); 38 stepCount++; 39 delay(500); 40 } 41 val = map(changeres, 42 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) 43 44 myservo.write(val); 45}
part5
arduino
1#include <TM1637Display.h> 2#include "dht.h" 3#include <Wire.h> 4 5#define dht_apin A0 6const int CLK = 9; //Set the CLK pin connection to the 7 display 8const int DIO = 8; //Set the DIO pin connection to the display 9TM1637Display 10 display(CLK, DIO); //set up the 4-Digit Display. 11int s; 12dht DHT; 13//*************************************************************************** 14void 15 setup() { 16 display.setBrightness(0x0a); 17 Serial.begin(9600);//set the diplay 18 to maximum brightness 19 pinMode(7,INPUT); 20 pinMode(12,OUTPUT); 21} 22void 23 loop() { 24 // put your main code here, to run repeatedly: 25 Serial.print("temperature 26 ="); 27 Serial.print("\ 28"); 29 Serial.print(DHT.temperature); 30 //Serial.println(s); 31 32DHT.read11(dht_apin); 33s=digitalRead(7); 34display.showNumberDec( DHT.temperature); 35if(s 36 == 1){ 37 digitalWrite(12,1); 38} 39else{ 40 digitalWrite(12,0); 41}}
part1
arduino
1#include <LiquidCrystal_I2C.h> 2LiquidCrystal_I2C lcd(0x27,16,2); 3const int voltageSensor = A0; 4const int currentPin = A1; 5float vOUT = 0.0; 6float vIN = 0.0; 7float R1 = 30000.0; 8float R2 = 7500.0; 9int value = 0; 10//******************************** 11#define VIN A1 // define the Arduino pin A0 as voltage input (V in) 12const float VCC = 5.0;// supply voltage is from 4.5 to 5.5V. Normally 5V. 13const int model = 2; // enter the model number (see below) 14float cutOffLimit = 1.01;// set the current which below that value, doesn't matter. Or set 0.5 15float sensitivity[] ={ 16 0.185,// for ACS712ELCTR-05B-T 17 0.100,// for ACS712ELCTR-20A-T 18 0.066// for ACS712ELCTR-30A-T 19 }; 20const float QOV = 0.5 * VCC;// set quiescent Output voltage of 0.5V 21float voltage;// internal variable for voltage 22//************************************* 23void setup() { 24 Serial.begin(9600); 25 lcd.init(); 26 lcd.backlight(); 27 pinMode(7,OUTPUT); 28} 29void loop() { 30//voltagepin=analogRead(0); 31/* adcValue = analogRead(currentPin); 32 adcVoltage = (adcValue / 1024.0) * 5000; 33 currentValue = ((adcVoltage - offsetVoltage) / sensitivity); 34 Serial.print("Raw Sensor Value = " ); 35 Serial.print(adcValue);*/ 36 float voltage_raw = (5.0 / 1023.0)* analogRead(VIN);// Read the voltage from sensor 37 voltage = voltage_raw - QOV + 0.012 ;// 0.000 is a value to make voltage zero when there is no current 38 float current = voltage / sensitivity[model]; 39float cur=current*0.1; 40 if(abs(current) > cutOffLimit ){ 41 lcd.setCursor(0,0); 42lcd.print("Amp:"); 43lcd.setCursor(5,0); 44lcd.print(cur,2); 45lcd.setCursor(12,0); 46lcd.print("mA"); 47 }else{ 48 /* lcd.setCursor(0,0); 49 lcd.print("No Current");*/ 50 } 51 //************************************************* 52 value = analogRead(voltageSensor); 53 vOUT = (value * 5.0) / 1024.0; 54 55 vIN = vOUT / (R2/(R1+R2)); 56lcd.setCursor(0,1); 57lcd.print("volt:"); 58lcd.setCursor(6,1); 59lcd.print(vIN); 60lcd.setCursor(12,1); 61lcd.print("VOLT"); 62}
part8
arduino
1#include <Servo.h> 2Servo ESC; // create servo object to control the 3 ESC 4int potValue; // value from the analog pin 5int button; 6void setup() 7 { 8 // Attach the ESC on pin 9 9ESC.attach(9,1000,2000);// (pin, min pulse width, 10 max pulse width in microseconds) 11Serial.begin(9600); 12pinMode(11,INPUT);//button 13pinMode(12,OUTPUT);//relay 14} 15void 16 loop() { 17button= digitalRead(11); 18 potValue = analogRead(A2); // reads the 19 value of the potentiometer (value between 0 and 1023) 20 potValue = map(potValue, 21 0, 1023, 0, 180); // scale it to use it with the servo library (value between 0 22 and 180) 23 ESC.write(potValue); // Send the signal to the ESC 24if(button == 25 1){ 26 digitalWrite(12,0); 27} 28 else{ 29 digitalWrite(12,1); 30 }}
part2
arduino
1#include <LiquidCrystal_I2C.h> 2#include <Wire.h> 3#include <SoftwareSerial.h> 4SoftwareSerial hc12(5,4); // RX, TX 5LiquidCrystal_I2C lcd(0x27, 20, 4); 6int button; 7float arr[3]; 8float res; 9float power; 10float ACres; 11float ACpowW; 12float showpower; 13//************************************* 14void setup() { 15 hc12.begin(9600); 16 Serial.begin(9600); 17 lcd.init(); 18 lcd.backlight(); 19 pinMode(12,INPUT); 20} 21void loop() { 22 button=digitalRead(12); 23 /*lcd.setCursor(0,0); 24 lcd.print("Hello, world!"); 25 lcd.setCursor(0,1); 26 lcd.print("Hello, world!"); 27 lcd.setCursor(0,2); 28 lcd.print("Hello, world!"); 29 lcd.setCursor(0,3); 30 lcd.print("Hello, world!"); 31button=digitalRead(12);*/ 32/*lcd.setCursor(0,0); 33lcd.print("steps:-"); 34lcd.setCursor(0,8); 35lcd.print(s); 36*/ 37//Serial.println(button); 38//********************************************************** 39if(button == 1){ 40 if (hc12.available()) { 41 //int curr=hc12.read(); 42 Serial.print(hc12.read()); 43 ACres=220/curr; 44 ACpowW=220*curr*0.9; 45 showpower=220*curr; 46lcd.setCursor(0,0); 47 lcd.print("AC-current="); 48 lcd.setCursor(0,12); 49 lcd.print(curr); 50 lcd.setCursor(0,1); 51 lcd.print("AC-resistance="); 52 lcd.setCursor(14,1); 53 lcd.print(ACres); 54 lcd.setCursor(0,2); 55 lcd.print("AC-power="); 56 lcd.setCursor(9,2); 57 lcd.print(ACpowW); 58 lcd.setCursor(0,3); 59 lcd.print("Ac-S.power="); 60 lcd.setCursor(11,3); 61 lcd.print(showpower); 62 63 64 }} 65//********************************************************** 66else{ 67 if (Serial.available()) { 68 for (int i=0; i<=3; i++){ 69 arr[i] = Serial.parseFloat(); 70 } 71 72// char to_char[16]; 73// itoa(arr, to_char, 10); 74 } 75 float cur=arr[1]; 76 float volt=arr[3];*/ 77 Serial.println(cur); 78 Serial.println('\n'); 79 Serial.println(volt);*/ 80 res=cur/volt; 81 power=cur*volt; 82 lcd.setCursor(0,0); 83 lcd.print("Current="); 84 lcd.setCursor(9,0); 85 lcd.print(cur); 86 lcd.setCursor(0,1); 87 lcd.print("Voltage="); 88 lcd.setCursor(9,1); 89 lcd.print(volt); 90 lcd.setCursor(0,2); 91 lcd.print("Power="); 92 lcd.setCursor(7,2); 93 lcd.print(power); 94 lcd.setCursor(0,3); 95 lcd.print("Resistance="); 96 lcd.setCursor(12,3); 97 lcd.print(res); 98}}
part6
arduino
1#include <SoftwareSerial.h> 2SoftwareSerial mySerial(12, 13); // RX, 3 TX 4char x; 5void setup() { 6 // Open serial communications and wait for port 7 to open: 8 Serial.begin(9600); 9 //Serial.println("Goodnight moon!"); 10 11 mySerial.begin(9600); 12// mySerial.println("Hello, world?"); 13} 14void loop() 15 { // run over and over 16 if (mySerial.available()) { 17 x=mySerial.read(); 18 19 Serial.write(x); 20 } 21 if(x == 'a'){ 22 Serial.println("LED1 off"); 23} 2449 25 26 else if(x == 'A'){ 27 Serial.println("LED1 on"); 28} 29 else if(x =='b'){ 30 31 Serial.println("LED2 off"); 32} 33 else if(x == 'B'){ 34 Serial.println("LED2 35 on"); 36} 37 else if(x == 'c'){ 38 Serial.println("LED3 on"); 39} 40 else 41 if(x == 'C'){ 42 Serial.println("LED3 off"); 43}
part4
arduino
1int pin2,pin3,pin6,pin7,pin10,pin11; 2//................................................................................... 3void 4 setup() { 5 //and 6pinMode(2,INPUT); 7pinMode(3,INPUT); 8pinMode(4,OUTPUT); 9pinMode(5,OUTPUT); 10//or 11pinMode(6,INPUT); 12pinMode(7,INPUT); 13pinMode(8,OUTPUT); 14pinMode(9,OUTPUT); 15//not 16pinMode(10,INPUT); 17pinMode(11,INPUT); 18pinMode(12,OUTPUT); 19pinMode(13,OUTPUT); 20} 21//........................................................................................... 22void 23 loop() { 24 // AND 25pin2=digitalRead(2); 26pin3=digitalRead(3); 27//OR 28pin6=digitalRead(6); 29pin7=digitalRead(7); 30//NOT 31pin10=digitalRead(10); 32pin11=digitalRead(11); 33//........................................................................................ 34//THE 35 AND GATE 36if(pin2==0 && pin3==0){ 37 digitalWrite(4,0); 38 digitalWrite(5,0); 39 40} 41else if(pin2==1 && pin3==0){ 42 digitalWrite(4,0); 43 digitalWrite(5,0); 44 45} 46else if(pin2==0 && pin3==1){ 47 digitalWrite(4,0); 48 digitalWrite(5,0); 49 50} 51else if(pin2==1 && pin3==1){ 52 digitalWrite(4,1); 53 digitalWrite(5,1); 54 55} 56else{ 57 digitalWrite(4,0); 58 digitalWrite(5,0); 59} 60//............................................................................... 61//THE 62 OR GATE 63if(pin6==0 || pin7==0){ 64 digitalWrite(8,0); 65 digitalWrite(9,0); 66 67} 68else if(pin6==1 || pin7==0){ 69 digitalWrite(8,1); 70 digitalWrite(9,1); 71 72} 73else if(pin6==0 || pin7==1){ 74 digitalWrite(8,1); 75 digitalWrite(9,1); 76 77} 78else if(pin6==1 || pin7==1){ 79 digitalWrite(8,1); 80 digitalWrite(9,1); 81 82} 83else{ 84 digitalWrite(8,0); 85 digitalWrite(9,0); 86} 87//..................................................................................... 88//THE 89 NOT GATE 90if(pin10==0){ 91 digitalWrite(12,1); 92} 93else{ 94 digitalWrite(12,0); 95 96} 97if(pin11==0){ 98 digitalWrite(13,1); 99} 100else{ 101 digitalWrite(13,0); 102 103}}
Downloadable files
1_wCoNcoqHZH.png
this part1
1_wCoNcoqHZH.png
3_PevujUoveR.png
this part3
3_PevujUoveR.png
6_dhGy3Zt14N.png
this part5
6_dhGy3Zt14N.png
8_q3zUim7lEY.png
this part7
8_q3zUim7lEY.png
5_vc5WxOczl6.png
this part4
5_vc5WxOczl6.png
1_wCoNcoqHZH.png
this part1
1_wCoNcoqHZH.png
8_q3zUim7lEY.png
this part7
8_q3zUim7lEY.png
2_9nO8I2Nfbg.png
this is part2
2_9nO8I2Nfbg.png
6_dhGy3Zt14N.png
this part5
6_dhGy3Zt14N.png
9_XcYTSV4EVZ.png
this part8
9_XcYTSV4EVZ.png
3_PevujUoveR.png
this part3
3_PevujUoveR.png
7_yxhClKhTIh.png
this part6
7_yxhClKhTIh.png
9_XcYTSV4EVZ.png
this part8
9_XcYTSV4EVZ.png
10_nAL05194OT.png
this part9
10_nAL05194OT.png
2_9nO8I2Nfbg.png
this is part2
2_9nO8I2Nfbg.png
7_yxhClKhTIh.png
this part6
7_yxhClKhTIh.png
5_vc5WxOczl6.png
this part4
5_vc5WxOczl6.png
Comments
Only logged in users can leave comments