Edible Email Notifier

My editable email notifier is fully functional! It successfully indicates the new number of emails by spinning and dropping M&Ms into a glass. Then, once the emails have been read, an LED lights up to indicate that one may eat the M&Ms.

Below the jump is my code and process!

Above is the python code for the computer functionality. This was my first time working with python, and it was an interesting process of trial and error. Here’s what the above code says: check if the arduino is plugged into the computer, then log into Gmail (with provided email and password), check the number of unread messages, send a certain letter to the arduino indicating the number of emails and repeat every 20 seconds.

Once the arduino receives the certain letter, it decodes the letter to a number (I have not been able to figure out how to get python to send just a number to the arduino). It compares the number of unread emails to the previous number of unread emails and does one of three things: if unread is greater than previous, it steps the motor forward; if unread is the same as previous, nothing happens; and if unread is less than previous, the LED lights up and indicates that you may eat the M&Ms because that means you read your email.

The stepper code is fairly simple. Since the motor I’m using has 200 steps per revolution, each new email moves the stepper -50 steps, or 90 degrees clockwise. The stepper know how many steps by doing the calculation -50 times (the current email number minus the previous email number).

I have some minor additional adjustments that I’ll make in the future, including attaching the stepper motor to the base, cleaning up the python code and potentially laser cutting a better looking dispenser.