My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 09, 2009 by casainho
Labels: Featured
SdCardBathroomScale  
Digital bathroom scale which logs weight and data on SD Card

Introduction

On this project I hacked a digital bathroom scale, for write (log) my weight variations over time, on a memory SD Card. I write the information (time date + weight) on a comma separated values (.CSV) file so I can quickly build a graph using OpenOffice, Gnuplot or some other capable program.

If anyone want to build a scale like this one, I can help, my e-mail is: casainho@gmail.com. I can also build a personalized system, please contact me for price and details. I would like to see this project grow, I would like to be able to buy on the market an Open Hardware and Open Source scale like this one - please contact me if you ave any ideas.

Here is a picture of me using the scale:

Click on the next image to see a video that shows the scale working:

Here is a picture of a graph made using OpenOffice (my own weight log):

And here is a picture of a graph made using Gnuplot (my own weight log):

Firmware source code, schematics sources, pictures of current work, Gnuplot scripts, can be found on SVN.

Media coverage

Observations and things to improve

The system works perfectly. Although there are some things I would like to improve:

Ideas for a future version

I would like to have the bathroom scale sending by wireless the weight values. On a display console (running embedded GNU/linux) attached to bathroom wall, the wireless signal would be received and a graph would be shown to user with the last values of the last 2 weeks - on this way the user can have a clear picture of his weight progression.

The display console would also be able to store the time date and weight values on a memory SD Card or any other media.

The display console could also have a way to identify different users, maybe by using a biometric finger print (USB mouser with fingerprint ?).

Technical details -- Scale Fagor BB-90

The original cheap scale I bought on market

I bought the cheapest digital bathroom scale I could found on market, it were 20€, Fagor model BB-90. Other scales just looks the same, because they have the same number of LCD digits and the system appears to behave in the same way.

Picture:

How to get the weight value

First I thought that I could read the sensors and got an analog voltage relative to weight but I couldn't find a way to do it. Next a friend at work give me the idea to try read the signals that went to original LCD, and it was a simple and easy way to have what I need :-)

The original LCD have 15 pins, 3 backplanes and 12 segments. I did understand how the LCD signals works reading this application note.

The segments signals have voltage that can be read directly by the LPC2103. The backplanes signals can't be ready directly by the LPC2103 (I think) and then I made a very simple voltage detector using a LM258 opamp so I get a "trigger" signal every time the backplane signal get near is maximum value. Since all the signals are sequential and have the same period of time, I just look for one backplane signal (just one voltage detector circuit with the LM258 opamp).

The next 2 pictures shows a backplane signal and 2 segments signals.

The next picture shows a backplane signal and a "trigger" signal I got using an LM258 opamp working as a comparator, like a signal value detector.

Understanding the logic of each signal

After I saw on oscilloscope each signal that went to the original LCD, I quickly understand that 3 were backplanes and 12 were segments, because backplanes have always the same shape while the others varies with the segments on/off, with the weight value.

I had to understand which segments were turned on/off to represent each number on the original LCD, and not having the original LCD working any more, I had to make some tests to figure the information I were looking for.

I decided to write on LCD module HD44780 the state of each segment (synchronized with each backplane signal) and then try a few different known weight, so I had a known digits:

             0.0 kg

          backplane a:   0 0 0 . 0 0 0 . 0 1 1 . 0 1 1

          backplane b:   0 0 0 . 0 0 0 . 1 0 1 . 1 0 1

          backplane c:   0 0 0 . 1 0 0 . 0 1 1 . 1 1 1

--------------------------------------------------

             1xx.x kg

          backplane a:   0 0 1 . x x x . x x x . x x x
                                               
          backplane b:   0 0 1 . x x x . x x x . x x x

          backplane c:   0 0 0 . x x x . x x x . x x x

--------------------------------------------------

             2x.x kg

          backplane a:   0 0 0 . 0 1 1 . x x x . x x x

          backplane b:   0 0 0 . 0 1 0 . x x x . x x x

          backplane c:   0 0 0 . 1 1 1 . x x x . x x x

