Dc voltmeter 0-55v

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

[quote="medelec35" said If interrupt has triggered 94 times then 0.058ms * 94 = 5.452ms[/quote]
Thanks Martin so if i take your new 5.452ms as initial FireDelay variable and when i add 0.0303ms i get a 1.022v decrease on Vrms not bad Martin good job done Now if we count 94 times fireDelay variable has to be compared with variable count if the the two match then my delay has been obtained successfully so from now will not count till 94 times but rather count will just be compared with the new value of fireDelay and if the two match , my required delay at time x has been obatined thanks Martin that is successful problem is how now do we get timer2 int at the falling edge of int0 as at this time int0 macro will be in control.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

I was thinking, something like in the attached Flowchart.
I had to change the Data0 pin of LCD from B0 to B1 as INT0 uses B0
Attachments
Phase Angle Delay and Vrms Out.fcfx
(19.4 KiB) Downloaded 226 times
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Thanks Martin i can say there is a clever move in your flowchat, but i have some changes inorder to match exactly what am looking for.(1) in the INT0_ISR i would remove DelayCount or just make (DelayCount = FirDelay) and i would only enable a bool which in your case is (ENABLEDELAY). (2) in Timer2ISR, if a bool (ENABLEDELAY)i would increment TickTimer2ISR until TickTimer2ISR is equal to the game changer which is my variable FireDelay according to change in battery voltage or current and if the two match,triger a signal on A0 for a duration of only 250us then turn it off,clear everything back to zero and wait for the next falling edge on int0 to repeat this same routine with or without a 0.0303ms added or subtracted on or from FireDelay respectively. (3) am not understanding the second Decision that says TimerTimer2ISR = 99 the 99 is what i don't get here please help explain it and i don't see how you played my 250us signal on delay i want to know the trick you used.
Last edited by Derrihj on Sat May 09, 2020 4:02 am, edited 3 times in total.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:INT0_ISR i would remove DelayCount
No the delay count will be vital to the way it all works.

Code: Select all

DelayCount
is how many lots of 58us is required.
If changed to bool then it will never allow more that 1 lot of 58us, which will be useless.
As for the 250 delay.
With DelayCount is at 94 then then when TickTimer2ISR = 94 then 94 * 58us = 5.452ms has elapsed.
When

Code: Select all

TickTimer2ISR = 99
then A0 goes low and it's 99 * 58us = 5.742ms has elapsed i.e. 290us later
Not far off the 250us
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

I can see but another thing am not getting here may be you can help explain more, in my code the game changer will be FireDelay variable at initial value of 5.452ms but as you see it won't stay fixed at 5.452ms as it will be changing periodically according to changes in battery a 0.0303ms will always be added or subtracted from fierDelay or sometime left at default.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

As the delay 1 * DelayCount = 58us, then you will need to adjust the DelayCount accordingly.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

I will need to make a PCB as soon as possible and see this practically.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

But i can say this has been so interesting am going to study it more as i get the pcb up and running thanks Martin for the hard work helping me may God bless you.Just finished it's transformer
Attachments
IMG_20200508_094449_287.jpg
IMG_20200508_094449_287.jpg (126.21 KiB) Viewed 8352 times
IMG_20200508_094021_448.jpg
IMG_20200508_094021_448.jpg (125.55 KiB) Viewed 8352 times
IMG_20200508_081451_739.jpg
IMG_20200508_081451_739.jpg (124.37 KiB) Viewed 8352 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

More
Attachments
IMG_20200508_103940_315.jpg
IMG_20200508_103940_315.jpg (114.04 KiB) Viewed 8351 times
IMG_20200508_103909_525.jpg
IMG_20200508_103909_525.jpg (111.53 KiB) Viewed 8351 times
IMG_20200508_100452_625.jpg
IMG_20200508_100452_625.jpg (164.87 KiB) Viewed 8351 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

I will need to find away of auto changing your delayCount in case 0.0303ms was added or sub on or from the initial fireDelay variable which means delayCount will not always be fixed or equal to 94times (it will be more or less than 94 sometimes)but will be changing due to changes of FireDelay as decided by the prog due to changes in battery.Its like i will need to create a + or - Table (LUT) for which the prog will have to choose from for values of delayCount for initial value in the table to be equal to 94 forexample 10 values above 94 and 10 values below 94 in response to addition or subtraction of 0.0303ms from the initial 5.452ms.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Or I would say delayCount = FireDelay / 0.058 which will give me 94 and when ever i want to add I say delayCount = (FireDelay + 0.0303) / 0.058 and when i want to sub i say delayCount = (FireDelay - 0.0303) / 0.058 will this be okay?

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

transformer looks quite good, if you make another one you need to remove the surface rust from the laminates.
Success always occurs in private and failure in full view.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

Hello Derrihj

After thinking about your battery charger i have a couple of observations as you may experience problems / Have short battery life in the future.

You mention that you are using a "Deep Cycle" battery? This type of battery does not like having a voltage on its terminals constantly once charged then you are meant to remove the voltage- these are designed for mobility chairs golf trolleys etc.

For an intruder alarm I would recommend a reserve or standby battery these quite happily sit with a voltage on its terminals, but the down side does not like getting discharged if discharged it is recommended you apply a charging voltage within 24 hours some sort of deep discharge protection is recommended with this type of battery as you can discharge to the point the battery will not accept charge.

With deep cycle batteries you charge in two stages the first stage often referred to as Bulk charge on the data sheet, this at a higher voltage that is current limited @ typically 10% of the Amp Hour Rating of the battery but you would have to consult your battery data sheet for the manufacturers recommended setting. You then you monitor the current vs voltage, and detect as the current starts to fall as the battery voltage rises this is the point that you switch to "Float" mode and reduce the charge voltage. This point can be missed as Delta V can become difficult to detect. If missed the voltage drops and high current flows into the battery as it become saturated. This must be avoided at all costs! (Some low end cheap chargers utilise timers to switch between the settings as they assume that the battery would be deeply discharged i.e. a golf trolley, you end up having to push round the last hole as the battery is flat.

From your post it looks like you are using a 12 Volt Bloc i would look at a L200C voltage regulator as this is programmable unit voltage and current limit. Setting your Bulk and Float modes can be easily achieved by using a C/O relay to switch the resistors and pots in and out of circuit. Using multi turn pots so you get accurate voltage adjustment. Some battery manufacturers are asking for a tolerance on the setting as little as 0.5 % or less. I would do this in a in a fail-safe connection i.e. energise the relay to set the high voltage state. The batteries will still charge in float mode but take longer if the relay fails.

Some current sensing to detect when the current is starting to fall and terminate the absorption phase and detect thermal runaway is desirable. I am guessing you are in India - here the temperature becomes relevant and some sort of temperature feedback would be desirable. The voltages on battery data sheets are usually specked at 20 degrees C then a graph is consulted or a calculation is given for higher temperatures i have looked as some Enersys data sheets today they are stating - 4mv per cell per degree C above 20 to a max of 25 Degrees C, again you would have to consult your battery data sheet for this information as there are some high temperature blocs available but these are expensive.

The problem beaning further along the batteries life time if the voltages are too high for the ambient temperature this causing premature aging to end of life, or if the battery is deeply discharged (further than recommended) Enersys data sheet indicated between 1.4 - 1.5 Volts per Cell dependant on the battery. Length of time the battery will be left in a discharged state also comes into play.

The Battery discharge time dictates the final battery voltage to be chosen, slow discharges can have a lower final voltage than a long discharge time due to the chemical reactions within the battery. Batteries experience a voltage dip during the early stage of discharge, following which the voltage shows some recovery.

Up to ½ hour 1.65 – 1.6 Volts per cell
1 – 2 hours 1.7 – 1.67 volts per cell
Above 2 hours 1.8 volts per cell

Above Data As Per IEEE Battery Sizing Recommendations for reserve Lead Acid Batteries.
For optimum performance always recharge a battery immediately after discharging. It is undesirable to leave a battery in a state of discharge.

What typically happens when in the absorption phase with i high charge voltage, battery then will take as much current as the charger can push into the battery this is why the current limit is required, at the battery end of life or if the plates are sulphated this high current causes heating internally of the battery if un detected the plates expand and pop the sides of the case resulting in an acid leakage then this tends to cause a short circuit on the charger / battery.

Another Point to note is with ALL Lead Acid Batteries

They are rated at 20 Degrees C and de-rated as follows

Every 10 Degrees C temperature rise above 20 the battery life will half.

So for a 10 year design life battery @30 degrees C the expected life would be around 5 Years @40 Degrees C this would be 2.5 Years

High ambient temperatures will increase battery Ah capacity but reduce service life of the battery.
Low ambient temperatures will increase service life of the battery but reduce battery Ah capacity.

Attached a couple of photo's, admittedly these are larger than your batteries but the principles are still the same.

one of a battery at its end of life and the plates expanded and pushed the side off.

The other a battery analyser with battery voltage and temperature measurement sensors on the battery terminals not sure if you can see, in the attached photo on the Grey/Green & White / Blue wires there is a Circuit Board on this PCB is a temperature sensor that monitors the stud temperature and therefore the battery bloc temperature at the back there is a hall current sensor along with 2 PT100 Probes one at the top of the battery cabinet and one at the bottom of the cabinet to monitor the cabinet temperature and reduce the float voltage accordingly .

Steve
Attachments
20200416_123106.jpg
(171.05 KiB) Downloaded 401 times
20160818_074258.jpg
20160818_074258.jpg (82.28 KiB) Viewed 8251 times
Success always occurs in private and failure in full view.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Thank you very much Steve001 for the info problem is i can't have a charger with all those specs and i will need to use my battery everyday and it will need to be charged so I better use what i have to charge the battery than not to charge it at-all as i use it, and yes i will have a relay on my PCB that will cut off AC mains to the thyristor pair when at float.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

Hello Derrihj

just be Careful of the current limit settings and temperature.

A rule of thumb for lead acid batteries when charged the current will be approximately 10mA per Ah
so your 18 Ah Battery will be around 180 mA when charged.
Steve
Success always occurs in private and failure in full view.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Am about to finish my PCB ,point of interest Explain more about this current limit setting and temperature when charged as in what to maintain and what not.Thanks Steve.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

just seen this, will post an answer later over the weekend for you

Can you post your battery data sheet if not i will use generic information
Success always occurs in private and failure in full view.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

Hello Derrihj

Some terminology explanations from above this my help a bit on bloc's, strings' batteries

Bloc this n number of cells in a case

String this is n number of bloc's

Battery this is n number of strings these can be connected in parallel to increase Ah capacity

Example

108V Battery system is made up as follows:
6 cell bloc = 12 V
1 string of 9 x 12 V Bloc's = 9 * 6 = 54 cells

to answer your question:

2.42 Volts per cell - Bulk = 14.52 volts @ 20 degrees C

2.275 Volts per cell - Float = 13.65 volts @ 20 degrees C

Current Limit

18 Amp Hour Battery

so rule of thumb 10% 1.8 Amps BUT Consult your Battery manufacturer data sheet as some battery's happy at 20%

Float Charge voltage temperature correction factor from standard

- 4mv per cell per degree C above 20 to a max of 25 Degrees

= 6*0.004 = 0.024 per bloc per degree C

so at 25 degrees C

0.024 * 5 = 0.12

14.52 - 0.12 14.40 Volts Bulk

13.65 - 0.12 13.53 Volts Float

Cyclic Life Data

100% DOD down to 80% capacity 300 cycles
75% DOD down to 80% capacity 500 cycles
50% DOD down to 80% capacity 600 cycles
25% DOD down to 80% capacity 1400 cycles

so looking at the above data;

Depth of discharge (DOD) is classed as the discharge from 100 % to 20 % (2.12 V per Cell to 1.93 Volts Per Cell)
@ 20% state of charge the battery is deemed to be flat and more than likely damaged an unable to accept charge.
so the DOD is from fully charged to this point = 80%

So if you fully discharge to the 80% (20 % left) level and recharge you would only get 300 cycles (1.93 Volts Per Cell)
If you part discharge discharge by 25% (65% left) and recharge you would get 1400 cycles (2.03 Volts Per Cell)

This is all generic data and you will need to consult your battery data sheet for the information.

Hope this Helps

Steve
Success always occurs in private and failure in full view.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Hi Martin how are you,hope you are doing well i would like to take you back on this page; http://www.matrixtsl.com/mmforums/viewt ... &start=100 were you provided an Excel file for calculating the required numbers to be loaded for the 7seg.Is there a way you can reprogram it in such away that if i enter new port letters all the others from 0 thru 9 are changed automatically for example in your file you used A and B but if in my project i use B and D it would be cool at the time of entering individual bit numbers i also change may be from A and B to May be B and D and all the rest and changed automatically to B and D.and another thing i noticed is when i manually calculate the required totals for A and B or B and D i get the required total but when i try to edit your file from a to g entering new port bits that am going to use your file gives me a total were by values for one port are reduced by one and then the other port total is raised by one may be you can check it out and let me know on how to operate it as calculating the values manually gives me correct values but it's time consuming so your Excel file can be of great help.Thanks Martin.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

I'm ok thanks, hope you are well too?
I will have a look.
Not promising anything as the spread sheet was solely designed around the pins you have used.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

What is the best timing gap between two timers interrupt frequency in code forexample if i use Timer0 and Timer2 in the same code what is the best spacing or it has no problem both can run with the same interrupt frequency? Say forexample if i use two 3 digit 7 seg and one is refleshed by Timer0 and the other refleshed by Timer2 what should the interrupt frequency difference be as in gap between the two or they can run with the same interrupt frequency with no problem?

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Ok this is what I've managed to come up with guys have to say the covid 19 has really delayed my testings coz even shipping costs are high from China can't afford them now making the all components expensive, just finished designing this and i will test my code with it if i get all the required components the likes of ACS712-30a module.ok this fits well under the zero crossing post tho it also has a voltage read option don't know what you guys say i think i have to talk to Medelec35 and see what he has to say if we can move all this part of about zero crossing into the zero crossing post or we leave it here what do you have to say Martin?
Attachments
IMG_20200917_011046_862.jpg
IMG_20200917_011046_862.jpg (225.45 KiB) Viewed 7218 times
IMG_20200917_010833_230.jpg
IMG_20200917_010833_230.jpg (252.81 KiB) Viewed 7218 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Ok am almost finishing this one but also needs the 18f47k40 because it will have a bunch of setups as i need it to be used from 12v to 48v,so with multi function two buttons i think i will be able to achieve that, may be provide a little pass code before you jump into the settings for battery to be charged setup min and Max amps (low and high) setups like that.That is if the project is successful (if the code works as required) coz i got the formula from some website so i had to do some math to come up with this thanks to Medelec35 with the interrupt calcs so hope this works that makes me happy. Am only still having trouble with the snuber circuit got a video about it but there is some little thing i don't click, need to understand this as i hate guess work i think i will have to post the link of the video so that you guys have a look and help me were my little brain has jammed.
Attachments
IMG_20200921_002036_615.jpg
IMG_20200921_002036_615.jpg (85.03 KiB) Viewed 7182 times
IMG_20200921_002047_164.jpg
IMG_20200921_002047_164.jpg (85.55 KiB) Viewed 7182 times
IMG_20200921_002157_897.jpg
IMG_20200921_002157_897.jpg (84.81 KiB) Viewed 7182 times
Last edited by Derrihj on Sun Sep 20, 2020 11:31 pm, edited 4 times in total.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

One more
Attachments
IMG_20200921_004747_378.jpg
IMG_20200921_004747_378.jpg (90 KiB) Viewed 7182 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Here is the link to the RC snubber circuit design. Here am interested in the LR (load resistance) is it for the transformer or the battery to be charged? https://m.youtube.com/watch?v=eZwJgPd7_p4&t=479s

Post Reply