Hello .. Can you help me with my project. In my project, have current sensors, touch sensor and half bridge sensor. So i need to connect all together with wifi module and make GUI. Can you hfelp me the coding to combine all the sensors with wifi module.
TOUCH SENSOR CODE:
void setup()
{
Serial.begin(9600);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
}
void loop()
{
int touch1=digitalRead(2);
int touch2=digitalRead(3);
int touch3=digitalRead(4);
int touch4=digitalRead(5);
if (touch1== HIGH)
{
Serial.println("1 is pressed");
}
delay(200);
if (touch2== HIGH)
{
Serial.println("2 is pressed");
}
delay(200);
if (touch3== HIGH)
{
Serial.println("3 is pressed");
}
delay(200);
if (touch4== HIGH)
{
Serial.println("4 is pressed");
}
delay(200);
}
CURRENT SENSOR CODE :
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
const int currentPin = A0;
int sensitivity = 66;
int adcValue= 0;
int offsetVoltage = 2500;
double adcVoltage = 0;
double currentValue = 0;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(" Current Sensor ");
lcd.setCursor(0,1);
lcd.print(" with Arduino ");
delay(2000);
}
void loop()
{
adcValue = analogRead(currentPin);
adcVoltage = (adcValue / 1024.0) * 5000;
currentValue = ((adcVoltage - offsetVoltage) / sensitivity);
Serial.print("Raw Sensor Value = " );
Serial.print(adcValue);
lcd.clear();
delay(1000);
//lcd.display();
lcd.setCursor(0,0);
lcd.print("ADC Value = ");
lcd.setCursor(12,0);
lcd.print(adcValue);
delay(2000);
Serial.print("\t Voltage(mV) = ");
Serial.print(adcVoltage,3);
lcd.setCursor(0,0);
lcd.print("V in mV = ");
lcd.setCursor(10,0);
lcd.print(adcVoltage,1);
delay(2000);
Serial.print("\t Current = ");
Serial.println(currentValue,3);
lcd.setCursor(0,0);
lcd.print("Current = ");
lcd.setCursor(10,0);
lcd.print(currentValue,2);
lcd.setCursor(14,0);
lcd.print("A");
delay(2500);
}
HALF BRIDGE LOAD CELL CODE:
#include "HX711.h"
HX711 scale(5, 6);
float calibration_factor = 48100; // this calibration factor is adjusted according to my load cell
float units;
float ounces;
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(units);
Serial.print(" kg");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
delay(500);
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
Wifi Code :
void setup() {
// initialize digital esp8266 gpio 2 as an output.
pinMode(2, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
And tell me how to connect wifi with GUI . THAN YOU