Beam Robot

Most of the BEAM robots I've seen on the net are using hardware analog electronics. It seemed that a PIC would work very well for this kind of project.  Very little extra circuitry is needed to do both forword and backword walking sequences along with a few other tricks.

The PIC16F818 has a lot of features that work well in this situation.  As you can see from the Schematic and Source Listing, position pulses for the 2 servos are generated dirctly from the PIC.  Also, the room light level, battery condition, and servo power draw (indicating mechanical loading) can be measured with the internal A/D.

The battery condition (although not yet in the software) can be determined by reading voltage accross the LED.  Since this voltage is (somewhat) constant, reading it actually measures the VCC to the PIC, which is where it gets its reference voltage.  A higher reading on the LED means the battery voltage is lower.

In its present state, this device powers up and measures the room light level then goes into low power mode (no power to servos, LED, or photo sensor) at 32 khz internal clock.  About once a second, it 'wakes up' and checks the light level.  If it finds a significant change, it cycles five steps forward, five steps back, and then shuts back down.