Thursday, 21 September 2017

25:5 Diet - a log, and some comments on frequency

Herewith, an update on intermittent fasting, with examples!


72.5kg, 14.7% fat.

A glass of water with psyllium husk. Large soy latte, so far it's a usual day except I've cut out the coconut oil that I usually add to my coffee.

Lunchtime (skipped)
Drinking green tea. Not hungry yet, but having trouble concentrating. I've been eating carbs for the few days prior to fast - possibly this makes the transition to fasting a bit harder to deal with. Might check that next time.

8pm - konjac noodles and ratatouille. Konjac noodles have virtually no calories but plenty of fibre to feed my gut bacteria. Eggplant, capsicum, onion, zucchini and tomato in ratatouille - all very ow calorie, main contribution from olive oil. I'd say not more than 400-500 Cal today. Adding a multivitamin and mineral supplement to help avoid possibilities for deficiencies.
9:30pm feeling mentally tired.


71.3kg, 14.1% fat.

 A glass of water with psyllium husk. Large soy latte. Feeling quite fine, not really hungry. 11am getting pretty hungry now. Green tea helps suppress it. Feeling mentally pretty sharp.

Lunch (skipped). Green tea.

Didn't check ketones yesterday, but fairly deeply into ketosis this afternoon.

Dinner - same as yesterday, plus the multivitamin and a few scrapes of romano cheese. Some thawed mixed berries for desert.


70.7kg, 13.7% fat. Starting to feel cold easily.

Water and psyllium husk. Large soy latte.

Lunch. (2pm) - starting to get noticeably weak now. Dinner is going to be a bit tricky this evening due to kids activities and hunger is getting a bit distracting so I'll eat now. Ratatoille and konjac noodles again (one pack, rather than 2). Plus a spoon of tzatziki dip for some variation in flavour.

Dinner (8pm) - a bit more ratatouille (all gone now!) - no noodles. 125g blueberries, and a passionfruit. Not really feeling hungry much now. Ketones are 4 mmol/L in my urine, I'm talking a lot (usually happens to me in ketosis).


70.2kg, 13.5% fat.

Had a bit of a rough night last night. Just wasn't sleepy at all, didn't fall asleep for what seemed like several hours. This tends to happen near the end of the fast, I put it down to higher levels of ketones. Feeling enthusiastic this morning, not hungry at all.

Breakfast: Psyllium husk and water, large soy latte.

Lunch: skipped, green tea. Not hungry.

5:30pm Urine ketones up to 8 mmol/L, feeling a bit spaced out. Getting hungry again, had some more psyllium husk.

Dinner: 100g of cooked white rice (~130 Cal), stir fried green veg, cauliflower. An orange, some blueberries. No sure of calorie count but vegetables are mostly not very significant. Fat from the stir fry might be a couple of hundred Cal (maybe 10-20g maximum). Almost certainly around 500 Cal for the day.


69.7kg, 13.1% fat. Woohoo! Eating tonight! I remark upon this every time I fast, but by the time I get to the last 2 days I have effectively stopped feeling hungry and could quite easily continue (which could quickly become dangerous). Food starts to taste really, really good. Plain white rice: delicious! Some flakes of plain, raw, rolled oats? Wow, so tasty who would have thought?

Breakfast: usual psyllium husk and water, a large soy latte

Lunch: skipped, green tea all afternoon

4pm 69.4kg 13.0% fat

Afternoon tea - fast broken! Sourdough toast with lashings of peanut butter and avocado... ahhh....


The original research work was 5 days over a 4 week period, but it's hard to know what is optimal.
If I stretch this to more-or-less 6 weeks, then ending the five day fast can be made to line up with druid holy days: the solstices, equinoxes and those in-between dates that mark transitions to or from periods of rapid change in day length.

I might have to rename it to my "40:5" diet  :-)

Friday, 21 August 2015

The 25:5 diet - second pass

Well, I've completed the second fasting cycle and now I have some data to share. I weighed myself each morning using a digital scale that uses bioelectrical impedance analysis to measure body fat. The method is not very accurate, but is very consistent - so changes probably mean more than absolute fat percentage. 

As a reminder, the diet is a variation on the now popular 5:2 diet, or periodic calorie restriction. The difference is that this one restricts both calories and protein for 5 days in a row, with the remainder of the month eating "ad libitum" - whatever you like. Details and a summary of the original research are given in my previous post. The study showed substantial benefits across a range of different health measures.

The time series starts at the beginning of the previous feed period. I've multiplied total weight by fat percentage to give fat mass (lower series, right hand axis) and (100 - fat percentage) by total mass to give lean mass (upper series, left hand axis). The blue and green data are during the feeding period, pink data are during the fasting (or fasting-mimicking) period.

The first thing to notice is that there is a rapid and sustained loss of both fat and lean tissue during the fasting period - from the data, perhaps 300g per day of each. Assuming that lean tissue loss has about the same calorific value as lean meat, about 100 Cal per 100g, that means I'm deriving perhaps 300 Cal per day by catabolising lean tissue. Fat has around 900 Cal per 100g, so I'm getting about 2700 Cal per day by burning fat stores. If I have the food intake about right, there is another 700 Cal from food each day. This works out 3700 Cal per day, somewhat higher than the average adult male energy requirement (2400 Cal per day), so either I'm missing something, or I have a higher than average energy requirement. This might have something to do with having a relatively high surface area, small volume (I'm tall and lightly built) and it being a bit cold (late winter). ie, I'm using a lot of food calories just to stay warm. Another possible reason is that the scale is over-estimating my body fat percentage and the fat mass reduction is not as large as indicated.

