Step 1: The Search For Serpent Parts
1. One Arduino Whatever (any model should work). I used a Micro
2. One analog servo motor. Mine is a Tower Pro SG90 with 180 degree sweep
3. One PING ultrasonic distance sensor
4. One battery holder with batteries. Mine is 6V total, but Arduino recommends 7-12 volts for stability
5. A bread board or PCB for wiring
7. One small zip-tie
8. One snake head
9. Some tape
Step 2: Snake Brains
The way it works is the following:
1. Ping ultrasonic sensor reads the distance of your hands or objects in front of it 50 times per second
2. If close enough, the servo motor is rotated down towards your hand.
As the code works now, the "Cobra head" does not sit and wait for your hand to get too close, but instead it moves based on your distance. So the closer you get, the lower it drops to get you.