Building smart WiFi enabled bathroom scale
There are several wireless scales on the market but none of them implements functions I like (or overpriced). This scale logger is attempt to build wireless scale from existing components like Carambola 2 and USB IR Toy and, of course, scale with remote indicator. Implemented purely on Python this project enables gathering, sending and displaying weight data to any service you like or even build one yourself.
This is only framework and final solution is “to be done”. This project is based on Maxim 29-66SH bathroom scale. Data is captured from scale via USB IR Toy.v2 with no invasion to scale itself. Testing was done on regular PC and project can be easily copied to Carambola 2 (install python and couple of libraries, setup connectivity and you are ready to go).
Features I’d like to implement are:
- Auto individual recognition
- Data uploading to database for future analysis
- Weekly/Monthly analysis
- Email/SMS reminder if individual has not weighted for several days
- Means to set and seek goal
bitstream weight status 0111111110000000011111111111111111111111 0 - Syncro (43 packets) 0101010111000000000000011101100011110000 94.5 0 - Measuring 0101010111000010000000011101100111110011 94.7 1 - Measuring 0101010111000110000000011101100111110111 94.7 3 - Weight is stable. Data valid. .............ssddddddddddddddddddccccccc
- Data range is [15:33] encoded as integer data in 100*grams
- Status [13:15].
- At the beginning it looks like packet synchro bits
- At the end looks like 7 bit checksum
Code is hosted on Github. There are several files in the project.
- save_timing.py – reads raw values from USB IR Toy and saves to text file
- analyze.py – analyses txt files saved earlier
- ir_scale_utils.py – data conversion routines
- weight.py – reads data from scale and presents value on the screen.
- app.py – Python tornado server application
- index.html – internal html file tornado serves. (replace websocket ip address inside)
In order to read weight data only few lines of code are necessary:
import ir_scale_utils lines = ir_scale_utils.get_data_serial('COM43') weight = ir_scale_utils.get_real_weight(lines) print 'Your weight is: %3.1f kg' % weight