Go Down

Topic: 230V AC controll with arduino and relays (now dead arduino) (Read 5 times) previous topic - next topic

fca

Aug 13, 2011, 01:56 am Last Edit: Aug 13, 2011, 02:53 am by fca Reason: 1
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


Magician

#1
Aug 13, 2011, 02:11 am Last Edit: Aug 13, 2011, 02:31 am by Magician Reason: 1
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?

fca

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

Magician

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?

fca

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

Magician

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

Magician

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.

fca

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 ;)

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.... :(
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 ??

...





               

Magician

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.

tsenior

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

fca

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

dc42

#11
Sep 07, 2011, 01:41 pm Last Edit: Sep 07, 2011, 01:44 pm by dc42 Reason: 1
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.
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.

fca


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

dc42


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.
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.

fca

#14
Sep 15, 2011, 04:31 pm Last Edit: Sep 15, 2011, 05:26 pm by fca Reason: 1
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


Go Up