My take on the classic inverted pendulum problem.
My take on the classic inverted pendulum problem.
Developing a home-surveillance system has interested me for some time, so I did some research on the best hardware for the job. The camera shields that I saw for the Arduino Uno were pretty pathetic, to be honest. They were expensive and/or lacked proper documentation. One particular Uno shield cost more than both the Raspberry Pi and its camera board combined, so I decided to just get those two instead. Turned out to be a great decision!
Although all programming was done myself, I’ve decided not to share the source; it’s important that a system like this be designed from scratch by the budding developer. I will, however, say a few things:
At the end of the video, you’ll notice I don’t open the .jpgs that start appearing. Of course, I like to maintain some amount of privacy… Also, sorry about the camera position. You don’t actually get to see me, but I prefer it that way.
UPDATE: I’ve revised the circuit design. I no longer recommend connecting the Arduino Uno to the Raspberry Pi’s I2C pins together without the use of a logic level shifter. The revised design uses one from www.adafruit.com.
As part of a larger project I’m doing right now I’ve connected an Arduino Uno, as an I2C slave, to the Raspberry Pi. The premise here is that if I press a button on the Arduino, it will trigger the Raspberry Pi to take a picture using the Camera Board and store it in a particular folder. The overall setup is as shown (minus the camera):
According to ELinux, the I2C pins on the RPi are connected to 3.3 V via internal pull-up 1.8 kΩ resistors. This means that, if the Uno is configured as a slave device, the necessary power will come from the RPi I2C pins themselves and that the Uno’s I2C pins can be directly connected to the RPi pins, right? A few websites’ tutorials show this configuration. However I’ve found that I2C communication is very flaky if the pins are directly connected. Again, I recommend using a logic level shifter. Adafruit sells one that is I2C compatible.
For the Uno, I used Arduino’s C++ and the Wire.h library. For the RPi I coded the software using Python, making use of three libraries:
Comments are included within the code to provide insight on how they are used. The files, PiCam.py and i2cslave.ino, are located here.
Edit: I’ve included a function that emails the picture taken to my GMail account. MitchTech has a great tutorial here: http://mitchtech.net/connect-raspberry-pi-to-gmail-facebook-twitter-more/
Long story short, I installed both of the aforementioned programs on my Raspberry Pi but, in doing so, I was able to navigate to only ownCloud. After doing some digging around the internets, I found the solution.
As smithg400 on Raspberry Pi’s forums pointed-out, both WebIDE and ownCloud listen for connections on port 80 of their local networks, and that the solution is to change one of them; in this case, the default port for WebIDE.
To do that, open a Terminal window and navigate to the config directory of the WebIDE installation folder by typing
sudo nano config.js
You’ll find that the file looks something like this:
You want to change the port number to something else. In this case, I changed it from “80” to “8080”, like this:
CTRL + X
to exit, then type
to accept the changes. Now open a browser and log-in like you normally would to WebIDE. Just type in your RPi’s address followed by the port, like this: 192.168.xx.xx:8080
I just installed ownCloud on my Raspberry Pi after scouring the internets for the best set of directions. There’s quite a few tutorials out there, but only one of them worked for me, without much of a problem.
The best tute I found came from this blog:
There are two different ways to set up ownCloud using the script on the site. I had to go with Apache instead of NGiNX because NGiNX just didn’t work for some reason. But go ahead and check it out, it’s pretty nifty.
EDIT: The OS running on my RPi was Raspbian, installed using the NOOBS v1.2 .zip file found on http://www.raspberrypi.org/downloads.
I’m currently working on something that involves the Parallax PIR and Ping sensors. The main platform for this one is an Arduino Uno. Right now, Arduino has code on their website for both of these sensors, here and here. Since I thought that they’re both kinda messy, I wrote a library for each one, by just organizing the existing code. Credit goes to the original authors.
Here’s the link to the repository where they’re kept. If you’re not familiar with git, check out this link.
Beer brewing is a fun hobby, whether you wanna just brew something easy from a kit, or take the time to fine-tune your preferred style. With every batch, there are always two things that weigh heavy on a brewer’s mind: risk of contamination or, depending on where you live, extreme temperatures. I live in an area where the temperature often dips below 60° F during the winter, which is too cold for the yeast to thrive. Using a space heater wastes a ton of energy, and I’ll still have to turn it off manually. I decided to tackle this problem.
At the very least, I knew I would need a heating belt, a temperature sensor, and an AC power source that can be activated/deactivated. Generally speaking, heating belts don’t come with any sort of feedback control, and an off-the-shelf regulator costs far more than I’m willing to pay. After a bit of research, I decided that I needed the following:
I started off the project by doing a bit of programming on the Arduino to display the temperature read by the sensor on the LCD, and the IR sensor to trigger the LCD backlight (via the Arduino). Once that all worked, I was left with a dilemma: I could use either an electromechanical relay or a solid state relay, like a TRIAC. Since I had no experience in using one, I went with the TRIAC.
For those of you unfamiliar with TRIACs (triode for AC), here’s a little background info: they are 3-pin transistors. When a current is injected into the gate terminal, it allows for current to pass through the other two terminals, just like it would for a BJT. The great thing about TRAICs is that they can conduct both ways, making this a great switch for AC applications. If you open a light dimmer-switch, you’re likely to find a TRIAC inside. For safety’s sake, TRIACs should be driven by optocouplers (a.k.a. optoisolators), which in turn are driven by a controlling signal. TRIAC/isolator combinations are, in my opinion, better than electromechanical relays because they are cheaper and require less space. The optocoupler’s datasheet provides example circuit diagrams for different kinds of loads. I picked the one for resistive loads and tested it. After testing, the circuit was soldered onto a PCB. As you can see, the IC socket is soldered-on, and the isolator simply inserted. That way, if it stops working, it will be easier to pinpoint the problem.
An extension cord was stripped on the female side and the leads soldered as shown in my schematic, then thrown into an outlet box. Finally, I threw together everything as shown in the schematic:
Update: I soldered the stuff seen in the video onto a protoshield, and added a few things.
After my tests are all said and done, it’ll be time to start brewing. How can one better kick-off the summer than with homemade Stout and Honey Wheat?