--------------------------------------------------

             6x.x kg

          backplane a:   0 0 0 . 0 1 0 . x x x . x x x

          backplane b:   0 0 0 . 1 1 1 . x x x . x x x

          backplane c:   0 0 0 . 1 1 1 . x x x . x x x

After reading about 7 segments displays on wikipedia, turned out in my head that the segments are:

               a          y a b   <-- backplane a
             f   b        f g c   <-- backplane b
               g          z e d   <-- backplane c
             e   c
               d

Example of number 6, all segments turned on except segment b.:

             6x.x kg

          backplane a:   0 0 0 . 0 1 0 . x x x . x x x

          backplane b:   0 0 0 . 1 1 1 . x x x . x x x

          backplane c:   0 0 0 . 1 1 1 . x x x . x x x
                  
               a          y a b   <-- backplane a
             f   b        f g c   <-- backplane b
               g          z e d   <-- backplane c
             e   c
               d

Schematic

Selection of microcontroller

Arduino/Atmel AVR, or ARM? - I really like Arduino, mainly because it's Open Hardware/Firmware and there is a lot of Open Hardware modules for it. I prefer to use ARM instead of Arduino/AVR because I have the same Free Software tools PLUS cheap, Open JTAG debugger! I don't really like the fact that Atmel have a closed, proprietary, debugger.

I am being using ARM7 LPC2103 which is the cheaper on this times and have all the functionalities and working power that I need. I decided to use Olimex dev. board LPC-H2103.

LCD module added

I needed to use another LCD since I couldn't maintain the original one. I decided to try the cheap ones based on HD44780, since I have experience with them and I got some with me. Luckily, this LCD just enters perfect in the place of the original :-)

On the next picture we can see the LCD module and also the connections I made to original PCB using flat cable, on the pads that connected to original LCD.

Schematic

SD Card and FAT library

I decide to use SD Card memory to hold the data because I had good experiences in past with this kind of memory card, using SPI BUS. Also I can find relative cheap cards easily.

My reference page about SD Cards is this one: How to Use MMC/SDC by ChaN.

Schematic

Fat file system library

I use FatFs by ChaN file system drivers which have a Free Software license, are very complete and have good documentation.

Data written to SD Card

Here is some real data recorded on SD Card "weight.csv" file:

12-8-2009 23:48:28,"092,1"
12-8-2009 23:48:55,"092,3"
12-8-2009 23:57:46,"092,4"
12-8-2009 23:58:14,"092,0"
12-8-2009 23:58:40,"092,0"
12-8-2009 23:59:05,"092,0"
12-8-2009 23:59:44,"094,0"
13-8-2009 07:15:57,"091,5"
13-8-2009 07:36:54,"091,5"
13-8-2009 07:37:44,"091,5"
13-8-2009 20:15:02,"092,0"
13-8-2009 20:15:28,"091,9"
13-8-2009 21:22:53,"091,6"

Real Time Clock

Since I want to also register the time date, I need to have a Real Time Clock(RTC). LPC2103 have one RTC and the board I am using, have the RTC working.

Since I need to setup the clock with correct time date and I do not want to add buttons to the system just for doing it. I implemented the following idea: Every time that system boots, if on root of SD Card there is a file called "time.txt", read the time data from it and setup the clock; finally, delete the file. The time.txt file should have a string with the following format (without square brackets):

[year][month][month day][week day][hour][minutes][seconds]
Example: [2009][08][01][6][12][00][00]; string "200908016120000".

I am using 2 X AAA NiMh low discharge batteries to power the RTC, I hope it lasts at least 1 year.

Schematic

Power down the system

After finish the prototype, I verified that the LPC2103 board + LCD module HD44780 were using about 140mA.

I worked to found a way to disable the circuit when the original scale circuits are not working. I verified that when original scale is off, there is no signals to the original LCD. I ended up by using a mosfet that is turned on when there a signal on the backplane 1 line.

