ATtiny85 simulation options

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

I am trying to simulate an ATTiny85 shunt regulator for a 10AH lithium cell. The program is written in C using AVR Studio and the features are to blink an LED to indicate cell voltage, and turn on one or more shunts to limit the voltage during charging of a series string.

None of the simulators I've tried has been satisfactory. AVR simulator works but doesn't show the LED flashing until I break, and then the output log is hard to interpret. I have yet to find any documentation for Simulator 2 .stim files, but presumably it would have the same problems, if it works on the '85 at all.

Hapsim has worked well for me on other chips but is bombing AVR studio with the MFC error when LED's are connected to the '85 simulator. This on XP or Windows 7 with various versions of both programs.

VMLAB would seem to do everything I want and I like the power dissipation monitoring, but the free version doesn't support the '85. While it runs happily when I say it's really a supported '15, there seems a fundamental disconnect between what I do to the pins from the outside (e.g. raise the battery voltage), and what the MCU is doing from the inside (enabling the shunts). Don't know if AVR studio not supporting C for the '15 has anything to do with that, which means I have to compile for the '85 so VMLAB halts (but allows continuing) on illegal instructions.

So is there a simulator that would show the LED flashing in something like real time, and allow slowly varying the input voltage to see the shunts kicking in and out?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder why you worry with a simulator.
In my opinion it is much easier to put a potentiometer and a Led on a board and test it in real.

Besides, Li-on can be destroyed with high charge voltage.
I am not sure if it is a good idea to control the voltage with AVR and rely on it.

In my opinion it is best to use a voltage stabiliser 4.2V and a current limiter in front of it.

Then, if you like to use AVR, it can measure the charge current and signalize end of charging when current drops to some limit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

These are Headway LiFePO4 cells, a safe chemistry that operates from ~2.5 to <3.65 volts. The voltage goes up rapidly when charged above that so when charging a string of cells, say 12 at 43.5 volts, the first cells to reach full charge will be overvoltaged unless the (hopefully small at that point) current is shunted. Shunting has to continue until all the cells are fully charged, else a low cell will (or should) prematurely cut off pack discharge. 36 Volts/10AH makes a good electric bicycle pack, around 5kg for a 30km range. With a 30 amp polyfuse in the middle of the string they are no more dangerous than lead acid, probably safer.

I could do the testing on hardware but several others are interested in software development and collaboration would be easier with a good simulator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Aha!
If I understand, during charging you are going to measure voltage of each individual cell and when it reaches Umax (4.25V), connect a shunt resistor to that cell?

Modellers, when charging their li-po accu, they connect a power zener diode 4.2V parallel to every cell, so that no cell can be overloaded.
Look at http://www.zajic.cz/omezovac/omezovac.htm

But I see it would not be that easy for say 10-20 A.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Everyone thinks 4.2 volts when lithium phosphate is mentioned! These are Oxygen-endothermic 3.65 volt max cells, with probably much longer lifetime if kept below 3.6 volts.

One advantage of MCU shunting is it can be started earlier to even out the power dissipation. Shunt 20 ma at 3.4, 50 at 3.5, 100 at 3.6 etc. Of course you would want communication among the MCUs so they only shunt when one or more cell in the string is lagging in voltage.

Even at 100 ma though, a cell that was an amp-hour behind would take 10 hours to catch up! But so far it appears they will track to better than a percent, with typical (bi)cycling.