The Sweets Box

An arduino controlled box, that stop me from eating to many sweets...

This article is Work-In-Progress

The Sweets Box

This article will be in english because it is supposed to sort of be the documentation for the box.

A few weeks ago, I got the idea for a box that limits the amount of sweets you could take per day, mainly because i needed a new project and also wanted to try out using load cells with arduinos.




Working Principle

The box is supposed to be sort of user friendly. You navigate the menu using two buttons, up, down, and both for enter. On the first boot you may need to calibrate the scale using a known 500g weight and set the RTC to the current time. After that you can set the maximum limit per day and a few other things like turning on and off the buzzer. Then you fill up the box with your favorite sweets, run the tare option, and you are ready to go.

Now that everything is set up, you can use it as normal. Just take out some sweets whenever you want to, but be warned, if you take more than the maximum allowed per day, the box will scream at you until you either put enough back, or close the lid. If you closed the lid after taking out too much, it will lock the lid with its servo and won't open until the next day when it resets.

It's not really secure. There are many ways to trick it and thats OK. It's not supposed to be super secure, just enough of an annoyance that you reconsider taking something out.


Hardware

A labeled image showing off the main hardware features
A labeled image showing off the arduino components
A labeled image showing off the loadcell and stuff between the wood
A labeled image showing off the loadcell and stuff between the wood
A labeled image showing off the backside
The schematic of the device

Overview

The biggest part of the device is the pink (blue was out at the store so i went with pink. its a nice color too) plastic container wich contains all your sweets while preventing them from drying out or getting too wet.
The device is powerd by a male USB A plug wich is way to short. The current status is shown on the dual-color LED that is hotglued onto the side of the pink container.
Green means you are good, Orange means the device is booting or about to lock, Red means you took your maximum allowed sweets per Day and thus the box has locked via the Servo attached on top of the lid (its missing the little plastic horn at the moment so i drew one).
The Device knows if the lid is open via the Digital Hall Effect Sensor (glowing red in the picture) wich detects a shard of an old harddrive RW-arm magnet that is glued to one of the flaps using hotglue.
Everything is controlled via the HD44780 powered display in the front, wich sits a bit too upright to be readable from far above but i could not get it angled more due to limited space, and the two little buttons next to it.

Arduino Parts

The arduino is kind of squshed in at the front together with a display and an RTC. The RTC keeps the time wich allows the device to automatically reset on 4 a clock AM.

Loadcell

The loadcell is what takes the weight measurements. It works by having for resistors wich form a Wheatstone-Bridge, but thoseresistors change resistance based on microscopic streching that occurs from the weight deforming the metal bar juuust a little bit.
The slightly varying voltage then gets read in by the HX711 load cell amplifier chip and Read out by the arduino.

Speaker

The annoying sound maker. A random small speaker connected via a volume lowering resistor to an ""amplifier"" made of a single NPN transistor with an added diode for voltage spike protection.

Backside

Finally: The janky hinge that I made by gluing down one of the lid flaps with hotglue.

Circut

The circut is pretty simple. All sensors etc. just get connected directly to the Arduino without any port expanders or so.


Software

You can view and download the code over at github: github.com/HACKER-3000/sweets_box/

How to use

The Menu is pretty easy to use (I think). You have two buttons: up(BTN1) and down(BTN2). To enter a menu, confirm a setting, etc, you just press both at the same time.

Main Screens

Weight

Took 10g/100g


Weight: 200.3g

The default screen shows how much you have taken, how much you can at most take per day, and how much is in the box total.

Clock

20:34:58


20.02.2023

The clock is a slightly buggy clock.

Menu Tree

How to read the spaghetti code