I also control that mosfet with a signal from the LPC2103, so the system can keep with power turned on and shut off himself when desired.

Schematic

On the next image, we can see the signals before and after D1 BAS85. Yellow line is at point LCD_pin13 and blue at gate of Q1 BSS138.

Pictures taken on 2009.09.02

Technical details -- Scale Fagor BB-90

I bought another bathroom scale. The model is "Jata Hogar 490", looks like it is from a Spanish company.

Status

Working correctly as on 2009.10.05. Firmware Open Source code is on SVN.

Some pictures from original scale

Technical explanation of the hack

I will just document the differences from the other first bathroom scale I did hack, all the rest is equal.

I am using the ADC on LPC2103 for be able to read and sync with the LCD signals. Since the LPC2103 don't have 13 ADC channels, I used an external analog multiplexer of 16 channels, the 74HC4067 IC.

There is 13 pins that connects on the original LCD. There is 4 backplanes signals, which are the pins 10, 11, 12 and 13. Each other pins holds 4 bits.

Pin 1 holds bit data for kg and lb symbols. Pin 2 and 3 holds bit data for most significant digit of weight value. Pin 8 and 9 holds bit data for least significant (decimal) digit of weight value.

Oscilloscope images from the pins that connects to original LCD

Each one of the following 13 images, shows the signal at each pin, when the scale starts and shows 0.0 kg on LCD. First image shows the signal at line 1 and last image shows the signal at line 13.

The blue line is a signal I used to trigger the oscilloscope. I got that trigger signal as a reference for the first backplane signal (line 10).

Here is the sequence of bits on pin signals and the correspondence to the segments on the LCD:

Pin 1 of 2: degf
Pin 2 of 2: xcba

             a
           f   b
             g
           e   c
             d   x

Examples:
                  degfxcba
Number 0: 11010111
Number 9: 10110111
Number 6: 11110101
Number 2: 11100011
Number 1: 00000110

1st line: 4th bit is on - this is the bit that turns on the "kg" segment.

2nd line: 1st, 2nd and 3rd bits are on, for the "cba" segments of "0" number. 4th bit would be the "." bit that is never turned on.

3rd line: here just the "g" segment is turned off from the "degf" segments of "0" number.

10th line: Backplane 1 signal.

11th line: Backplane 2 signal.

12th line: Backplane 3 signal.

13th line: Backplane 4 signal.

Final pictures

(high resolution version)

(high resolution version)

Now all the electronics inside a black plastic box and glued to the scale:

(high resolution version)

The next pictures were taken at the anniversary of my girlfriend. I did offer as a gift this scale to her, since he wanted to register his weight variations over time because he is pregnant and do not want to get fat.

(high resolution version)

(high resolution version)

(high resolution version)


Comment by mark.duyvesteyn, Aug 16, 2009

looks good! im wanting to do a similar thing, just bought some scales yesterday. Im am going to upload the data directly to a google spreadsheet through using a python script. I am doing this already with my houses energy usage and works quite good, heres my site which displays the information http://sites.google.com/site/19acussen/ , if you more info give me an email at mark.duyvesteyn@gmail.com

Comment by Ookseer, Oct 08, 2009

Excellent work on decoding the signals! I would have given up long before you did.

How about bringing some social networking into your weight loss? The TweetaWatt could be easily adapted to announce to the whole world how much you lost today. (Nothing like a little public shame to motivate you. :) From there you can automate a whole number of data collection and analysis tools, emailing you weekly progress reports, posting monthly updates to your blog or triggering a reward (like purchasing something) when you meet certain weight loss conditions.

Comment by casainho, Oct 08, 2009

Ookseer, your ideas are nice, however I am not motivated right now to do it. On next times I would like to learn using some development board with Linux and one big LCD, to show in real time a graph and let users to zoom in and out the graph - I think is important for users to get a "picture" of weight evolution on say, last 2 weeks, last month, last year.

I am sharing this project in the hope that someone can use it, improve and share again, because I alone can't make all.

Thanks ;-)


Sign in to add a comment
Hosted by Google Code