A commenter asked about lean muscle loss last time - and we can see lean mass loss in the graph. The mice in the study linked had a loss of organ weight during fasting, notably kidneys, liver and heart, but not brain, spleen or lungs. It would seem likely that at least part of the mass loss in the graph above is due to this. Part is probably lean muscle tissue.

The next thing to notice is the recovery phase preceding the fast. I least-squares fit a simple model to the fat and the lean mass data for the feeding period only. Expecting that change would be most rapid at the start and tail off towards an equilibrium at the end, I fit an exponential decay curve like
where m is mass (either fat, or lean), a, b and c are constants and t is time (day number).

The values of the parameters probably aren't interesting, but you can see from the graph that the lean mass recovers much, much faster than fat mass. Lean tissue recovery seems to be complete within a week, whereas fat mass is still rising when the next fasting cycle hits. This makes intuitive sense, as lean tissue would be the main priority for our bodies, fat is to a large extent energy storage and perhaps a second priority. It wouldn't make sense to store fat in preference to repairing muscle and internal organs that have been stressed by starvation. This observations could also explain the trend to visceral fat reduction that didn't quite reach significance in the research study after three diet cycles: from the above, it looks like we force a large reduction in fat during the fasting cycle, which the body isn't quite able to make up for during the feed cycle that follows (on the other hand, the same appears not to be true for lean tissue). So we might expect to see an overall reduction in body fat (hopefully, mainly visceral fat) over a number of feed / fast cycles. In addition to the other benefits (lower levels of IGF-1 etc.) which are a bit harder to measure at home!

Anyhow, we shall see. Stay tuned for more data and analysis as they come in. 

Sunday, 26 July 2015

The 25:5 diet - first impressions

Those who know me personally may be surprised that I'm dieting. At a bit over 6 feet tall in the old units, and about 73kg in the new, I am not what you would call overweight.

But for me,  dieting is not about weight. Since being diagnosed with MS in 2007, I've become much more interested in my health, including doing the best that I can do with diet. Diet is in our modern medical system, largely overlooked as a tool to treat illness and maintain optimal health. We tend to focus on pills and surgery for almost everything, but for MS (and for many other illnesses) neither of these approaches have been particular successful.

Research has shown that restricting dietary calories increases healthy lifespan in every animal that has been studied from nematode worms to monkeys. And that you don't need to do it all the time to have the same kinds of effects - alternate day fasting, intermittent fasting and the now popular "5:2 diet" show various health benefits. In the case of the 5:2 diet, by restricting calories on two non-consecutive days each week and eating normally on the other 5 days. Various versions of these diets are designed to get the positive effects without causing too much suffering in the dieters (this is important because if too much suffering is involved most people won't be able to follow the diet for any length of time and the whole thing becomes a bit pointless).

The diet I want to talk about today doesn't have a name yet, other than "Fasting Mimicking Diet" as labelled in the research paper that it comes from. This isn't very catchy or very informative though, so I'm going to call it the "25:5 diet", for reasons which will become clear.

First, lets look at this science. Although this isn't my area and there are doubtless things I haven't picked up on or don't understand fully, I feel I can make a pretty reasonable summary of what the findings were. The paper is "A Periodic Diet that Mimics Fasting Promotes Multi-System Regeneration, Enhanced Cognitive Performance, and Healthspan", by rather a lot of authors: Sebastian Brandhorst, In Young Choi, Min Wei,  Chia Wei Cheng, Sargis Sedrakyan, Gerardo Navarrete, Louis Dubeau, Li Peng Yap, Ryan Park, Manlio Vinciguerra, Stefano Di Biase, Hamed Mirzaei, Mario G. Mirisola, Patra Childress, Lingyun Ji, Susan Groshen, Fabio Penna, Patrizio Odetti, Laura Perin, Peter S. Conti, Yuji Ikeno, Brian K. Kennedy, Pinchas Cohen, Todd E. Morgan, Tanya B. Dorff, and Valter D. Longo; in the Cell Metabolism journal (for which free online access is given here).

These guys applied the Fasting Mimicking Diet to three very different organisms: yeast, mice, and people. Now clearly the comparison isn't exact, for instance yeast doesn't get cancer, and you can't cut up human test subjects to measure their organs, but there are a lot of points at which you can make comparisons. The basic approach is to trick the body into thinking it is starving (and in a sense, it is) over a period of 4 or 5 days by 1) restricting calories to less than half of the daily metabolic requirement and 2) restricting protein to less than a quarter of the recommended daily minimum. The results are summarised in the table below:

