|Email Reading Reindeer|
|All News -> Projects|
|Written by Nicholas McClanahan|
|Tuesday, 13 December 2011 04:24|
Rudolph, the Email Reading Reindeer, lets you know when you've got a new email and tells you who sent it!
Rudolph uses a Propeller Platform USB to log into the email server, trigger animations, and generate the speech. An E-Net module handles the Internet connection. First, I'll answer a few questions, then I'll show you how I built it, and I'll give you a few ideas on how to customize it for your own projects.
How's it work?
Tools and Materials
Materials1 - A stuffed animal
Look for one that has a switch that triggers the animations and a speaker.
2 - Propeller Platform and E-Net Module
You could also build this project on a breadboard, although it would be a bit unwieldy. The E-Net Module is based on the ENC28J60 chip.
3 - Audio amplifier
Here's the shopping list;
ToolsAssembly took me about an hour, and takes some soldering. If you've never soldered before, there are a bunch of great instructables to guide you, like this one. You'll need a few tools:
I recommend leaded solder, especially if you're just starting out. Leaded solder is easier to work with, melts at lower temperatures, and results in better connections, particularly when you're inexperienced. Leaded solder is also poison, so don't put it in your mouth and wash your hands after soldering. The smoke isn't nearly as toxic, but it irritates my nose, so I try to avoid breathing it in.
Most animated stuffed toys have a similar construction; the stuffed 'skin' goes over a plastic bell that houses the circuit and batteries with a motor on top that does the animation. The skin is usually affixed with hot glue or velcro. To access the circuit, we'll need to separate the plastic bell from the skin.
On Rudolph, the original assembly used hot glue, so I used a razor to cut the bell from the skin. Then, you can slide the skin back to expose the bell. The bell will usually be held together with some more hot glue or with screws, like Rudolph. Remove the screws and open the bell to expose the circuit;
There are two pairs of wires we'll need;
The circuit consists of a Propeller Platform, E-Net Module, and an audio amp. I've built the audio amp on a spare piece of protoboard and connected it to the Propeller Platform.
Audio AmpYou can connect the Propeller Platform directly to the speaker in Rudolph's body, but the audio will be very quiet. So you'll need to amplify it to be heard. I've built the amplifier using an LM386, a common small audio amp. Here's how you connect each pin on the LM386;
Animation switchOf the two wires that were connected to the switch in Rudolph's body, one is connected to ground, and the other will be floating. You'll need to determine which is which with a multimeter. Switch your multimeter over to measure volts, and connect the black test probe to the negative terminal in Rudolph's battery box. Connect the red test lead to each of the wires that came from the switch. The wire that measures 0V should connect to Ground . Connect the other to P17 on the Propeller Platform.
Connecting everything togetherI build the circuit on a protoboard and used screw terminals to easily connect everything;
The screw terminal on the top right connects to the 5V and ground connections on the Propeller Platform. The top middle connector goes to the speaker in Rudolph. The top left connector connects to the animation switch in Rudolph, and the bottom left connector goes to the audio and animation pins on the Propeller Platform. Using screw terminals is handy if you want to reconnect things or use a different stuffed animal.
Assembly instructions come with the E-Net module - just drop it on top of the Propeller Platform. Then, connect your amp to Rudolph and the animation switch to the Propeller Platform and you're ready for the software.
Download the software and unzip it into a new folder on you desktop. The top object is Pop_Santa_003. You'll need to adjust the settings in the beginning of the program;
emuser, empass, and emserver are the username, password, and server URL for your email account. If your email provider is yahoo, that would be;
emIP is the IP address of your email server. You can find that out by pinging the server or just typing in the name in a site like ipchecking.com. emPort is the port your email server uses for POP mail. It's commonly 110 or 995.
IP settingsRudolph doesn't support DHCP, so you'll need to configure it to work on your local network. There are four settings you may need to change;
for ip_addr, you should be able to choose an unused IP address on your network. Subnet is usually 255.155.155.0 and gateway and dns are usually the address of your router. If you don't know those settings, you can just copy your computer's config. In Windows, open up the command prompt and type ipconfig /all . In Linux, you can use route -n .
How it worksThe program first starts the reading engine and networking. Then it enters the main loop. It logs into your email server every few seconds and reads the number of emails stored. If that number increases, it retrieves the newest email and sends the sender's name to the phoneme engine.
The phoneme engine takes a crack at reading the sender's name. It's not a true text-to-speech engine, so playback can be hit-and-miss. But it can be useful for short strings. After the new email is announced, Rudolph goes back to checking for new emails.
This code is well suited for logging into email servers, but I've written a more general version that's suited to grabbing information. I'll show that to you in the next step with an Umbrella Alarm.
Customizing It: Umbrella AlarmAfter thinking about all the useful information that's sitting on the Internet, I re-wrote Rudolph to also grab data from web pages. You can get the code here.
Here's how to use it to grab a weather forecast off the Internet and remind you when to grab an umbrella;
1. Find the web page that has the data you want
Small pages work best. For weather forecasts, I surfed around the NOAA site and found this page. This is what I entered;
Start the networking with:
2. Identify the data you want to use
On that page, the data element <pop> is the probability of precipitation for my area. For my Umbrella Alarm, I don't need the whole page - just the value stored in the pair of <pop> tags. The
The first argument,
3. Grab the web page!
Now we know what web page our data is stored on, what data we want to retrieve, and where to store the result. serverrefresh grabs the page and updates the values. Each time we call it, a request is sent to the remote server and the local values are updated with whatever the server returns.
Keep in mind the result is always returned as a text string. If the result should be a number (like the probability of rain), the str2dec method will convert it to a number for you.
This umbrella alarm grabs a web page that includes a weather forecast, parses it and returns the probability of rain. If the probability of rain is greater than 30%, our red LED turns on. Here's the complete program;
Email and web data can make your projects more useful and powerful. Here are a few ideas;
PHPIf you have a webserver, you can use PHP to calculate data and return it to Rudolph. Have PHP query your database and return the number of users on your site or the server load. Or have it parse a remote page and return the result.
Web ControlBy having a page on your server modify a 'control' file that Rudolph pulls down regularly, you can control your projects over the Internet.
That's it! I had a lot of fun putting Rudolph together - let me know if you've got any questions or comments!
CreditsA lot of effort went in to Rudolph - in particular, a huge thanks to;