that the program can execute. You can run the program with the above configuration by typing:
fswebcam -c /home/user/Pictures/picture.conf //the location of the .conf file should be wherever you put it, so the code after the space after the -c will be different for you.
This will produce an image from your webcam in the location you specified in the picture.conf file.
I installed all of this on my server and got the below image. This is what the laptop running this website sees!
2. Write a python (I’ve decided to go with python because I’ve never used python before, it will be good to learn something new. And because there is already a library for controlling the GPIO pins on the RPi baked into the language.) script that can sense weather or not this sensor‘s alarm pin is pulled low. At that point, the script should then execute the above bash command and take a picture. After that, that photo should be moved somewhere to do something, but I don’t know what that will be yet. It will probably be uploaded to a secure location on my server and then I will have it email me if at the end of the night, something shows up.
//If you just want to see the PiScanner Progress, skip the next 2 blocks
So, you may have noticed an absence of recent posts on this website. This is due to a few factors but the main one is a lack of focus. Not a lack of focus in a multi-tasking sense, but in a sort of literal sense. I’ve got foggy fragments of ideas, but no concrete ideas that are feasible. I think that the introduction of the “Project Execution” prefix in the title of this post (and hopefully all of my other project-based posts) will keep me “responsible” in regard to things I try and undertake.
There will be 5 steps for each project.
Declaration
Research
Documentation
Report feasibility [1] (This is where we will learn if the project is possible or not, and if not why.), Share all code [2] Take Lots of pictures [3]
Demonstrate / Distribute
Now to PiScanner
After Receiving my Raspberry Pi :
In the mail recently, I’ve got a whole new area of new more powerful computer science to enter into, and I think the PiScanner is the best way to do this.
The PiScanner will be a program that will identify motion using a PIR detector in junction with the GPIO pins, capture an image using a webcam or other camera compatible with the ports on the board, and then upload that image to a server to be viewed via rss.
This will be great for my backyard at night, it’s like animal planet out there this time of year and it will teach me a bunch of new things upon completion.
Hello! sorry about my absence, I’ve been very busy with school/baseball over the past few weeks, but summer is soon, and I’ll be updating with a higher frequency once that happens.
So. you’ll need a few things in order to make sure this whole process works.
1. Multiple ethernet connections.
2. An Arduino and a compatible wiznet device (ethernet shield)
Here I’m using an arduino knockoff I got 2 years ago when I first got into hobby electronics, and an “ETHERNET 4 NANO” by gravitech. I didn’t want to permanently implement my arduino nano, but I still wanted to be able to do the project. It’s powered by 5v from my computer (well from a powered hub) and the brown striped wire goes to the + on the powerswitch tail II. The blue cable is ethernet.
3. A webserver with php installed on it. (Mine’s just LAMP’d)
This is the important part. The arduino is accessing a .php document on the server to tell weather or not the lamp should be on. The UI is also hosted out of the servo. That laptop is my old HP laptop that I’ve had for almost 6 years, it’s now got ubuntu 10.04 LTS on it and it’s been LAMP’d among other things.
4. Something that can SAFELY switch line voltage. (I’m using a powerswitch tail II, because I really don’t want to get killed, and it’s also very simple – if you’re using naked relays, please for the love of god, be careful with line voltages.)
This thing is a beast. I can drive it via 5v easily, and it switches line like a champ. It’s been in constant use since my last post about home automation.
START OF GUIDE
1. So first, we need to hook up the shield, the arduino and the PSTII. It’s really easy.
2. Get linux on the computer you want to run the server out of. I made a video a long time ago back when I was first getting into linux. The installation process is still the same, you can find that video here.
3. Install various programs your server. First things first, you have to install openssh by running the command:
sudo apt-get install openssh
This will make the server headless, and it will enable you to access the server via command line. Specifically through PuTTY for windows. You can then ssh to your server which is key. You then need to install LAMP by running the command:
sudo apt-get install LAMP
This will install PHP on your server as wells apache and mysql. The two ladder objects are not essential for this project, but if you are going to use the server for other things, I strongly recommend you get them as well. The install process is very easy, just make sure you WRITE EVERY USERNAME AND PASSWORD YOU USE DOWN. I’ve had to reinstall several times before I learned my lesson on this.
After you are done with that, install vim by running the command:
sudo apt-get install vim
Vim is a text editing program for linux. You also need to get pure ftp to upload and download files from your server. Get it by running the command:
sudo apt-get install pure-ftpd
Congrats! you are now an owner of a very powerful linux server. Wasn’t that easy?
4. Upload the call.php, res.php documents to your server.
This is the call.php text, you just need to make it into a .php document and upload it to the server. This document creates a form that the user accesses to turn the lamp on and off.
This is the res.php. It is what the user is taken to once they have entered the information in the call.php.
If you walk though the code. You will see that once the correct password gets entered, the res.php document creates a functioning document stat.php. This is the same document that the arduino reads, and compares to.
Here it is, upload it to your board with the shield attached, and everything should work. Access the call.php via your server, and go through the process.
At this point everything should work, please let me know if it doesn’t in the comments.
This is a round about way of using a servo to move an analog sensor to 3 points to triangulate the servo degree where the photocell experiences the most light.
The servo sweeps back and forth and then another servo points to where the brightest point was.
It is very simple wiring, but the code is a little fancy. It’s all commented up here, but as always deduction is your friend.
Anyways! I’ve set aside my home automation project and picked up a few of these shift registers: the 74hc595 by TI, seen here:
As seen in the video above, I’m controlling 14 led’s using two of the 74hc595s and and 3 pins on an Arduino Uno.
The program uses a for loop and cycles through the 14 pins on the registers. That code can be found here. Thanks for reading, check back soon for updates on the home automation project.
Watch the video above for context. In summation though, what we have is basically an arduino that fetches a string from a php file on my server, interprets it, and compares it to a predetermined char array.
In the future, this WILL have a GUI that can be controlled from a website and do the lamp that way from any source inducing mobile (maybe even twitter!).
Source-wise the code isin’t very well commented but the Arduino is here, and the php is here. A word of warning: unless you want me to be able to control a leigon of lamps across the world, I would suggest changing ip addresses / filepaths on the Arduino side.
On another side note all of my sources for stuff I write about on this blog here
So I’ve made a bit of progress with the project that I’ve been undertaking lately. I’m trying to control a powerswitch tail from an arduino via the internet using the Ethernet shield and a PHP server. Right now I can edit a the name of a string (well, echo) in putty on a document on my PHP server (the very same LAMP that’s allowing me to type this post!) and have the Arduino decode that string (echo) and print it back to the serial console at 9600 baud. You can grab the source for the Arduino here and the PHP script here See comments in the arduino code for notes about setup. Also deduction is your friend 🙂 Happy programming!
I’ve wanted to do something like this forever. For those very familiar with my youtube channel, you will note that I have mentioned making a Quadcopter before, but sadly that project was shelved due to lack of resources.
I will hopefully make something that cool one day!
I recently built my 1st computer and the monitor finally came in. Pictures are below.
The computer is built around the intel i5-2500k. It’s got 8gb of ram, 500gb HDD, 60gb SSD for caching (face melting speeds), 750w PSW, nVidia GTX560ti 448core EVGA classified, and an AsRock extreme4 gen3 motherboard. It’s the fastest computer I’ve ever owned.
It’s 20 inches (way bigger than it sounds) and is LED backlit. It looks really really really nice.
I’ve decided to teach myself the language PHP. This won’t be the first time I’ve attempted to teach myself a language sans-instructor before, but i’m sure i’ll make due.
This will however be the first time that I attempt to do so while I have a website! You can follow my progress at the index of www.esologic.com/learn_php. Right now I’ve got a sample for arrays in there.
You can right-click -> save as the documents and open them in your favorite text editor, (I know for sure it works in vim in debian, as that’s where i’m editing it in) or click the document to see the output.