Impact Yeast Special Mice Humans
Diet cycle Nutrient rich growth medium for 2 days, followed by water for 2 days. Half of normal calories on day 1, 10% of normal calories day 2-4, by low protein and low fat food. Day 5 to 14 normal rodent chow. The mice ate enough extra on the feed days to make up for the diet in calorie terms, over each cycle. Half of normal calories on day 1, a third of normal on day 2-5, limit protein intake to 9-10% of total energy budget. Day 6 to day 30 eat whatever you like.
Lifespan About a 20 to 50% lifespan extension, depending on how you look at it. Half of the control group had died by 25.5 months. In dieting mice, this point didn't occur until 28.3 months, an 11% life extension. The life extension effect got larger the older the mice got (the control mice died sooner) but there was no effect on maximum age achieved. Can't assess that in a short clinical trial. None of the subjects died during the study.
Cancer Yeast don't get cancer, It's a multi-cellular organism's problem. The special mice are a strain that gets cancer a lot. Without doing anything mean to them, about 67% of the control mice have some type of cancer at the end of their life.
In the dieting mice, the rate was 40%.
No one got cancer during the study (and no one was expected to).
Visceral fat (the stuff that sits in your abdominal cavity, around your vital organs) Yeast don't have visceral fat Compared to the control mice, the dieting mice had the same lean body mass as the controls, but less total body fat (and less weight). Fat under the skin was about the same, but visceral fat was lower in the dieting mice (all measured during the feeding period). The dieting humans had 3% lower bodyweight at the end of the trial, visceral fat was trending lower and lean body mass was slightly higher.
IGF-1 Not applicable to yeast Reduced by 45% at the end of the fast period, returned to normal within a week of re-feeding. Reduced by 25% at the end of the fast period, remained somewhat reduced during re-feeding.
Insulin, glucose and ketones Not applicable to yeast Blood glucose dropped by 40%, insulin levels by 90% and ketones increased by 900% at the end of the fast period, these all returned to normal levels during the re-feeding period. Blood glucose dropped by 11% and remained 6% below normal even during the re-feeding phase. Ketones increased by 370% and returned to normal during the re-feeding phase.
Inflammation and stress resistance Fasting yeast were 100 times more resistant to hydrogen peroxide This breed of mice is also very prone to severe ulcerating dermatitis, at a rate that requires 20% of control mice to be put down. In the fasting group this was only 10%. C-reactive protein (a risk factor for inflammatory heart disease) was reduced in dieting humans.
Immune system health Not applicable Increasing age causes reduced production of adaptive immune cells in the control group. This normal decline is reversed in the fasting mice. Not measured
Regeneration Not applicable Stem cell levels in the dieting mice increased a lot, likely to contribute to regeneration of cells and systems. Possible increase in stem cells but not significant in the study.
Cognitive performance Not applicable Compared to the control mice, the dieting mice had enhanced cognitive performance, better motor learning, short term and long term memory. Evidence of promoted adult neurogenesis in the fasting mice. Not measured

So it looks like this diet will probably promote a longer, healthier life with improved cognitive and physical function into old age. How do we do it, and how easy is it to do?

