Sunday, May 2, 2010

bluetooth wireless bathroom scale with fatsecret integration

Not exactly a keyboard, but I'd argue that a datalogging scale is an imput device... In any case, this is a project I did a while ago (~2 years ago). Start with a cheap bathroom scale from ikea, then strip out all the hardware except for the load cells. Add in the following:

microcontroller (AT90USB162)
roving networks bluetooth serial module

24 bit ADC (AD7799)

4 AA batteries +linear regulator (don't want switching noise here)+ input ORing diodes to allow powering from batteries or USB without damaging either (handy during development)

After assembling the above hardware, the microcontroller code was fairly straightforward- when a user taps a corner of the scale I take repeated ADC readings until the "running STD" (STD of last N measurements) drops below a certain threshold. At this point the scale will have a stable zero point to normalize the subsequent weighing. When the user stands on the scale I do the same thing- take ADC readings till STD< threshold. I chose the threshold such that the delay before convergence was short, at the expense of some accuracy. Left to run long enough the scale was able to detect the difference between my bodyweight and my bodyweight plus one US quarter. With the current threshold the scale appears to be repeatably accurate to within 0.1 lbs which for my purposes is acceptable. I was actually pretty happy to get that level of performance considering I didn't lay out a board for the ADC and just used a schmartboard instead.

One other metric I was happy about is the battery life - approximately > 9 months when used once or twice a day. I coded things such that the microcontroller is in a deep sleep until the user touches a corner of the scale. I could have taken a hardware approach and actually disconnected the uC power with a transistor until the user touched the scale, thus arming a delay circuit, but the software approach yielded more than acceptable results. The uC current draw is in the microamp range when sleeping and I use transistors to disconnect power from the bluetooth module and ADC while sleeping so I probably shouldn't have been surprised.
I think for a future revision of this project I'll actually spin my own main board. This would allow for a much more compact footprint and allow me to power from a smaller 3.3V source instead of the stack of 4 AAs. This latter arrangement was needed to avoid extensive rework of the olimex board where certain bits of hardware expect 5V.

On the PC side of this project I'm using bluez rfcomm server to listen for inbound serial connections and then run some other code when a connection is established. That other code consists of python scripts that insert the current reading in a sqlite database (which is then visible from my ruby-on-rails site) and submits the reading to fatsecret via its API. This data submission is done using OAuth, so the whole process requires no human intervention and I avoid any ugly hacks involving plaintext saved passwords.

Fatsecret is great because:
(1) it has an API
(2) it has an android version
(3) it can scan barcodes to fetch associated calories and nutritional content
Here's a screenshot from my phone showing a graph of weight readings for the last few months.

One final aspect of the scale which I find interesting is the means by which the user interacts with it. I intentionally made it so that scale does not have an LCD to show the current weight reading. Day to day fluctuations are not reflective of what really matters- long term trends. Usage of the scale thus boils down to the following:
(1) User taps lower corner of scale to initiate auto-zero sequence
(2) The scale turns on its sole LED to indicate that the zero process is ongoing
(3) The scale switches its status LED from solid red to blinking to indicate the zero process is complete.
(4) User stands on scale until LED turns off, indicating the reading has stabilized.
(5) User reviews cumulative weighing data at some later time (either via phone, or at their PC)

For fun, I added an additional means of relaying data to the user- spoken weights. By feeding the stabilized weight reading to festival (text to speech engine), the scale can "announce" the most recent weighing.


  1. That Looks Awesome

  2. This looks very convenient, would you be willing to share some of the code files?

  3. Wow!

    This is by far the best approach that I have seen.

    Have you considered a consumer-ready version? This could be a very hot item.

  4. Hello!

    Could you please share more details about the wiring/circuit of the ADC <-> load cells?

    I also did the same as you but I went to get the data from the LCD pins of the scale. I shared the firmware and Android software here:

    Thank you.

  5. Very interesting blog. Really nice work, thanks for sharing your thoughts.
    Load Cell Manufacturers in India | Load Cell Supplier in India

  6. Hi to all, the blog has really the dreadful information I really enjoyed a lot.
    Compression Load Cell | Shear Beam Load Cell

  7. Start with a cheap bathroom scale from ikea, then strip out all the hardware except for the load cells. Add in the following:speech recognition software

  8. Hi dear, I like your post so much, and it is very good. Hope that we can communicate with each other. I want to introduce an aso services, I try it and I feel it is so good to us beginners.

  9. If you find that your Bluetooth devices are not working properly, the device drivers probably need to be updated.check out

  10. Hey, my dear friends, if you are hunting for a wild look Michael Kors Handbags Outlet at a reasonable price; you really should not miss this Michael Kors Handbags On Sale. It is truly a qualifying item. (tags: Michael Kors Outlet Online,Michael Kors Sale,Michael Kors Outlet)
    It posted by Michael Kors Outlet Store.


  11. "One night I was calling to a friend's house, but they had another pal staying [points to Ruth]. She said 'go outside Longchamp Soldes Destockage and make sure Eamonn knows where my apartment is'."So she sent out this leggy blonde slim in those days and it was Ruth. I just went 'wow'."Clearly feeling appreciated, she added: "And here we still are 22 years later".Not that this is the first time they've discussed their relationship, of course.In an interview with the Daily Cheap Oakley Sunglasses Mail, Ruth once revealed that they initially had to keep their love a secret.She said their relationship was "slow to start" and very private, because Eamonn had recently split from his first wife, Gabrielle, and thought it would be insensitive to hold hands in public and Ray Ban Sale UK parade their love at events.But, rather than be offended by being Bolsos Michael Kors Baratos kept a secret, Ruth said it only made her love Eamonn even more.She said: "I thought it spoke volumes about the sort of man he was, the sort of father he was and the integrity he had.

  12. What is the impact of termites on human health Best anti-termite company in Dammam?

    A company that fights white termites causes many diseases to humans includingشركة مكافحة حشرات بحائل
    شركة رش مبيدات بحائل
    شركة الانوار لمكافحة الحشرات
    شركة رش مبيدات بسكاكا

  13. Coach Handbags Outlet are usually viewed as luxurious brands, but yet at inexpensive price.
    Today most people looking for COACH accessories will look for them at Coach Bags Factory Outlet.
    Coach Sale are just the most inexpensive items to purchase through Coach Purses Outlet, a small change purse or Cheap Coach Purses.
    Coach Bags On Sale are a fun accessory to add to a new collection.
    Coach Bags Outlet is can be carried or slipped over your shoulder.
    Authentic MK Outlet are made of high grade quality leather and Michael Kors Factory Outlet can actually have real leather on them.
    Michael Kors Purse Sale usually come with a plate bearing the MK Outlet logo to distinguish it from other Cheap Michael Kors Purses.
    Michael Kors Outlet Online have the inherent ability to capture the essence of what women like and what they want to wear and utilize.
    Michael Kors Outlet Store are a symbol of feminine elements and speak for all kinds of women.
    Michael Kors Purses On Sale of the day vary greatly, but all seem to share one characteristic, they are popular!

  14. Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.

    Friendly Links: Toms Shoes Womens | Toms Clearance

  15. minuman penyegar seperti bentrap original cod di tambun utara sekarang ini banyak digemari oleh pria untuk memelihara stamina agar tetap perkasa saat berhubungan badan. produk bentrap asli cod karawang ini banyak diminati karena sudah memiliki sertifikat halal yang keabsahan bisa anda yakini 100% dapat memberi manfaat bagi pria yang ingin mendapatkan klimaks saat berhubungan badan. bentrap asli cod bandung dikemas dalam bentuk serbuk dengan aturan pakai seperti minuman yang mudah dikonsumsi bagi siapapun tanpa pengecualian sekalipun bagi pria yang menderita penyakit seperti diabetes. viagra asli dapat diterima oleh semua kalangan dan hasilnya juga sangat memuaskan bagi setiap pasangan yang ingin menjaga keromantisan dalam bercinta agar selalu optimal setiap libido memuncak. wanita bisa merasakan kebosanan kalau pasangannya tidak dapat memberikan kepuasan seksual saat diranjang, untuk itu anda sebagai pria harus mencari solusi dengan cara mengonsumsi permen soloco cod di tembalang sebagai obat untuk meningkatkan libdo serta membuat ereksi lebih keras dan tahan lama. klik seterusnya .