Introduction

Project Morpheus is a battery simulator - primarily Lithium Polymer (LiPo) cells but other batteries are possible too. It will be possible to dial up a 3V coin cell profile for example or AA batteries as another example. Once the profile has been selected the battery simulator will behave like that battery, so for example in 3V coin cell mode it won’t drive a motor very well, but in 3V dual AA battery mode it can. It achieves this by dynamically modifying the output terminal voltage depending on current consumption.

 

See part 1 for the main introduction to the project, and part 2 for information on the circuit board and the preliminary schematic while the project is being developed. This is a prototype project so it will change. The circuits and board layout will be published, if anyone wants to build the current revision 1 board I'd be happy to supply the layout early but it may change.

 

It was mentioned to me that some explaining might be needed why such a project is useful. Although the main objective is to simulate LiPo batteries, Morpheus achieves a few more objectives and becomes a "test tool" for IoT projects. Some example scenarios for it are described next.

 

Example Scenarios

Here are some example use-cases, and how Morpheus will help:

example-scenarios.png

Powering circuits during development

Morpheus can operate as a voltage source, supplying any voltage up to 5V, 1.5A capability. This is ideal for many low-voltage micro-controller, sensor or wireless circuits. It can kill the supply if any defined current limit is exceeded

Monitoring circuits during development

Morpheus has a voltage output that corresponds to current drawn; this can be directly attached to an oscilloscope, to see dynamic current draw from circuits. So, when the circuit briefly draws more current due to (say) wake-up and data transmission, this can be captured. This allows circuits to be optimized for lower power consumption (e.g. change the wake-up and transmit rate).

Monitoring and logging circuits when you are away

Morpheus can capture current measurements (at around 10k samples per second) and record them, so that they can be graphed and observed later

Predicting battery life

Morpheus can take a 'power-good' signal from the circuit that is being developed, and use this to predict how long the circuit will last when powered from a LiPo battery. It does this by integrating power consumption over time, and decreasing the output voltage until the circuit reports that the simulated battery output is too low to operate

Simulating batteries during development or solution test

Morpheus can measure current consumption and on-the-fly change the output voltage to simulate internal battery resistance. This would allow circuits to be run in conditions where the battery could be (say) partially depleted or a cold or hot environment. The simulated battery would be pre-programmed with the desired charge level and the desired temperature for the simulation. Morpheus is low-cost so multiple boards can be constructed to test large solutions (e.g. multiple nodes). It becomes possible to easily see how well devices behave (e.g. how far can they transmit ?)  as batteries deplete. The tests are easily repeatable because the simulation can be reset at any time

 

Initial Tests

The entire circuit has not been constructed yet (I need to order some bits!). But, until then, some tests can be done to confirm if the rest of the circuit works. The circuit so far was assembled with a soldering iron with the exception of the voltage regulator which was reflow soldered.

Morpheus is controlled by an off-board microcontroller. For these first tests, the weapon of choice was a FRDM board, seen here on the right:

bsim-partsoldered-powered-lr.jpg

 

The voltage source portion of Morpheus consists of a 12-bit DAC controlled via SPI (serial peripheral interface). This was connected up to the FRDM board.

The next step was to implement a small menu system on the FRDM board, so that test commands could be sent to the board on demand via the serial port. Here is a screen capture from a terminal program:

example-menu.png

Although this took a couple of hours to code up it saves time in the long run. With the menu system it is possible to send a text command over the serial port from a PC to set any voltage level or to program a pattern (for testing the capability to change voltage rapidly).

 

The circuit allows for any arbitrary voltage from 0.6V to 5V to be created on demand with 2mV resolution.

The exact output voltage will vary due to part differences and temperature and load (the voltage regulator has 1.5% tolerance at 25 degrees C for the more accurate ‘A-grade’ version but higher across all load and temperature values, and I used the cheaper non-A-grade version), so a reference voltage is fed back to the microcontroller so that it can compute the difference and add or subtract an amount to auto-calibrate when needed. This feature relies on an external ADC, since virtually every microcontroller/single board computer these days has built-in ADC capability. The screenshot above shows the output being set to 1000mV, and the auto-correction of -9.5*2mV = -19mV for a more precise setting. In normal use such accuracy may not be needed (the simulation error compared to a real battery response may be more significant) but it was good to know that a calibration is possible if ever needed (In normal use, the voltage control will be run open-loop, i.e. set-and-forget and hopefully this will be accurate enough for the battery simulation). It was checked with the highest resolution multimeter I had; with the auto-correction feature the output was accurate within 6 mV. I then modified the code to take an average of 64 measurements. The error reduced to 3mV across the range which is probably hitting the accuracy of the microcontroller’s ADC. As mentioned this is more accurate than the simulation is likely to be!

More tests need to be done (under load, dynamic tests, and dynamic current measurement capability) however I’m waiting to get a heat sink before I do those.

 

Li-Ion Battery Simulation

After examining the paper found by michaelkellett (see post 2 comments), it was decided to experiment with the ‘dualfoil’ software that the authors used. The software is intended to simulate a battery based on many physical, chemical and electrical properties. Dualfoil is written in Fortran but with a little help - thanks johnbeetem - the software eventually ran. It spools out many parameters per instance in time which the simulation runs. The software is complex (more than 6000 lines of code) and possibly requires more resources than a microcontroller may be able to provide in real time.

It was nevertheless decided to port the code to C to provide some flexibility over where the code might be run from. One of the license terms for dualfoil state that the software must not significantly change; it was decided that an automated port of dualfoil from Fortran to C is not a significant change since Fortran compilers already internally pre-process before compiling the code.

More information in the next post, after the remainder is constructed (the area to the right of the board).

bsim-partsoldered-rl.jpg