First, we need to cut calories from about 2400 kCal per day to about 725, only about a third of normal. Second, we need to reduce protein intake to only about 10% of those 725 kCal. Thirdly, despite this we need to get as much nutrition as possible to avoid running short of any essential nutrients and causing problems. I found that it was reasonably easy to achieve all of this by:
  • only eating plant-based foods, mostly vegetables, vegetable soup made with chicken stock, and salads. I also had dietary fibre supplements (psyllium husk) as a substitute desert. 
  • no high protein foods - so as well as no meat, also no mushrooms, beans or peas, tofu, eggs or dairy, or nuts
  • carefully control fat and carbohydrate consumption to limit total calories to the target. I found it easy to exclude carbohydrate rich foods altogether (starchy vegetables and grains), and to carefully control fat consumption (maybe 40g per day, mostly as salad dressing and for stir-fried green vegetables.
Here is my typical fasting day:
Breakfast - a soy latte (a habit, I find it easier to manage the fasting phase if I dont give up all my normal habits).
Lunch - a plate of salad with vinaigrette from my cafe at work. Choose the low carb, low protein salads (no meat, beans, cheese, potato etc.). The vinaigrette is important to make it delicious. I figure it may be 10 to 20g of fat total, mostly in the vinaigrette, but this is a guess only.
Dinner - a bowl of cauliflower and leek soup, and some stir fried green vegetables (maybe another 10 to 20g fat).
Desert - 150g blueberries, psyllium husk jelly and 20g coconut cream.

I found this pretty easy to comply with, because it was all nice food and relatively filling. Another meal that works is ratatouille  - as long as you're careful with the oil in the recipe, the rest of the ingredients are all low carb, low protein and low energy. Having a significant fraction of allowable calories from fat seems to be important in making the food palatable.

Over the 5 days I felt a bit hungry sometimes, but not ravenously so, and never following a meal. My urine ketone levels went quite high, well above 5mmol/L. My weight dropped by about 1kg - which would correspond to using about 200g per day of stored fat to make up about 1800 kCal of daily energy deficit. I figure this means I got the diet about right without precise calorie counting each day.

I found this easier to do than the 5:2 diet, partly because the food quantity was higher and it was more palatable, and partly because you quickly get used to eating less. In the 5:2 diet, the diet day was always slightly traumatic and unsatisfying because each time it is a change from the day before.

So far, it looks like this is fairly easy to do. I'll post again next month with some real data and graphs.

Thursday, 23 July 2015

A lithium ion battery story

I've been riding e-bikes on and off for years now. I'm on my 4th build, all using the same bicycle, and I've learned some things. Which can basically be boiled down to: you really want a rear wheel drive geared hub motor and a mid-mounted battery - Lithium iron phosphate, if you want durability and worry-free charging.

Anyhow, that's a story for another day.

Build three and build four both used Iron-Phosphate chemistry lithium ion batteries from Ping Battery. Build three was a 24V, 20Ah system that was uneventful from the battery end of things - it worked perfectly and as far as I know it is still doing so as part of a UPS that a mate has reconditioned. Build four was a 48V, 10Ah system - the controller I selected for the system wouldn't operate on less than a 36V pack so I needed another battery. 48V seemed like a good idea because the currents are all smaller for a given power output, so the wiring and connectors don't need to be as robust.

Ping batteries have a neat little BMS board, which routes the main negative lead from the battery through a bank of parallel power transistors. A sensor wire comes from each junction between cells and connects to the board - 16 cells for the nominally 48V battery. The sensor wires let the board know what each individual cell voltage is, and as far as I can tell, during discharge the BMS does the following things:

- it closes the power transistors effectively shutting off the battery pack if any individual cell drops below a pre-determined voltage limit, to protect that cell from low voltage state and possible polarity reversal caused by the rest of the battery continuing to push current through it.

- shuts off the pack if the total battery voltage drops below a pre-determined limit

- shuts off the pack if current exceeds a pre-determined limit

Charging uses the bulk charging method, which passes a controlled reverse current through the whole battery pack, charging all the cells at the same time and by the same amount. Because the cells are not identical, this will eventually lead to some cells being over-charged. To prevent over-charging of cells, if a cell voltage exceeds a pre-determined limit, the BMS opens a small circuit just for that cell, which dissipates some energy through an overflow resistor and lights up a small LED to let you know what is happening.

Hence, what you see when you charge the pack is that as it gets close to fully charged, the LEDs start coming on more of less at random (there's that word again) until they are all lit up - meaning that the trickle current still being delivered by the charger is all being dissipated as heat by the overflow resistors. This would mean that all the cells are at the same voltage limit (and state of charge), hence the pack should be balanced at the fully charged state (which is where you want it balanced).


The first clue I had that something wasn't right (which I didn't realise at the time), was that the last 4 LEDs on the battery management system were failing to light up consistently. I found out later that this was probably in part or in whole due to a design fault with the BMS. The later BMS design, which replaced this one, boasts a "Different power source. The elder version of BMS or some other BMS in the market are powered by the lowest 4 series of battery cells. The V5 BMS is powered by all the cells. This way, the battery pack won't be imbalanced even it's not charged for long time when BMS is connected."

Hmm. Lowest 4 cells eh? 

This shouldn't have been a problem by itself. I did leave the pack on charge, even overnight a few times but the last 4 cells stopped lighting up. I now guess this would mean that the power being withdrawn to power the BMS must have been about equal to, or exceeded, the trickle current from the charger once it had gone into trickle / voltage maintenance mode. It might have been avoided had the charger been adjusted up to a slightly higher cut-off voltage - enough to make sure that all 16 cells reach the overflow state, not just the first 12.

So, unbeknownst to me, I was riding around on a battery pack that was becoming progressively unbalanced, the last four cells getting to a progressively lower state of charge than the rest of the pack.


As I mentioned, I didn't recognise this as a problem until much later. What I did recognise as a problem occurred riding home one day in an exceptionally heavy downpour, safe in the knowledge that the battery and electrical connections were safe and secure in a waterproof bag. Well, more water-resistant as it turned out.

Complete power loss at the end of Coward street in Mascot.

Stopped under the bridge near the airport, power starting to come back on, but seem to have a large voltage drop if I open up the throttle too far. Limped home, then discovered blackened plastic over the end of the BMS and some blobs of solder that had, until recently, helped secure the negtive power lead to the output transistors on the BMS. A closer look at the BMS showed droplets of condensation on the inside of the clear plastic shrink-wrapped cover. 

Crap. I had been unlucky enough that some water had dripped into the tiny opening in the end of the shrink wrap and landed directly on the BMS circuit board. At least thats what I assumed had happened.

So I unplugged the BMS and contacted Ping from PingBattery. On his advice I read off the voltages of each individual cell and they all seemed ok. Clearly the BMS itself was either toast or not to be trusted, so I disconnected it altogether. A battery, pure and simple, no electronics. Since during charging, all the cells appeared to light up in very rapid succession (except for the 4 dodgy ones at the end of the pack), I figured that the cells were so well matched that I could safely ride and bulk charge for a while without a BMS, until the new one arrived in the mail from Ping.


After riding a few times I noticed the battery performance getting progressively worse. I was getting substantial voltage drop, indicating empty state, after around 5 Ah (on a 10Ah pack - about 50% of charge). Not quite enough to get to work. I figured the battery was probably screwed. I read off the cell voltages and the first 12 were fine, the last 4 were way below minimum discharge voltage, all the way down to only a volt or so each (minimum safe voltage for these cell types is supposed to be about 2.8V).

What I now think happened here, was that when the faulty (wet) BMS had shorted, it drew all that power to toast the power transistor and melt solder, from just the last 4 cells of the pack - leaving them in a much lower state of charge than the rest of the pack. This explains the big voltage drop as the battery discharged: as those 4 cells reached the empty state, the good cells pushed them down way below their safe voltage, making it look like the whole battery was discharged. Precisely the kind of thing that a BMS is supposed to prevent, though in this case it was probably precipitated by a BMS fault.

The solution? Open up the battery and remove the 4 weak cells, leaving me with a 12 cell, nominally 36V pack. Some really chunky solder holding those cells together, couldn't separate them using my little 60W soldering iron. So I broke out the retractable stanley knife to cut through the copper electrodes below the solder. Then packaged the thing back up - cut down the fibreglass panels to match the slightly shorter battery length and wrapped it up in fibre tape. Good stuff, fiber tape. Just like sticky tape only a lot stronger, and no stretch.

The next step was to solder on a main discharge lead to the new end of the battery, and attach some new Anderson powerpole connectors. Cut wire, strip insulation, fit new powerpole conductor, fit a piece of stickytape over to prevent it shorting as I do the other wire. Repeat: cut wire, strip insulation... BANG!!! Sparks everywhere. Blobs of molten metal have burned small holes in the dining room table and a piece has been melted out of the side of my tool steel wire stripper. The connector that I had insulated with sticky tape had vapourised completely, though the wire it was attached to was fine. Ok, so sticky tape (fibre tape) is not such a good insulator, even for 36V.

Anyhow, finished packaging up the pack, put it back on the bike and everything seems to be fine. Apparently a transient current of what must have been at least several hundred amperes didn't do it any harm at all. By now I've acquired a BC-168 battery charger (thanks Paul!) which reads voltages and independently charges up to 6 cells in a block - two blocks for this battery pack, now. The pack seems to still be working fine. As far as I can tell, the usable capacity seems to be about 9.3Ah - and this is regularly drawing about 50% more than the rated current (although for most of my commute I'm drawing less than the rated 10A).


So I've been riding around with the reduced voltage pack for a while, and everything is going fine. I've watched this clip from Jeff Dahn which goes a long way towards explaining what goes on with lithium ion battery death, and figured that if I'm leaving the pack unused for a while, I could maximise the life of the cells by keeping them close to the discharged state. Thinking this was a great idea, I left for a short break, returning about a week better to find an apparently dead pack.

Normally I leave my cycle analyst connected to the pack, partly out of laziness and partly to let me see the pack voltage at a glance. What I hadn't considered is that the cycle analyse itself draws about 10mA of current, and because the pack was nearly empty, this was enough to deeply discharge the battery pack, below the approximately 21V lower operating limit for the cycle analyst.

I connected the BC-168 to check the cell voltages - bad. Several read zero volts, some were at various points around 1 volt and all of them were under 2 volts (remember these are not supposed to ever be discharged below about 2.8V). Hit the charge button,  it started charging the cells, but only the ones that weren't dead flat. Of course - the dead flat cells just look like an open circuit as far as the charger is concerned. Disconnecting the BC-168, I connected my bulk charger immediately - nothing happened. Apparently the pack voltage was so low that the charger had not registered that a load was attached. So neither charger can recharge the pack!

I fixed this by charging both pairs of 6 cells for a few minutes using the BC-168, bringing up the voltages of the not-dead-flat cells. I figured if I could get the overall pack voltage high enough, the bulk charger would register that a pack was attached, which I could then use to get some current into the dead-flat cells. It worked. I left it bulk charging for a few hours, then disconnected it, recognising that at the very least, the pack would be badly out of balanced, probably with some badly damaged cells and possibly even dangerous.


I used the BC-168 balance charger to balance up the pack, taking a couple of days. I used it to ride around for a few trips, looks ok although checking with the balance charger shows that apparently some cells are leaking charge because they seem to drift out of voltage with the others. Probably manageable if I balance it regularly, at least until I get a new pack.

Then I left the balance charger on overnight - no big deal. At least, not for a battery that is balanced - it stops charging when the pack voltage gets to 42.6V. The problem was that some of the cells were leaking (I thought). When I checked the cell voltages that morning, they were varied - some at only about 3.3V but one of them was at 4.5V! Remember these cells are supposed to operate between about 2.8V fully discharged and about 3.6V fully charged. Even LiPO cells are not supposed to go as high as 4.5V.

Ok, go for a quick ride to get that voltage down - when the cells are fully charged, voltage changes very rapidly with state of charge, so even a small amount of discharge should greatly reduce the voltage of the over-charged cell. It worked, thankfully, then I put the pack back on the balance charger.

The more that I rode around, and after several weeks of regular balance charging, the pack started to behave better and better. The cells stopped drifting in voltage - it seemed it wasn't self discharge or leakage after all, rather some kind of slow dynamic within the battery that made it look balanced, even though it wasn't properly balanced yet. Less and less balancing became required as the weeks went by until it seemed that I had a perfectly good battery pack once more. And the pack capacity? I haven't measured it with any confidence since then, but it's still at least 8.5 Ah. After the amount of abuse that I've inflicted on that pack, I'd say that's remarkable. Two thumbs up for Mr Li - his BMS may have left something to be desired, but it appears that the cells used were top-notch.


What do I know now?
  • Cell balancing in a battery pack is important - you can get away without it for a while (maybe a long while) but eventually things will start to go wrong. Make sure you at least check the individual cell voltages periodically - otherwise you risk over-charging or over-discharging individual cells.
  • A badly out-of-balance pack can take quite a long time (weeks of charge / discharge / rebalancing) to come properly back into balance again. 
  • Make sure you don't accidentally over-discharge your pack - disconnect even tiny loads (possibly including the BMS if you are using one) if you are going to leave it sitting around for a while.
  • Make sure your battery is really waterproof! Especially the BMS.
And what do I suspect?
  • LiFePO4 chemistry seems very robust. I have way over-charged, and way over-discharged some of these cells, and they still seem to be just fine.
  • LiFePO4 is also supposed to have longer cycle life compared to LiPo, and I suspect that a large part of this is just due to the lower cell voltage being less oxidising of the eletrolyte (see Jeff Dahn's talk above.

Saturday, 25 April 2015

Random ramblings

Are my ramblings really random?

What does random, or randomness even mean? The wikipedia (pretty good at a lot of topics) describes randomness as a lack of pattern or predictability in events. That seems like a reasonable definition to me, or at least it did until I thought more about what that means.

There's something missing in that definition - a subject, to whom the randomness appears. What appears random to one person might not be to someone else. All the events we see around us were preceded by event chains, some of which we are aware but most of which we are not. Events that happen as a result of unknown causal chains can appear to us as random but they are not - they are merely unpredictable (by us) because we don't have the information or the capability to make the prediction.

The same wiki page goes on to discuss this a bit but then launches into a discussion of random vs pseudo-random numbers. Random numbers come from "really random" events, whereas pseudo-random numbers come from deterministic (but complicated) algorithms to produce a series of numbers that don't have any obvious pattern or predictability. Example: so-called random number generators in computers. They aren't random numbers, they are an entirely predictable sequence of numbers in a complicated pattern that looks random. It looks like there isn't a pattern. But there is.

So what's different between a "really random" number and a pseudo-random one? Maybe, there isn't a difference. Maybe "really random" just means that the patterns aren't perceivable by us, and the results aren't predictable by us. So actually they are really only pseudo-random. Everything that happens is caused be a preceding event chain (except perhaps for quantum events - and I'm not entirely convinced about that). Or in other words, nothing is really random - just playing out a complex pattern that isn't knowable by us.

Take quantum mechanics. The main view seems to be that quantum events (like atomic decay) are really truly random, in the sense that they really don't have a cause ("God playing dice" - an idea that Einstein was never happy with). "Real randomness" is entirely consistent with the idea of the Universe as a vast computer simulation, though. If the random numbers are determined outside the simulation, then events determined on the basis of those would appear truly acausal from within it.

That explanation doesn't mean that events within the universe are meaningless because they are un-caused though, far from it - something exists outside the simulation and the simulation is being run for a reason.

But true randomness and acausal quantum events aren't the only interpretation of the meaning of the equations of quantum physics. De Broglie-Bohm theorem is another interpretation that's completely consistent with experimental observations and does not require "really random" events, but does require non-local hidden variables that describe the way every particle in the universe is related to ever other. So it seems that if there is nothing that happens without a cause, we need to accept that everything is connected by some kind of mysterious and unmeasurable something that links everything in the universe together.

Connected by what? Qi? The Force? The Pilot Wave?

Both of these interpretations leave room for sources of magical power. In the "world as a simulation" model, events could be influenced from outside by dicking about with the random numbers that determine quantum events, a process that can cause coincidences and synchronicities to occur but cannot break physical laws. Presumably our programmers have their reasons for not interfering directly in the simulation. In the "interconnected world" model, events can be influenced from inside by manipulating the Qi, but again not in a way that can violate physical laws.

I don't think I believe in randomness anymore  :-)

Saturday, 24 January 2015

Meanwhile, back in the real world...

You don't live in the real world.

The world that you experience every day is, not exactly a figment of your imagination, but a representation of the real world, constructed by your brain. To my mind the clearest example of this is your perception of colour – the sky is blue, but blueness doesn't exist in the real world. In the real world, light from the sky is composed of a wide range of different frequencies, from the ultraviolet band, through the visible and tailing off into the infrared. We know this because we can measure it instrumentally. Our instruments can measure any property we like about this light – in addition to its intensity over the wide range of frequencies, its polarisation and coherence (and probably other properties I haven't heard of). We can even measure it as individual photons. But we can't measure its blueness.

Of course we know that light over a particular range of wavelengths appears to us as blue, but in the world as measured by instruments, blue light is different to red light only in its wavelength – it is a difference of quantity, not of quality. The quality of blueness can't be measured, because it's a subjective experience inside our heads. The experience of blueness occurs when the receptors in our eyes which are more sensitive to the blue wavelength band, are stimulated more than the receptors that are sensitive to red and to green. The colour blue is something that belongs to our simulated world, not to the “real world” out there.

Now, the simulated world that we live in does bear some relationship to the real world, but not in the way you might think. The world that we experience is a greatly simplified representation of the real world, that helps us to survive. It contains the details of patterns that we are drawn to notice, many of which are hard-wired (is that a face? is is there a leopard hiding in the grass over there?) and some of which are learned. There is nothing that requires the simulated world in our heads to be accurate, foolproof, or even make us happy. Magicians actually rely on fooling our brains (this happens in entirely reliable and predictable ways) into constructing a world that doesn't correspond to physical reality, for dramatic and entertaining effect.

In fact, the world of our everyday experience is full of things that don't really exist at all. Take a teacup, for example – an object of some moderate significance in our world. You can do all kinds of things with it, it has properties and functions that are useful for you, you can describe what it's like including its weight, shape, colour, etc. But in the physical reality at the molecular and atomic level it doesn't even exist as an object. The aluminium, silicon and oxygen atoms that make the teacup don't care that they're part of a teacup, they don't even know that they are part of a teacup. Each atom is affected by electronic interactions with its nearest neighbours, but further away than that there is no physical, atomic significance whatsoever for the fact that they are part of a teacup, a dollar-shop garden gnome or a Ming dynasty vase. Now, this is the important bit: in our constructed worlds, the thing that for us is a teacup (or a gnome, or a vase), emerges from the relationships between the components at the level below. The teacup is not a real, physical thing, but a pattern that only exists, only is recognised, only has any meaning inside your head. It's just as Spoon Boy explained to Neo in The Matrix: there is no spoon.

This might seem silly, but it's even easier to explain with living organisms like yourself. Your physical body is composed of cells of many different types, which live, reproduce and die according to rules that keep your body functioning properly. Over 25 years or so, every single one of your cells will have been replaced – some of them many times over. You are now composed of different matter than you were 25 years ago. In fact your body is a self-sustaining pattern that continually absorbs atoms from the environment when it eats, drinks and inhales; and emits them continually through exhaling, sweating and various other bodily excretions. Yet somehow you are still you, a bit like the old joke about Granddad's favourite axe that has had its head replaced twice and the handle three or four times. The point here bears repeating: the things that are significant in the perceived world that we live in are patterns in the “real world” like a wave is a pattern in water. What you think of as the real world is in fact a representation of the relationships between the components of the real physical world, not the real physical world itself.

Now in esoteric thought, it is considered that we humans inhabit the physical plane, the lowest of planes. I wonder though, if the world of our everyday experience is actually a fairly abstract representation of the patterns in the physical world, the world of our experience isn't the lowest plane after all. The "real" physical plane of molecules and atoms exists below the plane that we live in. It isn't a direct part of our world at all, but it's required absolutely for our world to exist. The patterns of our world are patterns in something – the physical world of atoms and molecules.

Even atoms though, are really just patterns of organisation of subatomic particles with emergent properties of their own. The protons, neutrons and electrons in the silicon atom in your teacup are the same as those in the aluminium atoms – they are merely taking part in a different dance and forming a different pattern with different emergent behaviours. At this level and below the world is a weird mix of quantum mechanics and strings vibrating in eleven dimensions: a world that is utterly unlike the world of our experience, dimly and imperfectly glimpsed through the lens of mathematics. But real, nonetheless. If it weren't so you wouldn't be reading this, because despite being utterly alien to us, quantum mechanics works and is the basis for the electronics we use every day.

What about the other direction though? If the patterns that make up our world are patterns in the plane below, what of the patterns in our world? If the constructed world we live in is a representation of patterns in atoms, which themselves are patterns of subatomic particles, which are in turn patterns in vibrating string-stuff, what is the significance of the patterns in our world? Do they form a constructed reality for consciousnesses inhabiting the plane above? And what of the patterns of those patterns, at some even higher level? Scientific thought largely ignores this. In fact, science goes to a great deal of trouble to exclude any patterns at all from outside the experiment, to make clear the very simple kinds of interactions that are within our intellectual capabilities. This is a very good reason, but I think it has left a kind of cultural blind spot that comes with scientific training. The scientific study of the patterns themselves – ecology, chaos theory, whole systems analysis, are fiendishly complex and even then are not predictive of the emergent behaviours at the next level. They study the interactions, not the meaning of the interactions in the next plane up.

So in the prevailing western scientific world-view, perhaps as a result of this cultural blind spot, the assumption is that there is no significance at all to patterns in our world – except for the special case of the patterns of neuronal organisation in our brains. These special patterns somehow have the emergent property of consciousness (and among other things, the subjective experience of the colour blue). I suspect that the only reason for this acceptance is that it's difficult to deny the reality of subjective experience, and without a non-physical soul or spirit or some other essence (an unpopular notion in science these days), there doesn't seem to be any other way to explain it. It must therefore be an emergent property. So we're left with the slightly absurd notion that the complex network of interacting components in a human brain gives rise to consciousness (and, grudgingly, perhaps this is also true but to a lesser extent in animal brains), but that other kinds of complex networks of interacting components do not give rise to consciousness. This notion is of course entirely untestable in any way that is acceptable to science and hence is not properly a part of science at all. Ecosystems, human societies, weather patterns, biospheres, all are assumed to not give rise to consciousness in the same way that a brain does. There's no reason to make this assumption, in fact it may be more reasonable (and perhaps safer!) to assume the converse.

On the other hand, if consciousness is not “just” an emergent property of sufficiently complex physical systems (or whatever property it is that does the trick), and it arises because of some other factor like a life force or soul, then why wouldn't that factor also manifest in ways other than human consciousness? Unless your religion insists that said factor only applies to humans, but this doesn't seem any more satisfactory than the special pleading in the scientific world-view that only brains, and not any other kind of complex interacting network, cause the subjective experiences of consciousness to arise.

Either way, those subjective experiences do arise. You and I both do perceive the colour blue, and both recognise a teacup when we see one. Whether my experience of blueness is anything like yours, I have no idea. I guess that it probably is, because we're both humans with a lot of biology in common, but this is only and always will be just a working assumption. Although our experiences may be similar to each other's, they are not in any way similar to what “the real world” (whatever that might mean) is really like.

It could be that the world and its planes are just patterns all the way down, and may well be patterns all the way up as well.

Tuesday, 20 January 2015

Cycling to Work

After banging on about the lack of understanding of bicyclists by car drivers, you'd have to wonder why I choose to ride a bike at all, let alone 20km to and from work every day. Anything really worth doing usually has more than one good reason to do it, and cycling has several, at least for me.

1. It's really, really cheap

Cycling has to be just about the cheapest form of transport ever. If you're commuting regularly you'll want quite good tyres and these turn out to be the major ongoing cost. I figure about $80 (call it $100) each for a good commuter tyre, which goes to the rear wheel, the nearly worn out one going to the front where it wears much more slowly. I'll need to do this about every 10,000km or so, so of the order of $1 per 100km or about $2 per week.

Now, my bike is electric, so I also need to figure out costs for battery replacement and fuel (electricity). My current battery from Ping battery has done about 400 cycles and still works like brand new (after some major dramas with the battery management system, but that's a post for another day), so I expect it should be good for at least the rated 2000 cycles. Perhaps 3000 because I don't fully discharge each time and don't charge it as high as it will go. At about $500 per battery including shipping from Shanghai, that works out at around a bit less than $1 per 100km, maybe $1.50 if the cycle life doesn't work out. Electricity is about 30c per kWh and I average about 0.011kWh per km (1.1kWh / 100km), so about 30c per 100km.

So my total weekly operating costs are probably less than $5 – about the price of your average soy latte. Compare that to at least $35 per week if I take train and bus, and $20 – $30 per week on petrol alone (depending on price) if I take the car.

2. I never have trouble finding parking

No matter where I'm going, there's a street sign, a tree, sometimes even a bicycle rack(!) that I can lock up to, virtually at the front door. At work my bicycle spends the day with me in my office. If I take public transport I can factor in at least an extra 5 to 10 minutes of walking, more like an extra 15 minutes on top of a driving commute assuming I can find a parking spot not too far from work (either that, or fork over more than $1000 per year for a permit to park on campus, but even that doesn't guarantee finding a place).

No matter how busy the shopping centre is, I can lock up right outside to pick up some groceries on my way home. I don't waste 20 minutes getting into and out of the multi-storey car park.

3. I know exactly how long it will take me to get there.

Traffic conditions do not affect my trip time. In fact, the slower the traffic is, the more pleasant my trip, because it's quieter. When I was driving to work regularly, it would take me usually an hour (not including walking time from where I eventually find a parking spot). Forty minutes on a good day and two hours or more on a bad day. It's actually quite stressful if you need to be somewhere at particular time to deliver a lecture or pick up the kids. I'm sure that the stress that causes takes a toll, long term.

When I'm riding my bicycle, it takes an hour and 5 minutes each way, plus or minus 5 minutes. Maybe plus 15 minutes if I get a flat tyre (hence the need for good tyres) or if the weather is really awful.

4. Strapped into a metal box on a freeway-turned-parking lot, or...

Zooming down the virtually deserted Muddy Creek cycleway, sun and fresh air on my face, past the old Chinese guys fishing at the bridge, the moored boats, she-oaks and the blue wrens flitting in and out of the grass.

5. Less environmental impact

Less of just about everything – greenhouse emissions lower by about a factor of about 30 compared to driving a car, less other consumables, less materials used in manufacturing etc. For some people these things matter more than for others. For me, let's just say it's compatible with my religion. Whether this factor is important for anyone else is a matter for them.

6. I like riding bicycles

It feels great. I've always enjoyed it, there's not much to rationalise about that.

7. Health benefits

Sure I don't push much (riding an e-bike, after all, is just like a normal bike where everywhere is downhill), but I do spend my commute turning the pedals for camouflage, pushing a bit up hills, balancing etc. It's got to be healthier than sitting in a car for the same amount of time. I'm convinced my regular cycling has kept my cycling balance free from any noticeable effects from MS, although my walking balance is a little bit crap and I'm a long way from being able to ride a skateboard.

8. Being different

Showing people that there are alternatives, and it's ok to be different.

Sure there are downsides to cycle commuting too. It can be unpleasant when it rains, downright dangerous in high winds, I can't take passengers or carry heavy loads. I keep a car for when I really need those things, which is why it sits in the driveway while I'm enjoying my commute to work.