element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Building a Battery Simulator (Project Morpheus) - Part 3
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 5 Jan 2015 1:36 AM Date Created
  • Views 6780 views
  • Likes 3 likes
  • Comments 24 comments
  • eagle
  • eaglecad
  • ioe
  • internet_of_everything
  • freescale
  • pcb
  • frdm
  • internet_of_things
  • frdm-kl25z
  • iot
  • features_of_iot
  • battery_simulator
  • cadsoft
Related
Recommended

Building a Battery Simulator (Project Morpheus) - Part 3

shabaz
shabaz
5 Jan 2015

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:

image

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:

image

 

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:

image

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).

image

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 10 years ago in reply to michaelkellett +4
    Hi Michael, I ran some brief tests, it is not much so far but it showed some useful things. I ran a test where I alternated between 1V and 3V output every 10msec, with a 22 ohm resistor as the load (when…
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago +1
    WOW, this is coming along great, very detailed, educational and enjoyable Who made the boards for you and what was the turnaround, they look pretty good from the pictures regards Peter
  • mcb1
    mcb1 over 10 years ago +1
    Excellent project with good use for a wide range of things. Well done, and now I understand the strange ventre into Fortran.... Mark
  • dougw
    dougw over 7 years ago in reply to shabaz

    Nice work. I use iTead a lot as well - I like the results....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • theo_san
    theo_san over 7 years ago

    I've read really interesting things here! image Until now I knew very little about these devices. I knew the battery simulators of Techsimule battery, Amperis battery simulator orBloony, but I did not really know the operation of the equipment. Until I read this article.

     

    Great job!! imageimage

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 10 years ago in reply to shabaz

    I wouldn't expect extra caps to make much difference - 2.2uF ceramic will be pretty low Z - and 0603 will only be better (perhaps at 100MHz or more). 5mm away isn't too bad either. It might be that the regulator doesn't like the very low ESR of the caps you have now (speculation - I haven't checked the data sheet on that but I might later).

     

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 10 years ago in reply to michaelkellett

    Hi Michael,

     

    Thanks for the information! I was thinking this morning I didn't see oscillation at the top. There is a 2.2uF ceramic 5mm away from the regulator (as close as I thought I could get while getting a star ground close to the regulator, but with hindsight I could have pushed it closer by another mm or two, and I should have looked for an 0603 capacitor too in parallel. I'll solder a capacitor right against the legs of the regulator tonight, to see if it has an effect, and hopefully try switching in and out a heavier load using the MOSFET idea this week too.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 10 years ago in reply to shabaz

    The 2Mhz oscillation is interesting since you don't seem to have any overshoot where I would expect it at the top of the output pulse. It might be worth checking if the oscillation appears on the demand to the regulator.

    It might be fixed by caps very close to the regulator.

     

    The other thing that shows up instabilities well is to switch the load on and off (I keep a huge mosfet handy for this and drive it with a signal generator - it can short out anything !).

     

     

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube