Hi, I’m Sammy, and I’m a rising junior at the Rae Kushner Yeshiva High School. I built a starter project and a main project here at BlueStamp. My starter project was the crawling microbug kit from Velleman. It’s a small light-seeking robot which crawls on two pegs and a back roller. I chose this project because I love anything that can move autonomously. The end product was nice, but the PCB quality was pretty poor, and I had to make some of my own copper wire connections instead of the copper traces on the board. The process was frustrating, but I learned valuable debugging techniques.

My main project was my own Refrigerator Pad. To my knowledge, this project has never been done and documented online before, so I came up with the design, circuit, and overall execution of this project by myself. This pad is meant to be placed on a shelf of a refrigerator, and is accompanied by a Google App Engine website which I developed and designed from scratch. Once a user places a new item on a quadrant of the pad, he logs onto the website, and types in what he just placed on the pad. Then, when the item begins to run low, the pad will update a grocery list located on the website. After my sister gave me this idea, I decided to stick with it because I wanted to do something original, and this project had a great balance between mechanical engineering, electrical engineering, and coding.


Main Project

The main project that I built here at BlueStamp was my own Refrigerator Pad. This project was actually not one of the ones in the BlueStamp project book. I didn’t want to do a project that has been done hundreds of time before and can be built by following a tutorial. I wanted to build something original.

My older sister knew that I was looking for an idea, and she told me about a problem she had that day: She had gone all the way to the grocery store to pick up a few things, then returned home only to find that she was out of milk, and she hadn’t even realized. So I set out to solve this problem: I wanted to make a pad that can be put on a refrigerator shelf and will use weight sensors to detect when items are running low. The pad will then communicate with a website that I would develop and update a grocery list. There would also be an interface on the website to tell the pad when new items are being put on it.

I really liked this idea because it had a practical aspect to it- I could even see it being marketed in the future. I also liked it because I googled the idea and I could not find a single person who had done it and documented it on the internet, so I had the opportunity to test my capabilities and see if I could figure out how this could be done by myself. I spent numerous hours researching, and I came up with a plan. This same plan is what I’ve carried out in order to make the fully-functional Refrigerator Pad I have today.

The pad is split into four quadrants, each quadrant for a specific food item. Each quadrant rests on a column made of PVC caps, which directs the force exerted by the food item onto a circular Flexiforce weight sensor with 1” area. All four sensors are set up in their own voltage divider circuits, and then hooked up to an MCP3008 ADC (Analog-to-Digital Converter), which converts the analog voltages from the sensors into digital voltages. The ADC then sends the digital voltages to a Raspberry Pi through SPI (Serial Peripheral Interface- a protocol used for transferring serial data). The Raspberry Pi uses a Python script that I wrote to collect and keep track of the data, and decide when each pad is running low (based on a specific threshold that I set).

The Raspberry Pi communicates with the website that I developed on the Google App Engine (a free web-application hosting service) via an email system. Once a user puts a new item on the pad, he would log onto the website, navigate to the Pad menu, and in the proper textbox, type in what he has just put on the pad. The website then emails the Raspberry Pi to inform it of that change, at which point the Raspberry Pi will monitor that pad. Once that pad’s weight has dropped below the threshold for over 30 minutes (so that the user has time to take the item off the pad, use it, and put it back), the Raspberry Pi will send an email to the website which will add it to the grocery list.

Since my last milestone, I’ve really just written the Raspberry Pi Python script. I took the sending and receiving email scripts that I previously wrote, and I turned them into functions that I could use in my main script. I also included my previous function to read the data from a specific sensor. After defining all of the functions, I defined some dictionaries that I would use to store data for each sensor, such as the current item on the pad, and the current weight of the pad. I set a specific threshold for differentiating between empty items and full items, then I made a loop that checks the weight on each sensor once a minute, and if it’s above the threshold (full), then it increments a counter to see how many times in a row the pad is full. If the weight is below the threshold (empty), then it resets the full counter and increments another counter to count the number of times that the pad is empty. If the full counter reaches 3 (it’s been empty three times in a row), then it resets the empty counter.

I had to make all of these confusing counters, because I found that sometimes when the pad was empty, the sensor could give an occasional erroneous reading and say that the pad is full, but these errors would never happen 3 times in a row. So when the empty counter reaches 30 (it’s been empty for 30 minutes without getting a “full” reading three times in a row), the script will send an email to the website with the name of the empty item. The script also checks the pad’s Gmail inbox once a minute to check if the pad was updated.

My current sensor setup is not as accurate as I originally planned for, and as such I sometimes have to change the threshold in the script. So I have future plans to make the sensors more accurate by including amplifier circuits with each sensor. I hope to have the sensors eventually be precise enough to accurately convert the sensor readings into pounds, so it could function as a scale, and could set a different threshold for each new item it encounters.

Here is a link to my github repository containing all of my code for the whole project:

Here is a link to my sketchup model of the pad:

Here is my schematic for the circuit:

 refrigerator pad schematic

Here is my mechanical drawing of the pad with dimensions:

refrigerator pad mechanical drawing

Here is a link to my bill of materials for the project:

Here are some links which I found helpful:


Third Milestone

