This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Weighing Scale

I am an engineering student, i want to design a digital kitchen weighing scale with calories Calculator, as my mini project.

main components:
load cell sensor(5kg, resolution 2g)
8051
12-bit ADC
3x4 matrix keypad

Here is my questions
Can you give me example on how to write the program, so that when the user entered the foodcode through keypad, the calories values will be retrieved and used for the calories calculations.
each food code has an equivalent calories values.

Foodcode Calories values 01 63
02 10
03 70
04 68

an example is shown below.

number entered from keypad [03] is == to foodcode(03) with cal value of 70.

I only need the calories value for my calculations

the calories are calculated by multiplying the weight of the food with its calories values

Cals = weight of the foodcode * calorie value

i got a table with list of foods and their calorie values example

Thank you very much for your help

Parents
  • You just write a standard keypad read function - covered on this site and all over the net. Just make sure it has a reasonably good key debounce.

    You write code that uses above keypad read function - but you need to decide if there should be an enter button, or how to handle that a user presses a single button (maybe accidentally) and then several hours laters uses this device to entery two (?) digits for a food item.

    Anyway - when you have figured out of the input code will know which digits forms one entry.

    If you have a lookup table for food codes, it is trivial to locate the entry.Either the food code is the index, in which case you just check if the food code value is within range. Or the food codes are not a continuous sequence 0 .. x, in which case the table needs to store both code and weight - so you need to scan the table. Or make it more advanced and have the table sorted in which case you can do a binary search.

    No issues with weight either - you need calibration - offset + multiplicative scale.

    Then it's just a question of converting the result to individual digits to display.

    All in all - lots of trivial sub-blocks to implement and integrate with each other. Where are you stuck?

Reply
  • You just write a standard keypad read function - covered on this site and all over the net. Just make sure it has a reasonably good key debounce.

    You write code that uses above keypad read function - but you need to decide if there should be an enter button, or how to handle that a user presses a single button (maybe accidentally) and then several hours laters uses this device to entery two (?) digits for a food item.

    Anyway - when you have figured out of the input code will know which digits forms one entry.

    If you have a lookup table for food codes, it is trivial to locate the entry.Either the food code is the index, in which case you just check if the food code value is within range. Or the food codes are not a continuous sequence 0 .. x, in which case the table needs to store both code and weight - so you need to scan the table. Or make it more advanced and have the table sorted in which case you can do a binary search.

    No issues with weight either - you need calibration - offset + multiplicative scale.

    Then it's just a question of converting the result to individual digits to display.

    All in all - lots of trivial sub-blocks to implement and integrate with each other. Where are you stuck?

Children
No data