- #1
- 2,173
- 2,715
I am making a circuit with arduino that will read AC voltage supplied to the mains, and based on that value, control a solid state relay. As per my theory till date, if the AC is >=205 or <= 230V, the relay will be on, otherwise it will be off.
The circuits have been borrowed from here:
Now, I have been measuring AC supplied to our mains for some time, and it seems that I have some trouble. (In India, we get AC RMS at 220V to 230V, 50Hz, but goes down to around 200V when all the air-conditioners of the neighbouring houses are working). The voltage does remain strictly at some value; it is continuously varying by ##\pm##1V or 2V in a very short period, say 1s. And that is the difficulty. For example, if the voltage varies between 204V and 206V continuously, then the circuit will keep switching on and off the relay, and that will create some trouble for the appliance being controlled by the relay.
What I want to do is to simply round off the calculated voltage to the nearest lowest integer. In that way, I can easily get around with this problem.
Since I am not conversant in C programming, can anyone tell whether the floor() function will work in Arduino? What libraries do I need and how do I download them?
The circuits have been borrowed from here:
- AC voltmeter project with arduino
- SSR control with arduino (but without the fan)
Now, I have been measuring AC supplied to our mains for some time, and it seems that I have some trouble. (In India, we get AC RMS at 220V to 230V, 50Hz, but goes down to around 200V when all the air-conditioners of the neighbouring houses are working). The voltage does remain strictly at some value; it is continuously varying by ##\pm##1V or 2V in a very short period, say 1s. And that is the difficulty. For example, if the voltage varies between 204V and 206V continuously, then the circuit will keep switching on and off the relay, and that will create some trouble for the appliance being controlled by the relay.
What I want to do is to simply round off the calculated voltage to the nearest lowest integer. In that way, I can easily get around with this problem.
Since I am not conversant in C programming, can anyone tell whether the floor() function will work in Arduino? What libraries do I need and how do I download them?