For my third milestone, I basically completed my website, and got the website to communicate with the Raspberry Pi through an email system. I developed my website using the Google App Engine which is a free web-application hosting service. It allows for websites to be developed in Python, which I am very familiar with, so it made it much easier for me to develop a website from scratch. I knew some basic HTML, so I was able to make a very minimalistic layout and design. I also used the Python web framework Bottle to structure my website. By reading the Google App Engine documentation, the Bottle documentation, and a bunch of forum posts, I learned how to use Google App Engine for my purposes.

I used the Engine’s built-in email service to send and receive emails, and the Engine’s free database storage to store data such as which items are on which pad, and what is currently on the grocery list. I made one webpage to display the grocery list, and one webpage with a nice interface to display each pad and allow for the pads to be updated with new items typed into text-boxes. During development, I tested everything periodically using the development server. On the Raspberry Pi side, I wrote one script using the smtplib Python library to send emails, and one script using the imaplib and email Python libraries to receive emails and check for unread emails from a specified email address.


Second Milestone

My second milestone was solely a hardware build. I now have the physical pad built. I used a 12”x16” polycarbonate sheet as my base, eight ¾” PVC caps as my columns, and four 6”x8” polycarbonate sheets as the tops of each quadrant of the pad. When planning for my project, I didn’t know what materials to use, so once the program started, my instructor Kyle got me some polycarbonate, and I went to Home Depot and found some PVC caps that I decided would work.

I came up with the following design by myself: I joined pairs of PVC caps, each pair joined together by the caps’ hollow ends. I used epoxy to create the joint. I then marked the center of each 6”x8” sheet, and epoxied each pad to the top of a PVC column. I have not yet attached the bottom of each column to a sensor on the base, because I’m waiting to test and make sure that the sensors work in this position.


First Milestone

For my first milestone, I have set up the Raspberry Pi to receive data from the Flexiforce sensors and display the analog value (between 0-1023) on my screen every second for fifteen seconds. When I first started my project, I downloaded the default Raspbian Wheezy Linux distribution and wrote it to an SD card using my laptop.

I assembled my Adafruit Pibow case around the Raspberry Pi, while making sure to attach the Pi’s GPIO cable before closing the case. I then put the SD card in the Raspberry Pi and booted up for the first time. I stuck with all of the default settings, except I enabled SSH so that I could use the Raspberry Pi without a screen or keyboard and control it from my laptop. I then installed a Python wrapper for the SPI interface so that I could receive serial data through the Raspberry Pi’s SPI port. I also installed the Adafruit WebIDE on the Pi so that I could easily upload and run code on it from my laptop.

For the actual circuit, I assembled the Adafruit Pi T-Cobbler and attached it to the Pi’s GPIO cable. I then made all of the proper connections between the Cobbler and the MCP3008 (the Analog-to-Digital Converter that I’m using to send the Raspberry Pi sensor data through SPI). The Flexiforce weight sensors that I’m using are variable resistors, so I made a voltage divider circuit for one sensor so that the sensor can output a voltage proportional to the amount of weight put on it, and hooked that up to one of the input pins on the MCP3008.

I wrote a simple script on the Adafruit WebIDE which just reads the sensor through SPI once every second for 15 seconds and displays all of the values on my screen. I ran the script on the Pi through the WebIDE, and lo and behold, when I would press firmly on the sensor, the program would display a relatively large number (between 0-1023), and when I would not touch the sensor, it would display a number at or close to 0.


Starter Project

This blog post is for my finished starter project, the crawling microbug kit produced by Velleman. This little bug seeks out light and tries to follow it. When placed in a dark room, it will follow a flashlight fairly well. The sensitivity of each side of the bug can be adjusted using the knobs on each side, and the speed of the bug can be adjusted using the center knob. The bug actually doesn’t have any wheels, it just has rubber casing on the motor axles and a plastic roller on the back. It’s turned on by flipping the left switch, and it can switch between a curvy path mode and straight path mode by flipping the right switch. It’s powered by two triple-A batteries.

The actual circuit of the bug is all old-school electronics- there are no integrated circuit chips. Instead, the circuit works by creating voltage dividers between the light dependent resistors and fixed resistors. The light dependent resistors are similar to normal resistors, except that they vary their resistance based on surrounding light. The voltage dividers output a voltage proportional to the amount of perceived light, and when that voltage is high enough to surpass a threshold, it will activate transistors which will turn on the motors. The circuit also uses capacitors to control the timing of the motor activation in order to ensure that the motors are synchronized.

I learned an unbelievable amount from building this kit, but not in the way that most of the other students did. I learned how to understand schematics better and I improved my soldering skills, but most importantly, I learned how to deal with issues and troubleshoot. After assembling the kit, I found that the bug just didn’t work. I spent many hours testing and investigating, and no solution seemed to be working. Also, during the process of fixing, many of the copper traces broke on the poor-quality PCB. Eventually, after removing many of the printed connections and redoing them with my own jumpers, I got the bug to work. I wouldn’t recommend this kit because the bad quality components just are not worth the hassle. Regardless, I’m extremely happy that I finally got the kit to work, and that I learned to be patient and take problems one step at a time.

No Comments Yet.

Leave a reply