Close
0%
0%

Automatic Diet Tracker

You wear it and it tells you if you are loosing weight or not.

Similar projects worth following
First I would like to say this projects goal is to verify if it is feasible with simple, cheap components, without advanced mobile spectrometry devices. Also I would like to realize a kind of dream I have for some time, I believe being on diet is easy, what is difficult is taking care of all the kcal counting et cetera, the dream is to make a machine do that for us.

This device is going to use light absorbance measurement, the same principle as pulse-oximetery or pulse-glucometry. The measurement will be done on a radial artery so that it would be possible to implement the device in the form of a bracelet.

The ADT device will also take measurements of body hydration and inform the user when he needs to drink more water.

The different stages of a project combine different technical problems. I already completed some of them, but I'm limited to 1000 chars here so....


The stages of the project:

* Prepare detailed urine body hydration chart for Machine Learning. [done]

* Build urine colour detection device. [done]

* Perform a machine learning to predict body hydration from urine colour. [done]

* Perform basic absorption measurements using RGB and Ir LEDs and TSL235R converter. [done]

* Write a Python script that computes average colour from a photo of urine sample. [done]

* Building a attachable device that measures single point in 4 dimensional (4 colours) learning space. [in progress]

* Measure at least 40 points with urine colours and glucosis, try to fit the data.

The next stages depend if there will be any algorithm that is able to predict body hydration, let's suppose it will work, then next steps would be probably:

* Implement pulse-oximetry (for energy outcome computation).

* Build smaller device, based on SMD components that would be comfortable to wear in constant.

* Try to learn the energy balance with a substitution that 70% of kcal come from carbohydrates and 30% from fatty acids.

* Try to predict the blood saturation in triglicerides using either long term observation or direct calibration with blood analysis.

* Try to reproduce the similar results on other individuals, perform calibration for other users.

