-
1Step 1
Gather Ingredients
- 1 x Microcontroller: Atmel ATTiny85, Arduino or compatible
- 1 x Power Supply: Appropriate for controller (or USB power)
- 1 x AVR Programmer (for ATTiny) or equivalent
- One or more organs for your robot (See Note)
- Servos, DC motors, actuators
- Light sensors, motion sensors, sound sensors
- Contact switches, capacitance sensors
- Whatever you dream up!
- Breadboard, perf board and appropriate hookup wires
Special Beta Note: A PIR is Required for Expected Behavior
-
2Step 2
Load IQ Zero onto Controller
Use your programmer to flash the latest version of IQ Zero to your microcontroller.
Note: At the time of this writing, only the pins 0 through 4 and A1 through A3 will be accessible to the Genetic Algorithm.
That will be more flexible, soon.
-
3Step 3
Connect Your Robot Circuit
This is all up to you. As long as your connect the power and ground pins to your components properly, you can connect any sort of signal pins to any signal pins on the controller.
Honestly it doesn't matter because if the component in question were on another pin, it just would find it eventually anyways.
You may want to test your circuit with some simple code first, just to make sure it all works. Debugging a Genetic Algorithm is not for the weak of heart.
-
4Step 4
Configure the Environment
There will be a whole post on this topic, because in complete contrast to traditional programming, Genetic Algorithms are "configured" by changing the environment in which they evolve.
The types of behavior that arise will depend mostly on these factors:
- The availability of food
- Obstacles to acquiring food
"Food", in the current code, is any event that triggers a sensor attached to pin 4 - but any sensor reading could be used. Each time a sensor attached to that pin is triggered, the GA will consider itself fed.
So positioning a sensor is like arranging the foods available in the forest in which the robot will live. If the sensor only has a small area, or small number of conditions under which it could be triggered, then the forest is barren or at least sparse.
More important, though, are the obstacles you will place in the GA's way. My favorite example is a gradually increasing incline, like a skateboard ramp. For a GA who's "food" is motion, it is easy to score high for the first few inches - but becomes increasingly hard, quickly.
A GA confronted with a situation like this will (if properly designed and operated) inevitably find a way to get as far as it can up the ramp. So if you want a robot that gets up ramps, this is the kind of environment you grow it in.
Thinking carefully about configuring the GA's environment is worth doing, but to be honest open experimentation is the fastest way to really grasp the relationships between these factors and the kinds of results they produce.
Start with simple environments, and expand their complexity gradually. Keep videos to review, and pretty soon you'll be pretty good at coaxing solutions out of Evolution!
-
5Step 5
Let There Be (Artificial) Life!
- Queue some appropriate music
- Turn it on
- Get out of the way
Remember, we have no idea what this thing is going to do. I'm serious, with 65k instructions and logic so convoluted no one could decipher it, it's really capable of anything. You might want some sandbags.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.