Fixed a bug where the shift registers were swapped - the wrong LED would be lit, and the charger would be charging the wrong cell!

Added support for the 3 position mode switch. The middle position will now charge as expected and the outer positions will both do a discharge into the 3.9 ohm resistor - no difference between outside positions at the moment.

Added support for the charging current switch. High will give 1000 mA, Medium 500 mA and Low 200 mA. -dV termination probably won't work at 200 mA.

When logging is started, it will now log the hardware and firmware version to the log file/serial port.

Fixed a bug that caused data corruption on the SD card when the LCD board was connected.

Added a new ReadAndLog opcode to combine reading Voltage, Current and Temperature and then logging the results with a single byte instruction.

I've attached the latest version of the source to the first post. Initial testing on the latest board that I've got seems to be good, but keep in mind that I haven't spent that much time testing it yet!

I'll write up some instructions on general use for this firmware some time later. For the moment, I'm heading off to bed since it's now 1:40am!

I've just uploaded Version 0.502 to the first post - changes with this version include:

Added Already Full Check - LED will light up purple if cell is at or over 1.4V Prevent accidentally overcharging a full cell and also helps to reject Alkalines.

Added Resistance Check - does a brief charge and discharge to estimate cell resistance. Will refuse to charge cells with more than 300 milliohms resistance - should reject most alkalines, but not guaranteed.

Fixed bug which caused the elapsed time to be incremented even during pauses between charging.

Added Refresh & Analyze mode: Discharge, Charge, Discharge, Charge. 30 minute rest between each charge and discharge. Good to check remaining capacity, recharge and discharge to get actual capacity and then finally recharge to leave battery ready for use.

Added Header line to output.

Fixed a bug that prevented the over temperature check from working.

Modified charging currents: High mode will now charge at 1amp and the charge will only charge one cell at a time - if a second cell is inserted, it will automatically start charging it once the first one has finished. Medium mode will charge at 1amp as well, but with a pause to give an effective rate of 500mA. In this mode, if 2 cells are inserted, the charger will alternate between them. Low mode will charge at 400mA with a pause to give an effective rate of 200mA - again, in this mode it can charge 2 cells by alternating between them.

Added register for firmware version.

Reduced the number of long registers and replaced them with byte registers to save memory.

Reduce duration of off period when fast charging a single cell. Effective charge rate should now work out to about 950mA.

Increased maximum temperature for Revision 4 charger due to proximity of temperature sensors to charging circuit.

Fixed a problem with compiling with the Arduino IDE version 1.5.2

I've also updated the list of outstanding items listed in the first post.

Added op_LOGMF - Logs a preset message followed by total time, capacity and energy.

Fixed cells not being detected if their voltage was below 0.9V Cells now need to be at least 0.3V to be detected.

Added (a modified version of) Paul's light show at startup.

Disabled debugging messages in the EEPROMEx library to free up some flash - modified the code to still keep the write limiting feature enabled.

Renamed reg_CycleSwitch to reg_ModeSwitch

Added reg_StartupCode - allows byte code program to determine whether the MCU has been powered on, or if it was reset due to an external reset, brown out or watch dog.

Changed message "min dV detected" to "Inflection detected"

Changed maximum allowed current from 1 amp to 2 amps - use with caution - not actually used by current firmware.

Cut some fat from the EEPROMEx library to save some Flash.

Removed logging of free memory to save some Flash.

Replaced MultiAnalogRead with analogRead to save some Flash.

Added support for the push button.

Added check to make sure that each VM doesn't run for more than 1.7 seconds at a time - otherwise that channel will panic - this should pre-empt the watch dog unless the whole controller has crashed.

Added multiple modes depending on duration of button press.

Added precharge feature to revive dead cells before doing internal resistance check and then main charge.

Numerous other minor changes.

Assuming that there aren't any bugs, this version should be good enough for Paul to start sending out to the first batch of customers! There are a lot of changes though and I haven't fully tested them all, so this does need to be tested quite a bit before then.

Note that this will most likely be the last firmware version to support hardware revisions 5 and earlier. Paul has asked me to clean up the code to make it easier for others to understand.

Changed Internal Resistance Check to only use resistance measured whilst charging. Resistance during discharges is still measured for informational purposes.

If cells have a resistance of over 1 ohm, the charger will now reduce charging current to 200mA and the LED will alternate between red and purple whilst charging.

Replaced standard Arduino SD library with fat16lib - this reduced compiled program size by almost 6KB! This does mean however that cards greater than 2GB are no longer supported.

Fixed a bug with loading alternate byte code programs based on switch position.

Changed behaviour with pressing button whilst starting - pressing and holding the button will now cause the charger to load a mode specific file, otherwise it will attempt to load the main charger.bin file.

Modified logging to show PWM value that was used prior to the measurement rather than the updated PWM value.

Added Voltage limit for constant voltage charging.

Added support for detecting and charging NiZn cells.

Added support for discharging into an external load.

Fixed a problem with random light show not being shown under certain circumstances.

Moved most of the byte code program into a separate area of flash so that byte code programs on SD can be a lot smaller to fit into the available EEPROM space.

Note that due to some of these changes and the fact that I haven't had much time to fully test it, there's a good chance that there will be bugs in this version - please let me know if you run into anything!

I'd consider this version mostly feature complete. There's just a few more minor changes that I want to make.

Added optional top off charge. (Default is to do it only when running analyze and discharge modes - not normal charging)

Improved support for NiZn cells.

Added capability to use PWM to vary discharge current through the internal load resistor.

Reinstated more verbose error messages since we've not got some flash space to spare.

Increased number of general registers by 25%

Doubled number of EEPROM registers.

Added code to reset EEPROM write count after loading program from SD card.

Changed Channel numbers in output to be 1 & 2 instead of 0 & 1.

Added display of estimated internal resistance at start of discharges.

Added redirection table to allow SD card programs to replace up to 10 support routines - similar to virtual methods.

Changed Waiting to charge from White/Red combination to Blue/Red combination.

A few other minor changes.

Fixed a few minor bugs.

General code clean up.

I'm not planning to add any more new features before Paul starts sending out the non LCD boards. If there aren't any bugs found in this version, it will most likely be the version that goes out to everyone who is getting a non LCD board.

If you've already got a charger, I'd appreciate it if you could start seriously testing this new version so that we can be reasonably sure that there are no bugs before it's sent out to the masses!