This week, I made a vehicle that orients to light, inspired by Valentino Braitenberg's Vehicles: Experiments in Synthetic Psychology book.
My vehicle has two sensors and two wheels, and reacts to its environment. I started off with Neil's 'servo' board, and added leads for two phototransistors. Here's my .cad file and board:
I also laser-cut a body and wheels, according to this .cad/.ko file :
There were lots of parts to put together, and I wasn't sure anything would work:
Once it was all together, I modified Neil's code to get this .c code and used Neil's makefile. After much debugging, it orients to light:
Perhaps I'll try more 'synthetic psychology' for my final project. I hadn't originally realized that the servo motors don't rotate a full turn. I'd like to make a light-approacher, not just a light-orienter. It would fun to make several vehicles to interact with each other, Also, I'd like to try other sensors and output devices, and different connection rules.
Valentin gave me advice about making a vehicle that can move forward, instead of just orient 60 degrees. I could use a DC motor, controlled with pwm from one of the attiny pins to a transistor. But there are two problems with that. One is that the motor will only go in one direction, but you can solve that by using a H-bridge. The other problem is that the DC motor moves very quickly. So, you can dissect out the circuit from a servo motor, which uses gears to move slower and stronger, and then just connect power and ground to the motor, and control this via a transistor (or a H-bridge). You also have to break off the blocker on one of the gears, so the travel is no longer limited.