pic and 48 volt battery bank LVD

celticones

New Member
hi there i am new to this world of the pic. SO i wonder if its possible to build a 48 volt lvd circuit to use on a wind turbine battery bank connected to an ups , .It would probarbly cut of at about 48 volt and cut back in at around 50 ,i would need to use a relay on the on and off outputs to operated the switch on the ups..the On relay would need to have a time of about 4 seconds. So is it possible, what pic is suitable? All help is most appreciated thanks.
 

Rickharris

Senior Member
What exactly do you need the microcontroller to do:

I am guessing:

1 cut off the supply at 48 volts
2 Turn supply back on at 50 volts
3. Control a relay connecting the turbine to the ??/


I don't understand the relay actions - why on for 4 seconds? when I gather you want it to switch at a certain voltage??

I suspect the piceaxe will resolve your problem. Have you read the 3 manuales supplied as PDF files ad available at the top of this page.

Your programming requirements do not sound difficult, involving perhaps as few as time (wait/pause), READADC and High and LOW commands BUT you should have a look to see what is involved youself.
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE Forum.

Almost any PICAXE should be suitable for what you need.

To interface the high voltage to be within the PICAXE limits you should be able to use a simple potential divider and read the voltage using an analogue (ADC) input channel. You may need to add protection to clamp the voltage so it does not rise above the PICAXE limit - that may be possible using simple Zener clamping.

You are dealing with relatively high voltages and presumably high current capabilities so usual safety issues apply, though a PICAXE solution should not have many more issues than using a purely hardware solution.
 

Dippy

Moderator
As hippy says, just about any PICAXE should be able to do what you want.
But extra electronics will be required.

Best that you refer to PICAXEs rather than PIC - not exactly the same.

I can't say that I fully understand what you are trying to achieve. It all sounds a bit muddled. Remember, you know what you are doing (hopefully). But we have to try and understand it in the space of a few minutes from what you describe.

Lastly, what is your electronics experience? And what is your programming experience?
Total novice? School level? Media Studies Student? :)
Then people will know how to pitch their answers.

So, give us a drawing of the system.
What will power the PICAXE circuit?
What is your budget?
And list the actions / functions. (Note, that listing your functions clearly will also help YOU to plan the actual programme code).
 

celticones

New Member
48 volt lvd and picaxe

ok thanks for the answers, ok so i have a basic understanding of electronics, and electricity, not very advanced. But i like to have a go, and i cant purchase such a unit..So i want to use this project as a step to get an understanding of the picaxe.
The ups i am using as an inverter its apc 2200. there are two switches on the front on and off, The on switch requires to be held on for about four seconds to start the unit.. the off switch is instant requiring not to be held hence the timed operation. So hope fully when the batteries 4 12volt connected in series reach 48volt the unit will disconnect the ups, only starting it again when the turbine has charged them up to about 50 volt.
Also i am just thinking here that i would have to add some timer to the voltage sampling to allow for surge when i switch on a load ,
I must say that we live off grid and have a very modest power requirement ,generating our power from 1 kw turbine and a few solar panels.
 

celticones

New Member
there are two switches on the ups the on switch requires to be held for a few seconds to activate . but the off switch is instant .
 

Andrew Cowan

Senior Member
Sounds simple enough.

I'd use an 14M - large enough to have some status LEDs too.

If I were you, I'd read the manuals well (as suggested above), and buy a 14M project board to experiment with (before completing this circuit).

A
 

celticones

New Member
voltage divider resistors

ok so a plan is forming ...slowly the manual is brilliant, so as far as i can see i need to build a voltage divider for the 48 volt input from the battery bank to keep the adc voltage to five volts. But as this for a windturbine charging circuit the in voltage could be as high as 58 volt which is set by the charge controller.
So for the adc calculation do i use the 58 volt max expected as value 255 and 0 volt as value 1.
As for the divider resistor values are there any restrictions on the total values (r1 +r2) or whether r1 or r2 are the top leg (nearest the suppy voltage)
 

MartinM57

Moderator
You're on the right lines..and looking at the other post correctly as well.

I'd allow for a 65v input to be safe, so you want a divide-by-13 divider - have a play with the second calculator at http://www.electronics2000.co.uk/calc/potential-divider-calculator.php

