Hi, i'm new to Arduino and am trying to figure out how to go about writing a sketch for my first project.
The project is for the automation of a dust collection system in a woodwork shop, i have 4 machines and would like to trigger 1; a 12v solenoid valve( there is one for each machine which controls a pneumatic cylinder to open and close the ducting to the machine) and 2; the central dust collector( shared unit between all machines, its connected to a variable frequency device which means it can be triggered with various inputs such as a 12v signal or multiple digital signals).
The plan is to set it up at arms length from the AC power as these are all high voltage 3phase machines.
I have an Arduino Uno, an 8 relay module, and 4 30a non invasive current sensors.
So far i have uploaded the If statement example and have it triggering one solenoid valve when there is a reading above 0 , although the readings from the current sensor are coming out as......
198
174
0
0
0
198
67
1
0
0
0
so its flickering on and off.
i feel like i understand the basic part of that sketch, but am unsure of a few things
1... how get either a consistent read or write for the current sensor
2.... how to write the sketch with the 4 different inputs( for example A0 A1 A2 A3) to trigger 1 digital out put each( the solenoid valves) and simultaneously have all 4 inputs trigger a common output to activate the dust collector.
im guessing this is pretty basic stuff for someone that knows what they're doing, unfortunately I'm struggling to find a tutorial for something like this.
As well as posting your program you will need to figure out why your sensors are not providing a steady output. Have you them connected correctly? (post a wiring diagram) What sensors are they? (post a link to the datasheet).
If you have not already done so I suggest you write a short program that just reads and displays data from the sensor.
I'm sorry, i didn't write it very clearly at all, so far im using the IfStatementConditional example sketch that comes with the arduino software.( attached) the only thing I've changed is the threshold value from 400 to 0.
Robin2:
As well as posting your program you will need to figure out why your sensors are not providing a steady output. Have you them connected correctly? (post a wiring diagram) What sensors are they? (post a link to the datasheet).
If you have not already done so I suggest you write a short program that just reads and displays data from the sensor.
...R
The sensors are SCT-013-030 non invasive 30a current sensor.
It clips around the power cable, I've tried it on all three phases and i still get the same result, 2 lines of data and 3 lines of zero's.
It comes with a 3.5mm plug installed , i cut that off and have the white connected to the gnd on the Arduino and the red into A0.
I have no idea how to go about writing a program to read the sensor, I've just been reading it with the serial monitor.
DrAzzy:
It looks like there's a pattern to the data you posted from the sensor. Does that pattern continue?
there is definitely a pattern, its generally 2 lines of data and 3 lines of zeros, though occasionally it can be 2 lines of zero or 4 lines of zero and yes it continues indefinitely.
So i have tried adapting the ifstatementconditional sketch to add pins A0-A3 and output pins 2345 as constants but it returned lots of errors , I'm not quite sure how to go about writing a sketch with multiple in and outputs.
Also is there a way to have the read values as say an average of x amount of lines that way the sporadic read from the sensor wouldn't be a problem?
That explains a lot. You try to measure an AC line. The current in that line is AC as well. So the output of the current transformer (that your sensor) is AC as well. That makes things a little harder...
Look up "Several things at once", then look to read the data, and set a flag and a time, re read the data, and if the flag is set, the data is zero, and the time is greater than it took to get past say two periods of 3 zeros, turn off. If teh flag is set, and the data is not zero, update the timer.
The idea is that if you have a zero period ignore it unless it is longer than a set idle time.
Thanks Paul, from what i gathered when selecting this sensor the 30A version has a burden resistor in it, where as the 100 amp which that page is describing doesnt have a burden resistor. Is that not correct? the output of the 30A is 0-1v
Maybe you're right, but I suspect you would still need the other resistors and cap to provide the bias voltage to prevent the analog input going negative every cycle, and either use the library linked on that page, or write your own code to perform the same function. I guess that library takes many readings over several complete mains cycles and does some statistics.