Home automation – Driving a relay with RasPi/ ATtiny

So far I’ve attached devices to my Raspberry Pi or Arduino Uno with ratings less than 100 mA. These devices were connected to the output pins through a transistor or optocoupler. However, for heavy load currents a relay must be used. As a noob, it is somewhat difficult to chose parts with the right specs for driving a relay — so here are some hints.

Continue reading Home automation – Driving a relay with RasPi/ ATtiny

April Prank TV-B-Gone …

In case you’re going to visit your local shopping mall on 1st of April, this one is for you: In our mall, there are walls stuffed over and over with large-sized flat panel TV screens running all day long, even if no customers are present. Kids feel magically attracted to these walls and I always had a hard time to drag my daughter away from them. To zap them would be an option, but this requires to have hands on the right remote …

Continue reading April Prank TV-B-Gone …

RasPi Bird-O-Matic/ Bird Photo Booth

Since spring has almost arrived, I wanted to check how many birds are still coming to my feeder before removing it from the balcony. Good to have a Raspberry Pi for counting our feathered friends!

There are several ways to detect motion with a Raspberry Pi. The best and most popular method is connecting a PIR sensor, which detects the infrared radiation emitted or reflected from an object. Motion can be also detected by image processing of webcam frames with a software called motion. However, image processing requires CPU power, which is limited on a Raspberry Pi. Furthermore, motion detection with a webcam depends on decent light-conditions and may be triggered from inanimate objects, such as trees or leaves moved by the wind.

Here I wanted to test whether it is possible to count bird visits using an infrared light barrier. I had both a photo diode and a high power infrared LED lying around in my tool box (SFH230-FA and SFH4550). Consider this project as a “proof-of-principle” build and be aware that there are more reliable ways for detecting motion!

Since the SFH4550 has a narrow emission angle of 3°, I designed a circuit which allows to sense the light reflected by an obstacle which moves into the IR beam. The setup is very similar to IR range sensors used in robotics. The detection range is about 30 cm, which is decent to monitor the space within the bird feeder. Furthermore, the diodes are about 0.64 € each, which is much cheaper than a ready-to-use IR distance shield.

Continue reading RasPi Bird-O-Matic/ Bird Photo Booth

Connecting a DS18S20 temperature sensor to RasPi

I’ve been a little reluctant to connect a DS18S20 temperature sensor to my RasPi, since there were rumors that the w1_gpio.ko kernel module exclusively requires a connection to GPIO #4, because of being hard coded. At least that’s what Lady Ada’s tutorial says about it and what one can read in several user forums. Unfortunately GPIO #4 was already occupied on my Pi. Therefore I searched through several Blogs for advice how to change the hard-coded GPIO in the kernel module. It turned out that I wasn’t the only one – so here’s the good news: In Raspbian Wheezy with Kernel 3.10.25+ it is possible to pass the desired GPIO in /boot/cmdline.txt to the kernel using the option:

bcm2708.w1_gpio_pin=<GPIO#>

To be able to read temperatures from the sensor, modprobe the wire, w1_gpio and w1_therm kernel modules. The temperature can be read from /sys/bus/w1/devices/<device_serial_number>/w1_slave.

I’m using the the sensor for outdoor temperature measurement. I soldered about 1 m wire to the sensor (TO92 housing), insulated the solder joints with heat shrink tube and embedded the sensor into an old metal ballpoint cap using epoxy glue.

WiFi trouble with smsc95xx

In the /var/log/messages file of my Raspberry Pi, which is connected through WiFi to my home WLAN, I repeatedly noticed this error message:

smsc95xx 1-1.1:1.0 eth0: unexpected urb length 0

Furthermore, I got “no route to host” messages when attempting to ssh to my  RasPi. At the same time I couldn’t connect to lighttpd. Some research with Google suggested, that there might be a problem with the USB driver. Symptoms are characterized by fluctuating transfer rates and response times as well as bad WiFi connection quality leading to delayed keyboard response or garbled input when using ssh. Fortunately, there is a  workaround:

Continue reading WiFi trouble with smsc95xx