Pages: [1] 2   Go Down
Author Topic: 230V AC controll with arduino and relays (now dead arduino)  (Read 4698 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there
I have arduino uno controlling the on/off of a battery charger (UPS)  what arduino does is sensing the battery voltage and when batteries are low it closes the relay and the the charger start to charge the batteries when batteries are at 29V it opens the relay and the charger power off...

This is the main function but for adding some information arduino has the following connections:

pin 8 - Relay in
Pin A3 - Acs714 (reading amps charged /discharged)  <- reading it at DC side of the charger...
pin A5/a4  a RTC ds1307
All the above  are connected to 5v arduino and gnd

Pin a0 - voltage divider to read batt voltages



i'm using this relay board



It have all the diode protections to the pin8 you can see it here


A few days i changed the charger/ups for a new model, but arduino don't have any connection to the charger beside the on/off of the relay that connect the charger to the mains plug...
But the arduino start to behave strange some times it hang other time it only come back after poweron/off..
And i start to see that this behaviour  was when i closed the charger circuit (charger connected to the mains)...
now last day it died and never wakeup...
My afraid is that being the batt charger a inductive load some kind of current peak on the relay....
But i have a 10amp 250vac relay and my charger is at maximum 4 amp....

How can i protect arduino even more , put a diode on the 5v power that give power to the relay board???
only a coincidence and arduino died  ??

Please comments and suggestions so i wont fry my last arduino......

Regards

« Last Edit: August 12, 2011, 07:53:26 pm by fca » Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More info required:

pin 8 - Relay in                                                                    
Pin14 - Acs714 (reading amps charged /discharged)             <<<-----how it wired, pin14?
pin A5/a4  a RTC ds1307
All the above  are connected to 5v arduino and gnd

Pin a0 - voltage divider to read batt voltages     <<<-----have you ever measure by DMM?
« Last Edit: August 12, 2011, 07:31:12 pm by Magician » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
pin 8 - Relay in                                                                   
Pin14 - Acs714 (reading amps charged /discharged)             <<<-----how it wired, pin14?
pin A5/a4  a RTC ds1307
All the above  are connected to 5v arduino and gnd

Pin a0 - voltage divider to read batt voltages     <<<-----have you ever measure by DMM?
 

Sorry not pint 14, but anlalog pin 3 A3...
the acs714 kit from http://www.pololu.com/catalog/product/1187

yes i measure it and is on more less 10 to 1 so when my batts are at 25v i see ~2,5v and i was working fine ...

thanks
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Current sensor looks nice to me, slightly overrated, but not much.
The only entry point that disturb me, is your voltage divider at A0, what are resistors?
Next, where arduino getting power from?
And could you post a link for a new charger, where a can get a specification?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can see my divider here
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288614795/1#1
But is 10k & 1k.

Arduino is getting  power from USB that is coming from a pc powered by the ups that arduino is controlling.

Charger is apc ups1500
http://www.apc.com/resource/include/techspec_index.cfm?base_sku=sua1500i
Thanks
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Difficult to say, but if there is a list of potential causes, I'd put analog input from voltage divider on top of the list. There are many possibilities, when it could be dangerous:
 - lost contact with ground;
 - "turn over" divider by mistake;
 - negative voltage coming when error with battery polarity;
 etc.
To prevent problem with another arduino, some protection circuitry has to be implemented, resistors + schottky diodes or resistor + zener for  input.  Best of all would be complete galvanic insulation voltage reading by OPA + optocoupler:
http://ruggedcircuits.com/html/circuit__24.html
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is one more things I still couldn't get:
if arduino getting power from computer, which consequently getting power from UPS,  so where power coming when battery charged and UPS is off?
Are the moments when arduino is powered off but still connected to voltage divider?
If so, there is a problem, incoming current = 30 V / 10 kOhm = 3 mA.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi ..
Ups is never off...
Ups is ruining as inverter for my solar panels... so i need it work in reverse of what a normal ups does, normal ups behaviour:

1- company power exist  ?
 yes--  charge batteries and bypass all other power to load...
  no-- - run from batteries

I' doing the in reverse, by default i'm running on batteries and if the batt voltage drops to 40% (~23v on my 24v system) then connect ups to company power ...
Beside this when the morning comes and sun start to shine ... i start to charge the batteries with solar panels and the power is cutted from ups...

and who is doing all  this ?? my friend arduino smiley-wink

It was working fine withe an apc 1000Va ups i changed to this new 1500 and problems started...
Now i replaced the arduino board and the problems of lost conection arduino crashes when cutting power (relay nc) where the same.... smiley-sad
 afterrrrrrrrrrrrrrrrr hours of troubleshoot on the solution what solved was replacing the usb cable........(amazing).........
now even if the usb cable was the problem why did the other arduino died ? why ??

...





               
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IMHO, could be SCR latch-up of microcontroler,  but as they say, only autopsy can answer the question. Meantime, I'd be cautious of situation when external signals present at the input/output of the arduino during power up/down transition process. It would make sense to disconnect voltage divider from input by relay, if arduino loosing a power for some reason.
Logged

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i would always use optocoupler for your setup with mains ac then it completely separated from your ardunio, i just purchased 50 i could post you some if you want
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have clue how o use them where would they fit ?
And for what propose !?
Please let me know ...
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My guess is that it's an earthing problem. If you are powering the Arduino from USB then Arduino ground is connected to mains ground via the PC. Unless the battery in the UPS is floating, one side of it is also likely to be grounded. Assuming you have Arduino ground connected to the same side of the battery, this gives you an earth loop and you are likely to get big transients flowing around it.

The solution is not to connect the Arduino to the PC and the battery at the same time. You can power the Arduino from a battery, or indirectly from the battery whose charge you are monitoring.

The other thing to make sure of is that the Arduino pins that sense the battery voltage and current are protected by series resistance. This will prevent them from damage and SCR latch-up. For the voltage sense pin, just use large enough value resistors, e.g. 10K to ground and ~90k to battery. For the current sense pin, use a series resistor of 10K or more. You could use higher values to be safer (e.g. 10x higher), but then you need to take account of the issues when you switch between reading different analog inputs that are fed from high resistance sources.
« Last Edit: September 07, 2011, 06:44:00 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My guess is that it's an earthing problem. If you are powering the Arduino from USB then Arduino ground is connected to mains ground via the PC. Unless the battery in the UPS is floating, one side of it is also likely to be grounded. Assuming you have Arduino ground connected to the same side of the battery, this gives you an earth loop and you are likely to get big transients flowing around it.

Yes arduino is connected to batteries ground and to the usb port of the  pc that is receiving the ac power from the ups so i have gnd from the batts and gnd from the ac part of the ups..

The solution is not to connect the Arduino to the PC and the battery at the same time. You can power the Arduino from a battery, or indirectly from the battery whose charge you are monitoring.
I can (and will) power arduino from the batteries just waiting for my lm2596 to arrive to sted down the 24v to 9v so i can power arduino from it...
But i will need to keep the usb cable connected because i'm controlling and receiving information from arduino on the pc side...

The other thing to make sure of is that the Arduino pins that sense the battery voltage and current are protected by series resistance. This will prevent them from damage and SCR latch-up. For the voltage sense pin, just use large enough value resistors, e.g. 10K to ground and ~90k to battery. For the current sense pin, use a series resistor of 10K or more. You could use higher values to be safer (e.g. 10x higher), but then you need to take account of the issues when you switch between reading different analog inputs that are fed from high resistance sources.
the voltage sensor is done by a 10k&1k voltage divider, can you explain me how  do i connect that resistor protection ?

voltage divider

thanks
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the voltage sensor is done by a 10k&1k voltage divider, can you explain me how  do i connect that resistor protection ?

Just increase the resistors to 100K and 10K, or to 100K and 1M, so as to increase the effective series resistance. You could also connect a 100nF capacitor between the Arduino pin and Arduino ground to reduce noise and help suppress any transients.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, i'm still after this, because i'm starting to have the same problem ...
when i disconect /connect the ups to the mains by closeing or opening th relay sometimes the arduino stop responding...
now i see that its not the arduino that crashes/reset as all only the "serial part" i mean the arduino keep runing and doing what it should be..
Only the seria/usb part get broken the tx led stays on and i lost comunication the pcside to arduino...
i can only have connection back after taking the usb cable out and in again ....  (strange)...

another strange issue, when i measure voltage divider when the bat is at ~26v gives 2,364v, and this happens when arduino have power...
When i disconnect arduino from power i read on the voltage divider output something like 1.3v....
why ? something to do with analog pin ??

Regards

Here is s picture of +/- the all solution

« Last Edit: September 15, 2011, 10:26:42 am by fca » Logged

Pages: [1] 2   Go Up
Jump to: