CAI Webcontrol Analog-In noise issue

Hello, I have a webcontrol board I'm using to control off-grid battery charging and other various devices. I bult a voltage resistor divider to reduce my 24V battery system down to a 0-10V scale. So A/I see's 0-10V from battery range 0-32V. Not perfect since I really only need 21-32V resolution but I couldn't fiure out how to turn 21V-32V to A/I 0-10V. Anyway the A/I bounces +/- 1 volt which causes major issues when I want to trigger devices at a certain voltage. When it gets close to the trigger voltage my TTL output toggles my relays on and off with the noise. I tried to make a software filter with the PLC code but couldn't get it to work. Any advice to reduce the noise thru PLC code or other? I also tried to write the code to say if the volatge has been below a certain setting for sometime then trigger. But that did not work either.

Thanks..
 
So you are saying that the input value on the CAI bounces up and down by 100?

If indeed that is what you mean, I think it is highly unlikely that the cai is making bad readings. I suspect there is some issue with the device you made to convert 0-32v into 0-10v. Have you measured the voltage using a standard volt meter instead of the cai?
 
The A/I (0 - 1024) bounces around about 40 (total range). In the PLC code I convert using simple math the 0-1024 A/I into the 0-32 (actually 0-320 becuase can't use decimals) and place into VAR so it displays the real voltage. Using the math offline that 40 count bounce does turn into ~1V bounce when back calculated to real voltage for my VAR1, as it should becuase of the scaling.

I measured the source voltage and the voltage after the resistor divider and they only bounce (using voltmeter) about 0.01V. A 0.01V bounce after the voltage divider and at the A/I should only give <3 count bouce (from 0-1024) and a <0.1V bounce in my VAR1 display. I also tried another A/I and same issue. I also used 2 A/I's and averaged them and same issue.

PLC code I used to average 2 A/I's with the math to display actual voltage (10x) in VAR1.

ADD AIP1 AIP2 RAM1
DIV RAM1 2 RAM1
MUL RAM1 400 RAM1
DIV RAM1 1024 RAM1
SET VAR1 RAM1
Grounding issue?
 
So from the standpoint of the cai, it is giving you a .4 v bounce (40 points on its scale). But the cai is way more accurate than that. Mine typically only bounces +/- 1 digit (.01v).

I would try testing the cai using other known steady source of voltage. Like a 9v battery. If that doesn't bounce, then you know it has something to do with your voltage reducing scheme.
 
Good idea. So I connected a 9v battery from A/I to A/I-gnd. The A/I bounce(noise) was about 35+ count range (~0.35V). Still way higher than yours. It appears the A/I noise issue is unrealated to my voltage divider or the PLC code.

For sanity sake with a voltmeter I checked by CAI input voltage, was 9.14V, noise was 0.01V. I checked the digital out voltage, was 4.94, noise was 0.01V
 
One question, if you disconnect the AUX connector, what is your reading? Does it still have 35 or so bounces? I think it is likely the cable picked up some noise somewhere.

What is your resistor values when you divide the voltage? We did published the resistors used on WebControl board for its to divide the input voltage. If your resistor value is too large, it may easy to pickup some noise. Anyway, if you pull out the AUX connector, that will be a good indication of A/I actually fluctuate by itself or not.
 
Thanks for the quick response. If I pull the AUX connector out (unplugging the A/I) the floating A/I bounces from 0 to 5 but mostly 0 to 2. My divider is using a 5K potentiometer tuned to 1250-ohm and 3750-ohm on each side. The center tap feeds the A/I and the outer legs are Vin and GND. I use a potentiometer so I can fine tune the voltage divider if needed. Is 5K ohm to much? If I use smaller overall resistance on the divider then I waste energy and need higher power rated resistors(potentiometer).
 
You may have some crosstalk between the wires plugged into the aux jack. Did you make the plug yourself? Perhaps you could redo the wire or buy a new one? I did have to remake one of mine once as it was leaking from adjacent wires. I remade it and it worked as expected.
 
Thanks for the quick response. If I pull the AUX connector out (unplugging the A/I) the floating A/I bounces from 0 to 5 but mostly 0 to 2. My divider is using a 5K potentiometer tuned to 1250-ohm and 3750-ohm on each side. The center tap feeds the A/I and the outer legs are Vin and GND. I use a potentiometer so I can fine tune the voltage divider if needed. Is 5K ohm to much? If I use smaller overall resistance on the divider then I waste energy and need higher power rated resistors(potentiometer).

From you described, the noise was picked up from your side of circuit. If the wire exposed to some noise, adding some capacitors could help filter out some of the noises. Using shield cable and wires also help reduce the noise level. Sometimes the potentiometer can introduce noise also, due to its contact are not solid on one value. If you set a good value for your needs, maybe replace the potentiometer with fixed resistor networks. Uses good quality metal film resistor can reduce the noise. Carbon resistor could have larger noise level, avoid using low quality resistors.
 
OK so I can't figure out this noise issue. When I connected up a 9v battery direclty to the A/I I still get noise. That eliminates my PLC code and voltage divider as the issue. I changed the connector and no luck. So one way around this is to write PLC code to only trigger if the A/I voltage has been below a certian value for a set length of time. So as the input voltage drops the A/I would have to pass thru the trigger point and far enough to below that the noise doesn't toggle on either side of the triigger point. However I can't get this to work becuase the code isn't working.

So this code should mean; Set OP6 only of VAR1 has been below 230 for more than 100sec. (230 meaning 23V)
TSTLT VAR1[100000] 230
SET OP6 1

But when I add the [100000] delay after VAR1 it does nothing, no trigger no matter what the voltage. I've had success when adding the [100000] daley after an OP but it doesn't seem to work for AIP or VAR values. Will a non-blocking time delay after a AIP or VAR value work or do I have the code wrong?

Thanks.
 
Did you try to add a capacitor to filter out line noise? How often does your analog input change? what distance is your wire connection to the AUX connector? If there is RF power source nearby, the wires can act as antenna.

I think the non-blocking delay only working for input/output/var. It does not work for AIP, according to the manual. What is your logic from AIP to VAR1?
 
Did you try to add a capacitor to filter out line noise? How often does your analog input change? what distance is your wire connection to the AUX connector? If there is RF power source nearby, the wires can act as antenna.

I think the non-blocking delay only working for input/output/var. It does not work for AIP, according to the manual. What is your logic from AIP to VAR1?

Analog noise movies about every <1sec or so. Wire from V source to A/I are about 1meter long. No RF source nearby. What size/type capacitor and where should I put it, between A/I and Gnd?

Here's how I get from AIP to VAR1. This math converts the A/I signal into the real voltage number. I average 2 AIP's to reduce noise but doesn't help much.

ADD AIP1 AIP2 RAM1
DIV RAM1 2 RAM1
MUL RAM1 400 RAM1
DIV RAM1 1024 RAM1
SET VAR1 RAM1

So still a mystery why this code with 100sec VAR1 verification delay doesn't work.
TSTLT VAR1[100000] 230
SET OP6 1
 
Because you are measuring a battery system, its change in voltage probably not takes place at pretty slow pace. Your charge system could put spike on the line. You should add a 0.47uF or 1uF capacitor behind your resistor voltage devider. Make sure use good quality capacitor, so that the leakage from the capacitor will not impact your resistor network much.

Your code:
ADD AIP1 AIP2 RAM1
DIV RAM1 2 RAM1
MUL RAM1 400 RAM1

could be changed to:
ADD AIP1 AIP2 RAM1
MUL RAM1 200 RAM1
Since RAM is 32 bit signed integer, AIP is 10bit integer, it is best to multiple first to retain the best accuracy.

Because the logic is using non-blocking delay, each time the noise spike going higher than 230 on VAR1, the delay will start all over again. So you will see your logic never get triggered. That is the design of non-block delay. In another words, if during this 100S delay, if your input level ever higher than 230, the delay is reset and starting another 100 seconds.
 
Because you are measuring a battery system, its change in voltage probably not takes place at pretty slow pace. Your charge system could put spike on the line. You should add a 0.47uF or 1uF capacitor behind your resistor voltage devider. Make sure use good quality capacitor, so that the leakage from the capacitor will not impact your resistor network much.

Your code:
ADD AIP1 AIP2 RAM1
DIV RAM1 2 RAM1
MUL RAM1 400 RAM1

could be changed to:
ADD AIP1 AIP2 RAM1
MUL RAM1 200 RAM1
Since RAM is 32 bit signed integer, AIP is 10bit integer, it is best to multiple first to retain the best accuracy.

Because the logic is using non-blocking delay, each time the noise spike going higher than 230 on VAR1, the delay will start all over again. So you will see your logic never get triggered. That is the design of non-block delay. In another words, if during this 100S delay, if your input level ever higher than 230, the delay is reset and starting another 100 seconds.

I changed the code to not DIV and added a 0.1uf and 4.7uf caps on the A/I side of the voltage divider. (didn't have a 1uf handy). Possibly a very small improvment but still very noisy A/I. The wire from the divider and capacitors to the A/I on the webcontrol board is only about 10cm.

My point with the non blocking delay is like this. When my monitored voltage (VAR1) drops to a set point I want to trigger some output. But the noise makes it turn on and off when near the trigger setpoint. So if I can set up a delay to say if below VAR1 230 for more than 100s then trigger. The result would likely be that the trigger won't go until the VAR1 average signal reaches 220 becuase thats far enough below so the noise doesn't go above 230. This is OK becuase I can adjust the trigger point higher. However I can not get the delay code to work with the VAR1 value.

TSTLT VAR1[100000] 230
SET OP6 1
That code does nothing and OP6 never goes to 1 even if VAR1 is <210 for way past the delay time. Does the non-blocking delay work with VAR values?

Thanks.
 
Back
Top