Gut Check a Tweeting and Facebooking Fridge using Arduino

I have a problem, I’m trying to lose weight but I love snacking late at night. And no one knows that I even do it. That being one of my biggest hurdles, I figured why not include all my social media friends and followers in helping me. Whether they know it or not.
Arduino Fridge
So I decided to hook up my fridge to the internet, with an arduino and wishield and have it post to facebook and twitter whenever I try and get myself a late night snack.

I even have a tumblr account setup to track my progress and see what else is being done with it.

This instructable is for a lite version of it. The message is hard coded in the php file, and so is the set times it will activate. The one I have personally is also updating and running off a MySQL database for some extra tracking for opening and closing, also so I can also give the fridge a wider array of things to say if I open the fridge contained in a database as well. But what I posted will do what it says, post a message to FB and TW if you try to sneak a late night snack.

If anything doesn’t seem to be working properly, let me know. I did take my version and clean it up best I could for everyone and simplify it as a starting point.

Step 1: Hardware Components

The setup of the fridge needed these parts:

Arduino Microcontroller
Wall wart to power Arduino with Center-positive 5.5×2.1mm barrel connector
Force Sensative Resistor
10K ohm resistor
Extra Wires
1 or 2, those kinda squishy cabinet door bumber things that make them not sound like there getting slammed hard.
Breadboard (options, but very useful also a zip tie can be handy)
A web server running PHP. (You cannot trigger the facebook and twitter apps without it being on a live server (at least it wouldn’t work when I tried it).

Step 2: Wiring the Arduino

A great place to start learning how to use the pressure resistor with an arduino is

I started with the simple demo to start it off.
The final setup I did has one leg of the pressure resistor hooked into 5V
The other leg has the 10K resistor wire to ground for pull down and the end is plugged into Analog 0.
This reads in the value of the pressure resistor.

And since I didn’t want to have to wire it directly to my computer and have wires all over my house I used a WiShield from asynclabs.
You can use any method to do the communication: wifi, wired, bluetooth. I just happened to have a WiShield around to use.
The WiShield let you still plug the pressure resistor and other wires needed to still interface with the arduino.

The picture included is for reference, just plug in things the same with the WiShield attached to the arduino.
Arduino Fridge connection
I have an outlet in one of the cabinets near my fridge, so that turned out to be a great spot to put it. It is tucked away and out of sight. I got a 12V 500mA wall wart from radio shack and a Center-positive 5.5×2.1mm barrel connector, as advised from a quick google search.

Step 3: Arduino Code

The code is built with “SimpleClient” as a starting point from asynclabs’ code.
First I’ll show you all the code and then break it down.
(I replaced all my router’s important info with XXXXXXs, just fyi)

* A simple sketch that uses WiServer to serve a web page
int fsrAnalogPin = 0; // FSR is connected to analog 0
int fsrReading; // the analog reading from the FSR resistor divider
boolean hasOpened = false;
boolean hasClosed = false;
boolean isOpen = false;

#include <WiServer.h>


// Wireless configuration parameters —————————————-
unsigned char local_ip[] = {192,168,X,X}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,X,X}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {“XXXXXXXXX”}; // max 32 bytes

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]Arduino

Force Sensative Resistor



For more detail: Gut Check a Tweeting and Facebooking Fridge using Arduino

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top