FishBot

Hello everyone! Thanks to everyone in the forum, I got my code working perfectly and now I added some more features.

I can't figure out how to attach anything to this post so I won't be able to show it to you. It has 3 tabs.

In the code I've created a web server that displays the temp of the tank. It also lets you manually feed the fish and do a manually water change.

My question is this: How can I set up a web cam on my web server? I want to be able to see my fish tank on the web server while its doing a feeding/water change.

Thanks, Elijah

Here is my code: files.me.com/elijahwood/t2j5dl

I figured it out... ;)

If "my web server" refers to the Arduino, the answer is "You can't". It's like trying to tow a full-sized RV with a Ford Focus: you might be able kluge up something that will get you across a parking lot, but you'd be insane to try to cross the country with it. That doesn't mean there's anything wrong with Arduinos, but, as Dirty Harry said "A computing platform's got to know it's own limitations" 8-)

If you want to serve up video, you need to pick up an old Pentium that someone's discarded, throw Linux and Apache on it, and have it act as the server to the outside world. You can embed the Arduino interface in a frame on that webpage, and get protection against hackers crashing the Arduino by overloading it with attempts to find its assumed Windoze vulnerabilities as an almost-free bonus.

Ok...thanks for the info! :)

Is it possible for it to take a picture and then send the image via email? Also, in my code, how can I move the temp reading to the bottom of the web server page? I tried but couldn't get it to move from the top.

Thanks, Elijah

There are some older digital cameras that came with a serial interface instead of USB. Some of them have firmware that allow a computer to control the taking of pictures through the serial port, and there was a Linux project (gphoto) to create an application to do that. It's since morphed into a rather different app, but you may be able to adapt the source from an early version to take a picture, and pass it through the Arduino. base64 encoding can be done in small (Arduino-sized) chunks, but I'm not sure whether you can do a MIME email attachment without knowing the size in advance. Worst case, you'd have to manually decode the picture at the receiving end.

(Actually, the worst case is that the camera driver is so big that it wouldn't fit in flash, but that's probably not true)

You can move your temperature text down the page by preceding it with as many calls to

client.print("
");

as you need.

Thanks! Do you know anyone who has tried to control a camera with an Arduino? If I hook the camera to serial I could try to convert it to code and then have it send that code to me via email. I could manually decode it on my end. But, with the Base64 code can I decode it on my arduino and send it to my email with an attachment?

Elijah

I just found this on the internet: http://gizmologi.st/2009/04/taking-pictures-with-arduino/ Will this work?

Also, when I add the breaks in the HTML code the temp reading and everything else moves down too. How do I make the temp reading under everything?

ALSO, for some odd reason it's not sending the emails. It's putting up the web page but it is not sending emails. Any ideas?

Thanks, Elijah

I like that camera. The only advantages to my suggestion of finding an old digital camera are that you might find one with a better lens (e.g., a zoom), and/or it might be cheaper because almost everyone wants one with USB and a bazillion pixels.

Otoh, you might wind up buying a lemon, or one that turns out to be really hard to interface. For simple snapshots of your fishtank, the one you found is probably a better bet.

I'm confused about what else is appearing on your webpage: the temperature is the only thing displayed in the code you linked to.

Your email problem appears to be that you're not invoking Client() correctly: you need to have an IP address to go with that port number. I'm a little surprised that you didn't get a compilation error: the single-parameter constructor takes a uint8_t, and "587" is clearly not a valid 8-bit unsigned value.

That might not be your only problem, though: I saw a thread recently about difficulties with mailservers that require authentication and/or SSL. A forum search for "EHLO" should turn it up. I've only done HTTP with Arduinos, so I don't know about the details of sending email.

Base64 is a relatively simple encoding scheme originally developed for posting binaries (probably pr0n ;D) on text-only Usenet. It also gets used for email, but these days most emails use a more-complicated MIME protocol for sending binaries as attachments, rather than inline text, because that makes it easier for non-geeks. But you don't need MIME, and its associated overhead, because you're a geek ;)

Thanks! Do you have a mac or a PC? I'm using a mac to create the zip file maybe that's why it's not complete. It should have 3 tabs on top, I think FishBot, temp, and time.

It has 3 buttons on the web page that say "LED", "Feed Fish", "Change Water". Also, it has a header with my name, ect.

I think I figured out why it didn't send email...I forgot to include this:

byte server[] = { 98, 136, 86, 109 };

This is yahoo's server.

But now I get this error: error: conflicting declaration 'Server server' In function 'void setup()': In function 'void loop()':

Thanks, Elijah b