quite fresh:
(sometimes just typed in the lunch break .................)
The hottest Bascom-Listing for my balance / measurement / heating
transducer with Atmega 48
The program is not finished yet!
(The balancer is so natural yet, but
Measure of four cells in series
work ever and the PWM story is also enabled.
the AD converter in between already been read,
songwriter ok so far! It still lacks a limit to the balancer
derHeizfunktion and activate the program must be in the master
changed so that it sends the 255 to be heated when
..............)
Unlike ATiny Atmega 24 of a "right" has
serial interface and which operates independently
The software solution Attiny24 problems entailed, because
was blocked during the transmission of the program.
$ regfile = "m48def.dat" $ crystal = 4000000
$ baud = 1200
Config Adc = Single , Prescaler = Auto , Reference = AvccStart Adc
Dim A As Byte
Dim A1 As Integer
Dim B As Byte
Dim B1 As Integer
Dim D As Byte
Dim E As Byte
Dim F As Byte
Dim Bal1 As Word
Dim Bal2 As Word
Dim Bal3 As Word
Dim Bal4 As Word
Dim Pwm1 As Byte
Dim Pwm2 As Byte
Dim Pwm3 As Byte
Dim Pwm4 As Byte
Dim Pwmx As Byte
'Open "coma.7:1200,8,n,1" For Output As #1'Open "comb.2:1200,8,n,1" For Input As #2
'Config Timer2 = Pwm , Pwm = On, Compare A = Clear, Prescale = 1'Config = Timer0 PWM, PWM = On, Compare A = Clear, Prescale = 1
Config Timer0 = PWM, PWM = On, Compare A PWM = Clear Down, Compare B Pwm = Clear Down, Prescale = 1
Config Timer1 = PWM, PWM = Clear Down Compare A, B Compare PWM = Clear Down, Prescale = 1
Portd.5 Config = Output 'Config OC0B
Portd.6 = Output' OC0A
Portb.1 Config = Output 'Config OC1A
Portb.2 = Output' OC1B
Thurs
D = 0 'not really necessary
If F> 0 Then F = F - 1
Inkey A = () Read the read command
E = A
If E = 255 F = 255 Then 'value is stored for heating Balancer
A = A - 12' -12 at 13-16
If A = 1 Then 'AD converter 1 measures against "mass" A1 = GetADC (1) If A1> 255 Then A1 = 255
D = A1
Printbin D
End If If A> 1 And A < a=" 2">
B = A - 1 'here is the next input taken as reference
GetADC A1 = (a)
GetADC B1 = (b) 'reading of ADC2, 3, 4
A1 = A1 - B1
If A1 < a1 =" 0">
If A1> 255 Then A1 = 255
D = A1 'transformation into a byte
Printbin D ' senden des ByteEnd If
Bal1 = Getadc(1)
Bal1 = Getadc(1)
If Bal1 > Pwmx And Pwm1 < pwm1 =" Pwm1">
If Bal1 <> 0 Then Pwm1 = Pwm1 - 1
If F > Pwm1 Then Pwm1 = F
Ocr0a = Pwm1
Bal2 = Getadc(2)
Bal2 = Getadc(2)
If Bal2 > Pwmx And Pwm2 < pwm2 =" Pwm2">
If Bal2 <> 0 Then Pwm2 = Pwm2 - 1
If F > Pwm2 Then Pwm2 = F
Ocr0b = Pwm2
Bal3 = Getadc(3)
Bal3 = Getadc(3)
If Bal3 > Pwmx And Pwm3 < pwm3 =" Pwm3">
If Bal3 <> 0 Then Pwm3 = Pwm3 - 1
If F > Pwm3 Then Pwm3 = F
Ocr1a = PWM3
Bal4 = GetADC (4)
Bal4 = GetADC (4)
If Bal4> PWMX And Pwm4 < pwm4 =" Pwm4">
If Bal4 <> Pwm4 = 0 Then Pwm4 - 1
If F> = F Pwm4 Then Pwm4
Ocr1b = Pwm4
Loop End
Loop End
that moves the text formatting
is annoying .... sorry!
.......... and yet another update:
I've worked a little turn.
The PWM Augänge now working properly!
So who actually has the balancer!
The threshold is now just temporarily on
128 (about 2.5 V) is set and the output is an LED.
the short-circuiting of an input is the particular
LED slowly (in about 1 second), and afterwards again
slowly. So be it!
LED slowly (in about 1 second), and afterwards again
slowly. So be it!
go from here?
The big question is: should the set Balancerschwelle
be set, or through the master
can be configured?
be set, or through the master
can be configured?
.... The heating ......
I imagine the way: If
on heating is switched, the Balancerschwelle
by command to around 2.5 - which obviously made 3V
switch through the balancer full and strong heat.
switch through the balancer full and strong heat.
(about 20-25W per cell so the 10A should then be it!!
is not without seeing ................... times ... .......)
The command is of course only one time per
run and therefore needs a function of time.
run and therefore needs a function of time.
The threshold must therefore switch back to the correct value when the command longer
not coming back.
not coming back.
here if you would have several values to choose from, then you could in fact
sometimes "below for balancing
burn without having any residual power to have.
must also of course the temperature of the heat sink
be monitored.
be monitored.
I must have a little play ...................
The number of available commands depends on how many cells should be
ultimately managed.
ultimately managed.
As long as I only send one byte sinds 254 commands altogether.
that is ultimately not sooooviel.
each cell occupies an ever that's for
Then all depends on what you want to know everything
and how it evaluates.
A global status query the metering unit therefore a Atmega,
monitors four cells should be enough. The back has indeed
monitors four cells should be enough. The back has indeed
254 (one byte) answers!
Since it is also in the eight individual bit as much
into code or a table from one erstelllt
prepared answers.
into code or a table from one erstelllt
prepared answers.
There should be sufficient under normal circumstances 40Zellen (ca.144V)
but in extreme cases, 192Zellen at least as
options are provided when normal AC motors
should be operated with frequency
options are provided when normal AC motors
should be operated with frequency
I'm going to the numbers 1-50 reserved for cells
and the numbers 51-192 as long as it avoided use is not.
The status query a reading should be 201-210
or in case of full serve to 248. (10 to 48 measurement units)
Stay So even 193-200 and 211-254
(when 255 turns on the heating and values such as aircraft battery,
engine temperature, total voltage and current, etc. from the master
be measured directly .... . .. there are still many ways .......
be measured directly .... . .. there are still many ways .......
and if you just only a maximum 40 cells proceeds, then
the range of 41 - 200 and 211-254 to use, that's enough)
the range of 41 - 200 and 211-254 to use, that's enough)
The master computer is known to me the place in the ATmega48
running low, but since there's still the Atmega 88 or 168, then I can
running low, but since there's still the Atmega 88 or 168, then I can
again "feast".
But since I really want to do with the top 48,
But since I really want to do with the top 48,
I will first simplify the menu again.
Less text, only variables and only all
save on exit, which might work.
save on exit, which might work.
The remaining energy I want to display as an independent module design
...... again demonstrated a command
...... again demonstrated a command
if the master's is the
The measuring unit is still "space without end" is still there
much! they were also two
analog inputs and a PWM output free.
For temperature measurement per four-pack extends this
Addendum 15/06/2010
first tests with the latest state of the measurement and Balazi-
program Atmega have been very encouraging.
works adorn fairs balanced and generally been very good as far as my
unfinished circuit allows it.
As mentioned earlier, the driving of the MOSFET
the biggest problem.
When a group of four on their own
considered then is the Atmega with one of the cells
to ground. The cells are linked and the tensions
somewhere at 3.6 V, 7.2 V, 10.8 V and 14.4 V.
The Atmega is a 5V regulator of the highest cell
of supplies (2-3mA) The PWM outputs turn out so
of supplies (2-3mA) The PWM outputs turn out so
between GND and 5V and her.Damit I can only
MOSFET is the drive directly to GND if there is a N-channel MOSFET
ist.Für the other three is not possible.
ist.Für the other three is not possible.
come here P-channel types are used and there is still a
each driver transistor is required that leads as "open collector" to the gates
Gnd. Again a rather unusual circuit,
each driver transistor is required that leads as "open collector" to the gates
Gnd. Again a rather unusual circuit,
but how it works! Thus, a four-group does not need further
Electrical isolation and the fact it came to me.
Electrical isolation and the fact it came to me.
Only two optocouplers (one for RXD, one for TXD four cells)
and the supply of the Atmega carried out in group of four
The balancer is functional even without a control computer,
The balancer is functional even without a control computer,
each cell is balanced for separately
and the control computer can always consult each cell
and then it is the voltage sent
The accuracy is about + - 0.04V + / -2% that is in range.
The accuracy is about + - 0.04V + / -2% that is in range.
that should be enough.
the greatest power used by the way, the input voltage divider
!
!
missing is a message loop for charge termination
when the first cell is full ..........
mfG
Franz
supplement 25.07.2010:
The silly season is everywhere ........
In recent weeks, gabs do enough other things
so I was certainly never boring!
at BMS is not a lot happening except for some tests,
which are all very positive
The balancer work fine, smooth switching via PWM works fine to solve
Only:
Reliable switch the balancer-voltage limits from the master from
(or should that ever be controlled from there ???????)
message output independently from the master.
What is this?
I want my "master", etc. Thus, the display shows me the values.
(Max Min average temperature error etc)
I think it is dangerous but for the whole Balancersystem
from the master and let the serial connection to be dependent. The
must work independently!
with any loops that signal is interrupted error.
at least the charging process must be controlled Sun
these days I had a completely different idea, which I really want to
into practice.
There are therefore at this point a little break,
and again something completely different in between!
Up soon!
Franz
supplement 25.07.2010:
The silly season is everywhere ........
In recent weeks, gabs do enough other things
so I was certainly never boring!
at BMS is not a lot happening except for some tests,
which are all very positive
The balancer work fine, smooth switching via PWM works fine to solve
Only:
Reliable switch the balancer-voltage limits from the master from
(or should that ever be controlled from there ???????)
message output independently from the master.
What is this?
I want my "master", etc. Thus, the display shows me the values.
(Max Min average temperature error etc)
I think it is dangerous but for the whole Balancersystem
from the master and let the serial connection to be dependent. The
must work independently!
with any loops that signal is interrupted error.
at least the charging process must be controlled Sun
these days I had a completely different idea, which I really want to
into practice.
There are therefore at this point a little break,
and again something completely different in between!
Up soon!
Franz