Introduction: Candy Jar - Watch Your Candies and Know When Sb Eats Them!

Picture of Candy Jar - Watch Your Candies and Know When Sb Eats Them!

Don't eat my candies!

This is the best solution for cookie monsters! We quickly made a smart lid with sensors that watch how many candies are left in the jar, check if the jar is open or not and have a loud buzzer to scare snackers.

Step 1: ​Circuit Diagram

Picture of ​Circuit Diagram

Connect HC-SR04 ultrasonic sensor to the hSens1 port of your CORE2. Connect ESP8266 adapter of course, to make your lid internet connected. Connect also buzzer to any hServo port - we only use it as program controlled power source. Think of how you can put everything in to the lid or print in 3D your customized lid as we did. Then attach CORE2 and microswitch to the lid, so the switch is released when jar is opened. At the and connect power supply. We used 3 rechargeable batteries and attached it with zip ties.

Step 2: Assembly

Picture of Assembly

Simply connect CORE2 with 4x M3 screws and nuts to any jar's lid. We prepared our unique, 3D printed lid.

Then try to put any sensors, buzzer and battery underr the lid, as we did.

Step 3: Code

Picture of Code

Use our open-sourced code provided here on github. If you are familiar with Husarion Cloud just import it as zip, other way follow this Husarion site to connect your CORE2 to the Cloud and program it via web browser.


Zé CarlosD (author)2017-04-20


In this
project, i need to use the CORE2 platform, but at this moment, the platform are
unavaible on:

Do you know
one way to program this project using an alternative to CORE2?

Or, do you
know of another site that has the CORE 2 platform available?

sugestion is welcome!

Thank you
very much!

PawełJ17 (author)Zé CarlosD2017-05-30

It will be soon available at Crowdsupply:
I didn't make any other working alternative, just the presented one, but I think it is possible to make on any microcontroller. Except the WebUI - I don't know, maybe on NodeMCU or WeMOS? I saw once a project with a website on WeMos ;)

Zé CarlosD (author)2016-10-19

Dear PawelJ17:

I'm interested on the development of this project, and I have been searching the components needed and I did not found the ESP8266 adapter which is compatible with CORE2 board.

However, I have found the other components and, if not too much to ask, I would like if you can confirm it to me:

- Ultrassonic sensor:

Husarion CORE2 board:



Battery holder:


Any sugestion is welcome!

Thank you very much!

PawełJ17 (author)Zé CarlosD2016-10-19

Hi, ESP8266 is delivered for free with CORE2 in a box ;) I used buzzer with generator, so it makes characterisitc beep sound (like this one: I think that kind of microswitch could work as well, but you have to develop your own way to attach it on the lid. I'll show you my solution. Bear in mind, that Core2 needs at least 6V (, I used batteries with higher voltage than normal 1.5V batteries, so I could use only 3 of them.

PawełJ17 (author)PawełJ172016-10-20

That's how I attached my microswitch. I melted a part of my 3D printed lid and used a glue to attach the microswitch

Zé CarlosD (author)2016-09-28

Dear PawelJ17

The app you developed is for android or iOS?

Can you explain better how to install the app on the smartphone?

Thank you very much

PawełJ17 (author)Zé CarlosD2016-09-28

This User Interface is running through website only, thanks to Husarion Cloud, here is link:

You can find more information here:

Joseph jo (author)2016-09-28

It is cool

Swansong (author)2016-09-26

This is pretty funny! XD We need one of these in our house.

PawełJ17 (author)Swansong2016-09-26

Show us, when you complete your jar ;)

About This Instructable




More by PawełJ17:SpyBot - Internet-controlled robot with videostreamingOpen Sesame - DIY door opening IoTRoller blind controlled via web browser with CORE2 and RPi
Add instructable to: