The Photosaur loves light! In the dark it’s eye is red, the darker it is, the brighter the eye. When it gets light, it becomes happy and wags it’s tail. The more light it gets, the happier it is!
Arduino Sketch: AnalogTester
I got some hints on how to code servo output from the built in tutorial, “sweep” which sweeps a servo from left to right. The big challenge was how to increase the speed of the tail. at first I tried decreasing the delay, but ended up using a constant delay but increasing the angle that the tail tried to move over the same period of time.
The circuit diagram is below:
The two LEDs (one red, one green) for the eye are connected to pins 6 and 11, and setup using the normal circuit diagram from class. The photoresistor is connected using the diagram from class, and connected to pin 0 (analog input). The servo is connected to power and ground, and then the input wire (the yellow wire leading to the servo) is connected to pin 9.
The circuit is mounted using gold perf board. Basically, you insert an element through a hole in the perf board, bend the wire at a 90 degree angle, and then solder it to the board on the side with the metal.
Good rules of thumb: make sure the hole is completely filled with solder to ensure a solid connection, and make sure you plan your layout beforehand. It helps reduce mistakes. Also one trick is that you can bend the left over wire in the direction of future or existing connections to save solder. This helps connect one hole to another.
I then mounted the perf board to the back of a plastic casing using two 4-40 screws. The servo is mounted to the casing using two right angle orbit mounts. They connect to the servo, and then can be connected to something at a right angle to the output shaft of the servo. I cut a hole for the tail using a dremel with a cutoff disk. The tail is made from old wire, hot-glued to the servo output mount.
The LEDs and the photoresistor are connected to the casing by drilling holes for the leads and then hot-gluing the leads to the inside of the casing. The “eye” is half of a ping pong ball, hot glued to diffuse the LED light.