close-circle
Close
0%
0%

DIY Body Scale

Fixing a broken scale with DIY hardware

Similar projects worth following
close
Fitting a defective Body scale with new life(/hardware). The whole software for the Processor should fit into 1024Byte.

The meassurement of the Load cells inside the body scale is performed through a HX711 ADC/PGA module from Aliexpress. It is capable to directly output 24Bit of the actual value.

To display the value there is a HD44780 display. I fitted the display in a custom designed and 3D printed bracket to match the old window in the scale.

Those components on their own can't do anything useful. To put them "together" I use a Atmega8 microcontroller. Even this old and simple microcontroller has 8kByte of inbuilt program memory. But this is the 1kByte challenge! So I have to be really careful and just use what I really need to finally get to only 1kByte.

To power this whole thing with Batteries like the original one I will use the sleep mode of the Atmega and HX711. For the HD44780 display I have to search a solution.

diy_scale.png

Concept of the project

Portable Network Graphics (PNG) - 139.11 kB - 11/23/2016 at 14:52

eye
Preview
download-circle
Download

  • 1 × Atmega 8 DIP
  • 1 × HX711 module Aliexpress
  • 1 × Protoype board generic
  • 1 × HD44780 HD44780 KS0066 clone
  • 1 × wires

  • Implementing sleep mode

    Benjamin11/24/2016 at 22:08 0 comments

    Today I implemented the basic sleep mode of the Atmega8. My basic idea was to periodicly sample the ADC do check if someone stands on the scale. If yes, turn the whole system on and do a "serious" meassurement.

    I got it running fine but the current draw is not really at a point where it should be. Currently the whole circuit uses 22mA in running state and 20mA in sleep mode. With a adoption that the AAA Batteries have 600mAh this circuit would only last >30h!

    I think the biggest current draw comes from the rather stupid HD44780 display. The next step is to put a Transistor in between to completly cut the power supply of the HD44780 display in standby.

    https://kilobyte.ch/scale_sleep.mp4

  • 32.768kHz Crystal

    Benjamin11/23/2016 at 16:27 0 comments

    The Atmega 8 can't do an interrupt through the WDT module. It only can do a direct reset of the whole CPU. So this way to wake up the CPU from the sleep isn't practicable. Another way is to run the timer with an external clock in the sleep mode and generate an interrupt through this. I use a 32.768kHz crystal for this job.

    Activated the Asynchronous mode of Timer2

    ASSR |= (1<<AS2);
    TCNT2 = 0x00;
    OCR2 = 32;
    TCCR2 = (1<<CS20);

    And it seems to work!

  • 1kB Software optimization

    Benjamin11/23/2016 at 15:01 0 comments

    For the Hackaday 1kB Project I had to optimize the software quite a bit. The "original" test software to test all together had the size of 2.2kB. Not bad (the Atmega8 has 8kB in total) but not good enough for the 1kB Project.

    With some general optimizations I got 2.17kB. Still way to heavy. I've used theconvenient "sprintf" function to generate aString consisting of a static string and a long number for displaying on the display. A big error as I now discover. I changed it to a combination of using the display memory and the "iota" function and came to 850Byte! Perfect!

View all 3 project logs

Enjoy this project?

Share

Discussions

Dmitry Grinberg wrote 11/27/2016 at 00:02 point

HD44780 is banned as per rules as it has its own rom (for character shapes) and it is over 1K

  Are you sure? yes | no

Benjamin wrote 11/27/2016 at 00:10 point

Already thought about that but didn't get a reply on the 1kB Project. Propably will change the display to a 7segment display with direct drive with the Atmega...

  Are you sure? yes | no

elvador wrote 11/24/2016 at 13:31 point

Do you use Arduino IDE?

  Are you sure? yes | no

Benjamin wrote 11/24/2016 at 22:18 point

no, avr gcc

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates