A Makeshift Tilt-Head for my Raspberry Pi Camera

IMG_3558

I want a pan/tilt scheme for the camera of my Raspberry Pi based home monitor robot. But rather than use a pan/tilt bracket with two servos, I thought I could simplify things by using one servo for titling the camera and using the robot chassis swivel to pan the camera.

Continue reading

Ultrasonic sensor HC-SR04 with Dagu Mini Driver on a Robot Chassis

photo(8)

I am working on a Raspberry Pi based robot, and recently acquired a Dagu chassis and a Dagu Mini Driver for this project. As soon as I had the mini driver hooked up and the wheels starts turning, I felt an irresistible urge ;-) to put an ultrasonic sensor on the chassis and have it roam around by itself.

Continue reading

Designing an Op-Amp Circuit to Detect LDR Pulses

data-slicer-osc

The Problem

I wanted to design a circuit to generate a nice digital pulse (for input to a microcontroller or the Raspberry Pi) every time an LDR is quickly obscured from ambient light – like for instance, when you pass your hand over it. I didn’t want to use the popular solution of reading the analog values, and processing it on the microcontroller (averaging, finding peaks, etc.), because this will take up valuable processing time, and I want to avoid lag as much as possible, by offloading this work to hardware.

So here are 3 attempts that I made, and the results.

Continue reading

Backing up your Raspberry Pi code using rsync

rsync

This is how I develop code on my Raspberry Pi:

ssh into the Pi from my Macbook Pro from 2 Terminals, and use emacs on one to edit the code, while I run the code from the other. This way I don’t need to use the annoyingly slow X-server or VNC solutions to display UI from the PI for editing.

Continue reading

Raspberry Pi I2C communications with CAT9532 16-bit Programmable LED Dimmer

I have a couple of servos on a pan/tilt bracket that I want to control from my Raspberry Pi. As I started looking at options, I read about the Adafruit 16-channel servo driver. This board is not available where I live, and I got curious about chips that generate PWM signals that could be configured via the I2C protocol. I found a cheap one (less than 2 USD) on element14 – the CAT9532 16-bit Programmable LED Dimmer chip from Catalyst Semiconductor.

This is a short post on communicating with the CAT9532 from a Raspberry Pi using Python and the smbus module.

Continue reading

Preventing Raspberry Pi WiFi from going into Sleep Mode

I keep logged into my Raspberry Pi from my Mac. The Pi is connected to my network using a USB WiFi adapter. But when I leave the login idle for a while, I find it to be (a) frozen and (b) I cannot login via a new ssh session – in fact, I can’t even ping the Pi anymore.

I found the solution for problem (b) above in a StackOverflow post.

This is what you need to do:

Continue reading

A simple Python matplotlib implementation of Conway’s Game of Life

I was recently reading about Conway’s Game of Life – a cellular automaton discovered by British mathematician John Conway in 1970. Using 4 simple rules, his system creates complex patterns as it evolves over time. You can read more about this here.

I took a crack at implementing this in Python, using matplotlib to plot the system as it evolves. Note that there are much better optimized ways of doing this, and a lot of mind-bogglng research has been done in this area. But still, I found it fun to implement this, and it’s fascinating to stare at the screen as patterns like gliders and blinkers evolve and disappear.

Continue reading