Jump to content

My new project which is Nodemcu, SCt-13 is working it senses current at 2 5 amps to 0 amps


G+_Rud Dog
 Share

Recommended Posts

My new project which is Nodemcu, SCt-13 is working it senses current at 2.5 amps to 0 amps. And will print out once either Washer "ON" or "OFF". The key here is it only does it once for either condition.

The next step was to find how to get the sketch programmed to allow it to talk with IFTTT. Boy did that turn out to be a nightmare. Apparently, there is not a way to simply place the IFTTT trigger inside my IF statement. The samples I find include coding I don't understand and having trouble extracting the "trigger" portion from these wildly complicated sketches. If you know of any sites where I can read up or watch a video explaining how to do this "simply" please comment.

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Hello. Is this a new project, or the same one you posted about two weeks ago? If the same one, I hadn't heard you mention it so I thought you figured it out.

In order to help you (if we can) please update us on any changes you've made, or just give us a link to the code you're using now.

As a start, I would like to take your above message and work on the first paragraph first. Once you get it working locally, we can look into IFTTT or other remote options.

Link to comment
Share on other sites

John Sullivan Still working on the project. Have managed to solve the settling time. Also got the current sensor to show on for 2.5 amps and off when current goes below .01 amps. The key here is only does it once there by avoiding repeated serial monitor postings. Now the task it getting the if statement when at zero amps to send IFTTT message to my phone. I am using Pushbullet. So far I have adopted others code but just can't figure out how to adopt it to my code.

Here is the simple code for sensing current.

pastebin.com - [C++] 115 Volt AC current sensing sketch - Pastebin.com

Link to comment
Share on other sites

I looked at your code, but need to clarify some things, please. For one, you declare an int named "On" and set it to zero, but I don't see where you use that in your code.

Second, please clarify what "washer" is. Are you talking about a clothes washer, or something else?

As you're monitoring current, I presume this is the current drawn by a washing machine, and the code is supposed to detect if it is running or not?

What determines if washer == 0 or washer == 1?

You start by setting washer = 0, and then in your first IF statement say "AND washer ==1" which pretty much negates the first IF statement.

Your first IF statement also depends on Irms being greater than 2.4, and your next IF statement depends on Irms being less than 0.5, but I don't see what response you expect when Irms is between those values.

 

Link to comment
Share on other sites

John Sullivan The declaration of the "ON" you call out :

"For one, you declare an int named "On" and set it to zero, but I don't see where you use that in your code."

This is left over from other coding attempts to get this working just forgot to delete it. I updated the linked sketch and commented it out.

 

Second, please clarify what "washer" is. Are you talking about a clothes washer, or something else?

115 Volt AC washing machine.

 

As you're monitoring current, I presume this is the current drawn by a washing machine, and the code is supposed to detect if it is running or not?

This is correct. An exception; really not important we are notified of the washing machine starting just when it stops. Therefore there will be the only one pushed notification and that will be when the current draw is zero. (Once the device is up and running)

 

Determining "if washer == 0 or washer == 1" comes from an old mechanical stop-start switch on most table saws. If you haven't seen or know how this setup works it is nothing more then a flip-flop type action. I will place some more comments in the code to explain what is happening. This will probably either share how it works or wake me up to what it is actually doing. Will post link to the modified/commented code.

 

pastebin.com - [C++] 115 Volt AC current sensing sketch - Pastebin.com

 

Link to comment
Share on other sites

John Sullivan here is how the board is wired to the SCT-013 and be aware the schematic did not have a direct symbol for this device so used what you will see called out at T1.

Also, this is an older schematic and the values for R1 and R2 have been updated. Don't have the values handy but they set up the voltage at the input to .5 volts DC.

pasteboard.co - External circuit - Image on Pasteboard

Link to comment
Share on other sites

Rud Dog Yes I do know how a mechanical start-stop switch works, and I know that the usual convention is that "1" means On and "0" means Off.

What I'm curious about is, for example, your first IF statement tests both to see if the reported Irms is less than 0.5 AND if the variable named "washer" is in the 1 state. If that was to be TRUE, your code sets washer=0.

So, what you code seems to be saying is if the washer is ON, report it as OFF.

Your second IF statement says that if the reported Irms is greater than 2.4 and less than or equal to 2.5 AND the washer is reported as OFF then report the washer as ON.

Seems to me it would be simpler to :

IF(Irms < 0.5)

Serial.println("Washer is OFF");

washer=0;

ELSE

Serial.println("Washer is ON");

washer=1;

Link to comment
Share on other sites

John Sullivan again thank you for helping out enjoying the interaction. What I am looking to do is called out at the beginning of this post. When the "IF" statement is true I would like to carry out code that runs an IFTTT recipe.

 

if (Irms < 0.5 && washer==0)

{

Serial.println("Contents Washer OFF");

washer = 1;

Serial.println(washer);

Serial.println(Irms);

Here I would like to see code calling IFTTT recipe

and relaying to Pushbullet "Washer is done".

Unfortunately, this is not as simple as it sounds, to me anyway.

}

Link to comment
Share on other sites

Rud Dog Hello. I don't think we're communicating here. Yes, I understand that you want to trigger an IFTTT event, but that is later down the road.

Right now, I'm not understanding the logic of your code.

Let me start with the line:

if (Irms > 2.4 && Irms <=2.5 && washer==1)

Let's leave out the washer ==1 part for just a moment.

So, this line is saying "if the Irms is greater than 2.4 and if the Irms is less than or equal to 2.5"

That means that this line of code is only true if the Irms is 2.4 or 2.5, or somewhere in between the two?

It might help me understand what you're trying to do if I could see the output of your code to the Serial Monitor.

When the code first starts, does the Serial Monitor show values above 3?

What does it show after the current "settles" and while the washer is running? 2.4? 2.5? or what?

Just out of curiosity I've ordered one of these from Amazon, but it won't get here until some time between Dec 6 and 11

Link to comment
Share on other sites

John Sullivan here you go output from the serial monitor with my

comments inserted.

 

When the device is first turned on or after reset you will see:

Current settling

Current settling

Current settling

Contents Washer OFF

1

0.22

 

 

The next three lines show what the code does when I turn on the appliance.

Contents Washer ON

0

2.48

 

These three lines are what show when the power is turned off to the

appliance.

Contents Washer OFF

1

0.27

 

There you have it the output of the com serial port output when the sketch is run.

Link to comment
Share on other sites

John Sullivan good to hear back from you.

As far as the "code pages" I was looking at they were all over the board showing examples of different kinds of push statement. What I did is scan over them to see if I understood them and if not moved on.

Didn't keep a list of sites while I was scanning code.

The basic idea here is to run the code when the zero current section is run and that would be the zero if statement. Then push a notification out to IFTTT. After which the other half of IFTTT will trigger Pushbullet and send a notification to my phone.

This is the missing part of the puzzle. I continue to search for anyone that has coded this part of the sketch allowing me to see the method used.

Link to comment
Share on other sites

 Share


×
×
  • Create New...