Measuring Ketosis With An Arduino


A bit of biology and nutrition before we roll into this: Ketosis is when your body runs on fat reserves instead of carbohydrates. This is the basis of diets such as Atkins, and despite the connotations of eating hamburger patties and butter, you can actually lose weight on these diets. One problem with a keto diet is the difficulty of measure how many ketones your liver is processing; this can be done with a urine sample, but being able to measure small amounts of acetone in your breath would be the ideal way to measure ketosis. [Jens] came up with a device that does just that. It’s called Ketosense, and it will tell you how well your keto diet is doing by just having you blow into a sensor.

[Jens]’ device consists of an Arduino, LCD display, and two sensors – one for acetone, and another for temperature and humidity. By carefully calibrating a TGS822 sensor, [Jens] was able to measure the acetone content of an exhaled breath along with temperature and pressure. This gave him a reading in parts per million, and with a short bit of math was able to convert that into something that made sense when talking about ketosis, mmol/l.

Without access to a lab that can measure blood ketone levels, it’s difficult to say if [Jens] device really works as intended. If he were to find his way into a lab, though, it would be possible to correlate his sensor’s values with blood ketone results and improve the accuracy of his sensor.

19 thoughts on “Measuring Ketosis With An Arduino

      1. Wiki “Diabetic ketoacidosis” as a symptom of being unable to use the sugar present in the bloodstream leading to Ketosis which over time will severely lower the pH and that will mess you up something fierce, like Diabetic Coma severe.

        1. Not exactly. I am not a diabetologist, but I am an American physician who has adopted a low-carb way of eating and has been in ketosis (excluding a few planned cheat days) for over a year.

          Diabetic ketoacidosis (henceforth DKA) is a syndrome that results from the absence of insulin. Because no insulin is present, the body cannot use glucose for energy despite the fact that it’s being consumed (as bread, potatoes, sugar, etc.). It thus accumulates until it starts spilling into the urine, which rapidly dehydrates the body (as each glucose molecule takes water with it). Ketones are an alternative fuel source for the body when carbohydrates cannot be utilized – either because they are absent, or because the insulin is absent. In DKA, they are produced despite high glucose levels because the body cannot effectively detect and use glucose in the absence of insulin. In simple ketosis, they are produced because there is little or no glucose present. In both cases, the ketones are merely a symptom, not the disease; they are a response to low carbohydrate ability. Ketones are not responsible for DKA in any fashion.

          1. You are not entirely correct : It is not “in the absence of insulin”, but “in the absence of *enough* insulin”.

            This is an important differentiation, because Type1 diabetics will hardly have entirely enough insulin (or else risk many Hypoglycemia-attacks), as a result they’ll always burn a little fat, resulting in Ketosis.

            As such, the ketosis-levels is one of the indicators for how well the patient is dealing with the Diabetes. As such, together with the HBA1C, it are the most important indicators as to how “healty” you are as a type1 (obviously, the patient’s feeling well or not are most important inidcators).

            Source: I am type1

  1. Monitoring ketone levels is important for treating some forms of diabetes and epilepsy. Ketostrips weren’t invented just for diets! Worth mentioning since no one else appears to have yet.

    I don’t know if any other electronic monitoring solution exists, but this could actually be a lifesaver, not just a diet aid.

    1. Ketone levels are something to be concerned about mainly only in acute untreated (or very poorly treated) type 1 diabetes.

      As I recall, when there is no insulin in the blood, your body assumes therefore that there is no glucose either, since it’s the insulin’s job to deal with glucose, so it starts churning out ketones instead from your fat stores (evolution clearly didn’t take the direct route of looking at the glucose in the blood to determine if ketones are required!)

      In the acute diabetic they have no insulin, but they have piles of blood glucose, (precisely because there is no insulin to get rid of it), the body sees no insulin and starts producing ketones until there is insulin again, which never happens. Worse, the body uses the surplus blood glucose ahead of the produced ketones, so what you wind up with is a complete run-away ketone production, with your blood becoming more and more saturated with them (Diabetic Ketoacidosis).

      In a normal non-diabetic, there is no run-away situation, the body uses the ketones normally because there is no/low blood glucose, and once they ingest glucose the insulin kicks in and the ketone production stops, so there is no dangerous run-away situation.

      I have not had to use ketone testing since I was dx as type 1 about 20 years back, I think it took about 2 weeks for my blood ketones to fall away as I remember (after some days in hospital on continuous insulin infusion and potassium drip ).

      1. The ketones themselves aren’t super problematic even though they cause a acidosis as you say. It’s the dehydration, these people can have lost 5-10kg of water (along with vital salts). So you could say ketone levels are never really that important.

        Thats why doctors use urine testing sticks which just give results of negative, +, ++, +++.

        But what about dieters? I firmly believe diets are pointless. You need to make a change you can maintain forever. Hitting the atkins for 2 weeks is great but the weight will likely return in similar time. You need sustainable changes to your eating habits and these almost nessesarily shouldn’t make you particularly ketotic.

        Alternate day starvation seems interesting though.

  2. >Without access to a lab that can measure blood ketone levels, it’s difficult to say if >[Jens] device really works as intended.

    Drink a known amount of some ketone (…10ml acetone, yum!) and watch it appear on the sensor. This is called “spiking” and it’s how “actual labs” get quantitative results from a GC trace.

  3. O.k. Ketoacidosis is a very real problem for people with type 1 diabetes. Having said that, a sick day, where you can’t eat normally and reduce your external insulin intake can cause your body to burn fat instead of use the carbohydrates. The ability to measure Ketones by blood meter is readily available, for example the Precision Xtra which we use for monitoring my oldest child’s ketone levels as needed. This however is not as accurate as blood drawn ketone tests, however the meter method still uses a finger poke to draw blood and interstitial fluid. You could use a meter to get a closer representation without the need to exact large amounts of blood/lab time to do a closer rough calibration. So a non-invasive meter(read NO Finger blood draws) would be a welcome addition to most people with diabetes that already do a lot of blood glucose checks, just to have that sanity of mind that they are not rising too fast or that their body has become flooded with ketones and starts shifting the pH balance of the body. The dehydration isn’t the only worry with Ketoacidosis, the pH shift can eventually lead to a coma and organ shutdown. Hence why DKA is such a big worry with people stricken with Type 1 diabetes.

  4. Using a breath-analyzer for ketones would be good to help correlate to blood levels. The problem with the urine sample for ketones is that it tells you after the fact when you are already in trouble. Maybe could integrate/average the breath-analyzer result to correlate to urine sample results?

  5. I feel I should post a warning about ketogenic dieting, based on personal experience…take from it what you will:

    First the good news: While dieting using ketosis as a method to promote weight loss, I was able to drop a significant amount of weight (~50 lbs.)

    Now the not so good news: I found it difficult to transition back to anything approaching a normal diet and maintain the weight loss…i.e. it was very easy to gain the weight back and return to my start weight.

    The even less good news: The side effects of ketogenic dieting can be significant. At the time I was unaware, but a few years after dieting I started doing some digging and found a number of studies about ketogenic dieting that matched my personal experience. The most significant, to me, was a study done by the Canadian Army (during WWII) to determine the effects of using pemmican as an emergency ration. A number of additional studies have been done, demonstrating and attempting to ameliorate the results that ketogenic dieting can have a severe consequences in producing lack of energy, listlessness, irritability and depression. It does appear that careful maintenance of sodium and potassium levels may lessen such effects.

    My personal experience with lack of energy, irritability and depression were significant and had lasting personal consequences.

    So, props for the hack! However, like many other interesting devices, be warned that it warrants thoughtful application.

  6. I use the Ketonix multi-use ketone breath analyzer ($149) which provides color-coded and numerical readings in ppmv. I have not found a clear conversion path but a reading of “50” ppmv is roughly the same as 1.0 mmol/L. That’s my minimal goal.

    Loss of electrolytes is a natural result of ketosis. Simply add sodium (sea salt) and potassium (lite salt) and magnesium (Calm) should you feel a lack of energy, or irritable.

    Nutritional Ketosis is the perfectly normal reaction of the body to lack of glucose, either through famine or carb restriction. Normal body cells switch readily to ketones. Cancer cells do not, and starve (an added benefit). Ketones protect brain cells from oxidation (dementia) and muscle mass from cannibalization. The body burns fat for fuel, beginning with the worst type (hard, brown) and then moving to the less harmful (squishy, white).

    NK has nothing to do with ketoacidosis, the dangerous state of high blood glucose AND high ketones, which can occur in Type 1 diabetics. Normal folks will see ketones rise as glucose falls and vice versa.

    I move between a Wheat Belly (Dr. William Davis) lifestyle and the Ketogenic lifestyle — but refrain from all refined sugars and grains regardless. There is no sense “doing Adkins for two weeks” and then return to the very foods that made us obese in the first place: grains, sugars, and grain-derivatives (maltodextrin, corn syrup, wheat starch, modified food starch, high fructose corn syrup, and “gluten-free” additives like tapioca starch and rice starch). The additive nature of these grain products and by-products make them popular for food processors. I have no intention of ever returning to eating grains, because doing so means the return of weight gain, joint pain, inflammation, oxidation, insulin spikes, and ultimately diabetes, cancers, and dementia.

    Note: These American maladies have skyrocketed since the mid 1970s, when the USDA first published its Food Pyramid calling for “limited fats” and “6-11 servings of grains (50% whole grains) per day.” This has proven to be a prescription for diabetes.

    The software which accompanies the Ketonix device is not user friendly, but as you learn how it works, provides a great deal of information, as well as logging and graphing abilities.

    Dr. William Davis, “Wheat Belly Total Health” and “10-Day Detox,”

    Dr. Joseph Mercola,

    Also Perlmutter, Jimmy Moore “Keto Clarity,” and Nutritional Ketosis

  7. So i don’t mean to be rude…
    So far i have noticed that the power regulator is ladled differently from the one he uses in the picture of the device( noticed after i looked at a blow up of the given picture of the ketosense). i noticed that although he talks about the barrel adapter in the comments under the page he doesn’t tell which it is. I also noticed that the micro switches are either interrupted voltage or single pulse voltage. And can i get a resistance value on the potentometer that is seen on the pict and has a pict in the comments but is not listed (got a few lying around).
    I have done lots of other projects and this looks simple at first, however when you start trying to follow someones directions and find out that they haven’t done the inventory.

    Once again… I dont mean to be rude. This is for a diabetic buddy of mine and i would like to be done with it by now.

    Thank You
    P.s. I had no idea this would be forwarded to word thought it would stay on hack a day.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.