In general: glucosis and triglicerydes levels would represent energy income and oxygen blood saturation would represent energy outcome.

  • 1 × TSL235R Optoelectronic Converters / Light-to-Voltage (LTV)
  • 1 × Arduino UNO
  • 1 × RGB LED
  • 1 × Ir LED

  • Mystery of Green and Blue light

    Marek08/24/2014 at 19:12 0 comments

    I know the title sounds really mysterious, but just have a look at the gathered data.

    (Date Time R_max R_min G_max G_min B_max B_min Ir_max Ir_min)

    2014/8/23 0:39:55 55 49 1 0 1 0 25 22

    2014/8/23 0:59:1 84 73 2 1 1 0 47 41

    2014/8/23 9:7:35 97 87 3 1 2 1 53 47

    2014/8/23 9:21:30 105 94 3 2 2 1 48 42

    2014/8/23 9:49:25 90 80 2 1 45 0 48 43

    2014/8/23 10:0:20 94 84 4 2 2 0 50 44

    2014/8/23 10:18:2 4294937202 1601 500 445 226 204 2 1

    2014/8/23 10:30:3 89 79 3 2 2 1 47 42

    2014/8/23 10:48:44 96 85 4 3 3 2 48 43

    2014/8/23 11:5:2 104 93 5 4 3 2 49 44

    2014/8/23 11:7:8 79 70 3 2 2 1 40 35

    2014/8/24 12:39:49 103 93 3 2 1 0 45 40

    2014/8/24 13:20:11 0 0 0 0 0 0 0 0

    2014/8/24 19:14:54 91 80 2 1 1 0 45 39  

    Red and Ir seem to be correct, they behave normally. The points where values are very high (ex. 2014/08/23 10:18:2) are points where I have moved the device and let incident light in, in other words, the data is contaminated with external light, like daylight for exampl.

    Points where value is very low are probably cause by something blocking light emission from the sensor, maybe I forgot to move my sleeve or maybe I had something on my hand right below TSL235R converter.

    I can see the blue and green light blinking from the device, so I can exclude possible explonation that what is measured are tiny amount of incident light transmited through the skin.

    I will print out the sources and have them checked one more time, it must be something simple, like not resetting the value of a variable or something similar.

    Since I'm cutting my fingers to measure glucosis levels I decided to buy something more practical then simple alcohol (for disinfection). It was expensive but much more practical, you can see it on the picture above.

    I abandoned making home urine color tests with my homebuild device. It takes too much time and is not very comfortable. I'm not someone who likes having much contact with urine :P. So I decided to try to find some test strip that are capable of veryfind urine specific gravity parameter, which can be related to body hydration.

    If anyone has an idea how to explain the blue and green light phenomena, let me know in the comments.

  • Data gathering started

    Marek08/23/2014 at 07:20 0 comments

    Yesterday before sleep I replace LD271 IR LED and this morning oficially started data gathering.

    On the pic you can see my morning glucosis test. Unfortunately the hour is wrong, need to fix it.

    What I found strange is the variation of measurements in Green and Blue wavelengths. Have a look:

    (Date Time R_max R_min G_max G_min B_max B_min Ir_max Ir_min)

    2014/8/22 20:28:15 422 378 112 93 112 100 0 0

    2014/8/22 20:38:57 402 362 93 77 93 83 1 0

    2014/8/22 20:49:39 421 380 97 83 96 86 1 0

    2014/8/22 21:0:13 436 393 106 90 105 95 1 0

    2014/8/22 21:10:43 382 345 86 72 86 77 1 0

    After replacement of LD271:

    2014/8/23 0:39:55 55 49 1 0 1 0 25 22

    2014/8/23 0:59:1 84 73 2 1 1 0 47 41

    2014/8/23 9:7:35 97 87 3 1 2 1 53 47  

    Small variation of Ir light was normal because LD271 was broken and needed replacement, but why suddenly we have very poor variation of Green and Blue? I'm pretty sure they work since they are visible on the device. Maybe it's not a defect?? Maybe we just found something that variates that much and can indicate something, for example very low body hydration?

    I will examine this phenomena and I will keep you informed.

  • Data gathering device assembled

    Marek08/22/2014 at 16:26 0 comments

    Finally assembled!

    I have measured few data points, except for infrared light which gives pretty weird results (low range) it seems to be fine. Probably infrared LED does not respond (it's not that obvious since my eyes cannot see in infrared spectrum).

    It is powered by 9V battery, each time we power the device it registers single data point on the SD card.

    It also is very comfortable, it fits my hand perfectly.

    When I will solve the issue with infrared I will start gathering data points for machine learning as soon as possible.

  • Data gathering device progress

    Marek08/20/2014 at 09:34 0 comments

    It's been a while I haven't written anything here, but don't worry, I was working hard.

    The electronics part is practically ready, the mechanics part won't be difficult.

    The strangely looking thing at the top is plasticine form which will held the optical sensor components such as light to frequency converter and light emitting diodes.

    Each time the device is powered it emits light of four colours one after another. It probes the light intensity with exposure time of 10ms, for each color it takes 200 measurements, so it gives approximately 2s per color.

    With each measurements it looks for minimum and maximum light intensity values, which will be later used to compute light absorption using Beer-Lambert law (the minimum value will correspond to the moment where the least amount of blood is present in the artery).

    The minimum intensity would be incident radiation and maximum would be transmitted radiation.

    With each measurements the device adds one line in the text file present on the SD cards.

    I am hoping to start gathering the data this week, I will keep you informed with each progress.

  • Mr. Glucometer finally arrives!

    Marek08/05/2014 at 08:05 0 comments

    Haven't been very active lately, it's because I travelled 1600km to Poland (homeland yohooo) and recently I've been pretty busy, but there is one progress, I finally got a glucometer.

    Tonight I'm going to Warsaw, it will be about 500km, there my summer lab awaits me, I will be experimenting with new sensors, I also promise to write a log entry describing my homemade urine color test machine.

    There is one more thing I would like to share with you, right before starting my journey I discovered Soylent ( http://www.soylent.me/ )

    , it looks like perfect solution for blood lipids prediction without proper equipment.

    If anyone has ideas, I'm open to suggestions. Cheers!

  • Rapid Prototyping Ideas

    Marek07/28/2014 at 13:11 0 comments

    Since I already build one sensor with hot glue form and it was  half failure now I'm willing to do it better. Since TSL235R are hard to get here I need to ship them from US each time. I have few more, but I cannot let myself experiment with many ideas because I will quickly run out of them.

    My first idea is using plasticine form (simple to use, easy to get and cheap) and then fill it with some kind of moldable polymer or resin. Then remove plasticine and cut parts that stand off. The advantage here is that plasticine will ensure me the parts will stay in right position (this was the problem with last sensor, part moved right after hot glue filling).

    My other idea was to use two separate PCB, first one (A board) with TSL235R and seconds one (B board) with LEDs.

    Then connect them under right angle.

    This would require some kind of filling anyway or at least something to isolate external light.

  • What do beer and urine have in common?

    Marek07/25/2014 at 22:43 0 comments

    Color of course!

    Some time ago I was looking for a efficient and simple way to measure body hydration. Basicly it always limits to study either sweat or urine. I haven't been considering sweat study, since it seems to be rather good for sport solutions, where skin is wet for most of time. 

    If we're speaking about urine, it's either refractometry (pretty accurate but complicated and needs some equipment) or study of the color (less accurate but rather simple).

    I decided to go on urine color study, but then I realized, all the urine color charts I found on the internet limited to approximately 7 points, it's not much for Machine Learning or any accurate study... Here's an example.

    I started to think about how could I extend the dataset. At the moment I was pretty much interested in brewery and I was watching a Polish youtube channel of a guy who speaks quite a lot about beer.

    Turns out, at the brewing competitions judges use a predefined scale (called Standard Reference Method or SRM) which is quite developped in number of data entries.

    Just admit that it really seems like urine color chart points are included in SRM points data set.

    Since we are speaking of colors, we can look at each entry as a point in three dimensional spaces (coordinates R, G and B).

    They seemed similar, but it needs to be proved, so I written a simple Python script that uses Python Imaging Library. I extracted points from SRM chart and computed the euclidean distance between each of those points and points of urine color chart. This way I found 6 most similar (in terms of distance) points and computed even distance between consecutive points to compare if distribution is more or less similar.

    The result was that for urine scale (1,2,3,4,5,6,7) equivalent indexes in SRM scale are (1,13,31,70,138,165,205).

    The distances between each of those points are the following:

    dist(urine(0), srm(1)) = 18.9208879284

    dist(urine(1), srm(13)) = 2.2360679775

    dist(urine(2), srm(31)) = 2.2360679775

    dist(urine(3), srm(70)) = 5.09901951359

    dist(urine(4), srm(138)) = 18.7082869339

    dist(urine(5), srm(165)) = 21.6794833887

    dist(urine(6), srm(205)) = 31.8119474412

    Where urine(x) gives [r,g,b] values of color x in urine chart and similar for srm(x) that provides equivalent in SRM scale.

    We can deduce that it is pretty accurate. We need to remember that RGB values are in range of one byte (0 - 255) and in worst case we have a difference of ~31, in my opinion for simple solution like this it is not that bad. For some points the accuracy is extremely good, like 1-13, 2-31, 3-70...

    Now lets study the relations (Euclidean distances) between consecutive colors in each chart. For urine color chart I found:

    (56.0, 42.0, 99.2673158698, 36.7423461417, 41.3158565202, 36.2491379208)

    And in SRM chart the differences between consecutive points we found are:

    (38.170669368, 43.0116263352, 99.0201999594, 40.0249921924, 27.2946881279, 31.874754901)

    Those values look really related. The best way to explain it is using the example. In approximation the distance between Fair and Dehydrated in urine scale equals 99.2673158698, in case of related points in SRM scale we find 99.0201999594, so in both cases will be ~99, which means the ratio is really similar.

    I hope you found this interresting. I will keep posting project news, stay tuned!

    Cheers!

  • Looking for a sensor assemble solution

    Marek07/24/2014 at 21:57 0 comments

    The current sensor board is build in the following way: TSL235R light to frequency converter, RGB and IR leds are sunk in hotglue. I know it's not the good way (it's extremely uncomfortable as you can imagine)... But I needed a quick solution because I was curious what will it give as result.

    The sensor is pretty big itself, it's because it is based on through-hole technology elements (let's say it's not easy to buy SMD components where I live). On the beginning I wanted to solder them on a custom made board, but following image will explain right away why I didn't, just look at the thickness of that thing...

    Even knowing it's not very pretty and certainly not comfortable, it gave some pretty interresting results. For example I was trying to verify if I can detect if the sensor is attached to the skin or if user moved it letting incident light come in. Just have a look at the following figure:

    Approximately at the 150 iteration hotglue sensor was in the peak of not being attached to the skin, we can see how light converges into single point that represent natural day white light.

    That would be all. It's not very recent study, but the problem of building a better sensor is still essential. I'm looking for an easy and cheap way to connect LEDs and TSL235R together the way it would be light proof and comfortable, any ideas are welcome.

    Cheers!

View all 8 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates