Automatic board

hello Do it with an arduino uno voltmeter and a relay to make the load load on the load automatically triggered by a 2s delay. 220v through the Raleigh and 220 Voltmeters seen(
Code) and need add in this code relay on when i light on arduino turning on relay
// Henry’s Bench TA-1200 AC Current Sensor Tutorial

int sensorTA12 = A0; // Analog input pin that sensor is attached to

float nVPP; // Voltage measured across resistor
float nCurrThruResistorPP; // Peak Current Measured Through Resistor
float nCurrThruResistorRMS; // RMS current through Resistor
float nCurrentThruWire; // Actual RMS current in Wire

void setup()
{
Serial.begin(9600);
pinMode(sensorTA12, INPUT);
}

void loop()
{

nVPP = getVPP();

/*
Use Ohms law to calculate current across resistor
and express in mA
*/

nCurrThruResistorPP = (nVPP/200.0) * 1000.0;

/*
Use Formula for SINE wave to convert
to RMS
*/

nCurrThruResistorRMS = nCurrThruResistorPP * 0.707;

/*
Current Transformer Ratio is 1000:1…

Therefore current through 200 ohm resistor
is multiplied by 1000 to get input current
*/

nCurrentThruWire = nCurrThruResistorRMS * 1000;

Serial.print("Volts Peak : ");
Serial.println(nVPP,3);

Serial.print(“Current Through Resistor (Peak) : “);
Serial.print(nCurrThruResistorPP,3);
Serial.println(” mA Peak to Peak”);

Serial.print(“Current Through Resistor (RMS) : “);
Serial.print(nCurrThruResistorRMS,3);
Serial.println(” mA RMS”);

Serial.print(“Current Through Wire : “);
Serial.print(nCurrentThruWire,3);
Serial.println(” mA RMS”);

Serial.println();

}

/************************************
In order to calculate RMS current, we need to know
the peak to peak voltage measured at the output across the
200 Ohm Resistor

The following function takes one second worth of samples
and returns the peak value that is measured
*************************************/

float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorTA12);
// see if you have a new maxValue
if (readValue > maxValue)
{
/record the maximum sensor value/
maxValue = readValue;
}
}

// Convert the digital data to a voltage
result = (maxValue * 5.0)/1024.0;

return result;
}

hello Do it with an arduino uno and current sensor and a relay to make the load load on the load automatically triggered by a 2s delay. 220v through the Raleigh and 220 Voltmeters seen

Image from Original Post Reply #1 so we don’t have to download it. See this Image Guide

69905ce4495f31ba9a31c26f9c8810776f7210b3.png

…R

Even after looking at the image I have no idea what this Thread is about. It's not even clear if the OP is asking for advice.

...R

Robin2: Even after looking at the image I have no idea what this Thread is about. It's not even clear if the OP is asking for advice.

It seems to me that the OP is just asking for the code to turn a relay on 2 seconds after the UNO turns on.

@Sharas, you appear to have edited your Original Post and have includes some code. To make it easier for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

And please tell us what the program actually does and what you want it to do that is different.

…R

Sorry about post. I want the vacuum cleaner to turn on automatically when the tool is turned oN. I using current sensor, relay and arduino uno. Please help. Need code

Sharas:
I want the vacuum cleaner to turn on automatically when the tool is turned oN. I using current sensor, relay and arduino uno. Please help. Need code

At least now we know what you are trying to achieve. That is always a good starting point.

You posted code earlier - are you still working with that? If not post your latest version.

And then you need to tell us exactly what happens when you run the program and what you want it to do that is different.

If you want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

…R

where the problem when the analog sensor is detected by the TA12 current is turned on by the switch, and after a while the power goes out. Where’s the problem?
int sensorPin = A0; // select the input pin for ldr
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(2, OUTPUT); //pin connected to the relay
Serial.begin(9600); //sets serial port for communication
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue); //prints the values coming from the sensor on the screen
if(sensorValue < 700) //setting a threshold value
digitalWrite(2,HIGH); //turn relay ON
else digitalWrite(2,LOW); //turn relay OFF
delay(100);
}

Where's the problem?

Lots of problems. Your post talks about reading a current sensor, and turning on a vacuum cleaner.

That code appears to be reading an LDR, and turning a relay on, with no indication which relay you are using, or how much current it need to be held in the on position.

Use meaningful names in the code. sensorPin is useless, as it says NOTHING about what sensor is connected to the pin. sensorValue is equally useless.

The comment, where the pin variable is declared suggests that the sensor is an LDR. If the comment is correct, then you need to explain exactly how the LDR is measuring current. If the comment is wrong, GET RID OF IT.