You then need to think about resolution. If 65V = 255 on the ADC, then what are 48V and 50V? Do you think that the difference is enough to reliably detect?

Would it make any difference if you used READADC10 instead? (Hint: trick question)

What would happen if it wasn't pure DC and varied a bit - over a second or so, or what it had some superimposed ripple caused by the mechanics of the turbine?
 

celticones

New Member
thanks for your help
ok so i read in the datasheet that the input impedence is 20k for the 08m picaxe.
so using the calculator that gives R1 at 18.7 k and R2 1.286 k thats using input volts as 70 and a output to the adc as 4.5.
#
I see that the 08m has readadc10 bit so if i use that it will be more adjustable to set up.. i think:). Its all new here after over fifty years so the brain needs to take things slowly....
Am i right so far?.....
 

hippy

Ex-Staff (retired)
It may be possible to reduce the top leg of the potential divider and clamp the voltage going into the ADC with a zener.

Say with a 4V7 zener you could have 50V being seen as 4V5, any charging voltage above <whatever>V would then clamp at 4V7, but as that is above the 50V upper limit required to be read it wouldn't matter.

You'll need someone better versed in zeners than me to say what values of resistor would be suitable and confirm this would work.
 

MartinM57

Moderator
so i read in the datasheet that the input impedence is 20k for the 08m picaxe.
Haven't read it myself but there is usually a statement about the maximum source impedance you should use - usually in the region of less than 10K.

So your potential divider has to have an output impedance of 10K or so.

How do you calculate it? Either from first principles (go Google "Thevenin equivalent' or somesuch) or find another thread here that shows it's Z=R1*R2/(R1+R2) (http://www.picaxeforum.co.uk/showthread.php?t=13461&highlight=thevenin)

so using the calculator that gives R1 at 18.7 k and R2 1.286 k thats using input volts as 70 and a output to the adc as 4.5.
Remember you are limited to standard value resistors you can buy, or you can use a trimpot type device

I see that the 08m has readadc10 bit so if i use that it will be more adjustable to set up.. i think:)
Maybe, but that was the trick question. You'll get more precision but no more accuracy (think about a thermometer that measures to 3 decimal places but has an overall accuracy of +/- 2 degrees. How useful is that in determining the actual temperature?).

I'm still concerned that you can accurately and reliably differentiate between 48 and 50 volts, with potentially less-than-perfect-DC input, temperature changes, potential PICAXE Vcc drifts (very important) etc with a simple potential divider and a READADC command...what's the difference in the predicted reading from READADC at 48v and 50v respectively (I haven't done the maths)?
 

MartinM57

Moderator
It may be possible to reduce the top leg of the potential divider and clamp the voltage going into the ADC with a zener.
Maybe, if you could buy zener diodes with perfect text book transfer characteristics, but I don't know who sells them ;)

I suppose you could do it that way and calibrate it for your particular zener/PICAXE/resistor by hand (set up 45V, what do you measure, set up 46V, what do you measure etc). Would be wary of the calibration drifting with temperature though

What you really want to do is accurately subtract, say, 45V from the measured voltage so that the remainder is 0V to 20V and then potential divide that down to 0-5V - but you can't do that with any accuracy without some sort of opamp-type circuit. It's easy subtracting 1 volt from something with a 12v single supply opamp (LM324 etc), but I don't know how to accurately subtract 45v from something - it must be do-able though...
 

Dippy

Moderator
I'd avoid zeners if possible.

Why not work out your expected ADC change?

Using your vlaues of 18K7 and 1k286, what will be the voltage at the ADC pin for 50V and 48V?
I calculate 3.25V and ~3.1 V.

What sort of resolution will a 10 bit ADC give you?
Will it be enough?

Maybe op-amp offset&gain aren't needed. Or are they?
Get that calculator dusted off :)

You can calculate the voltage values to an ADC value assuming a constant +Vsupply figure.
You will need good V+ filtering/decoupling to get good ADC stability.
If your 50V line is noisy you will have to filter and/or average samples.
 

celticones

New Member
right so ive changed R1 to 9.3K top leg
R2 620R

and for the voltage IN v out v ADC
70 4.5 230
54 3.471 177
50 3.214 164.5
48 3.086 158

These figures for read ADC..

Are they too close ? or is there another way..

thanks jim
 
Top