Introduction: Balance, Smart Weight Scale
Hi! Today I'll try and show you how to make a smart weight scale from scratch!
Step 1: Components
The components you'll need:
- A 'Wii Balance Board'
- A Raspberry Pi 3, provided with Bluetooth (Or an earlier version of RPi, included with a Bluetooth Dongle)
- A 16x2 LCD Screen
- Some all around jumper wires (Pref. Female-Female, but take some normal wires aswell)
For the wooden frame I used 6 wooden parts (see image for details length wooden parts.) The wooden bar/log I used has a width and height of 4,5 cm, and a length of 140 cm (you should have at least 2 of these bars.).
I also used a wooden board underneath (67x47cm).
Extra things you'll need:
- Saw (doesn't matter which one, just use one you're familiar with)
- Wood glue
- a cardboard/wooden box with a width of 16 cm (IMPORTANT: Your RPi and display will be in here, so make sure it has a good height & the ability for your screen to fit in.)
*Extra things you can still add:
- Led strips at the inside of the frame
- Paint / color to the wood &/or board
- I'll probably upgrade this project next month or something, I will update this project with ultrasonic sensors so you can know which foot is on the board or not.
Step 2: Hardware
Now you wanna make sure your RPi is connected correctly to your LCD. You don't need the potentiometer, you might as well let it connect to 5V/GND, but it's better if u want to control the contrast manually.
You also see the logic board of the Wii Balance Board, just to give u an idea on how it works.
- Solder 5V & GND to battery logic board, this way you won't need batteries anymore!
Step 3: Setting Up RPi
Setting up RPi:
- Network configurations, make sure u can connect to wi-fi. APIPA in bootconfig -> config wlan via putty -> enable bluetooth in raspi-config
- Make a folder on your RPi (in this example, I made a folder 'Project' located in /home/pi.
Step 4: Control Your Sensors
Now that the hardware is done, let's start coding the components. For the LCD, we're using the adafruit LCD file as basefile. In the LCD.py file, you can display the wlan IP of your RPi on the display. Occasionally you can display your weight.
Step 5: Database
Step 1: create a database with 3 tables, User, Weight, Target
Step 2: within these tables you create collumns:
- User : Username, password, length, age, firstname, lastname, sex
- Weight: WeightID(ai), Weight, MeasuredMoment, user_username(fk)
- Target: Targetid, targetweight, targetmadedate, targetdate, targetreached, description, user_usernam
Install this in mariaDB on rpi, make sure u give all rights to all the created users.
Step 6: Website With Flask
You can get the complete web folder from here: https://github.com/LorenzoVerheecke1NMCT4/web
you will have to make sure the templates are in a template folder (check as template folder!), make sure the hrefs are O K with the corresponding urls.