Simple Genetic Algorithm (1 LED + 1 Light Sensor)

Hey guys,

I want to write a simple GA for the Arduino that involves an actuator and a sensor.

Let's say I have an LED and a light sensor. The algorithm is able to control the brightness of the LED.
I want to maximize the light that is picked up by the light sensor.

In other words, this thing should evolve into figuring out that it should give maximum brightness to the LED. (and therefore maximizing the light picked up by sensor).

Is this difficult to do?
I have no idea where to start.

Thanks in advance.

Sure, how much do you know about genetic algorithms?

It is a lot of overkill for this application.

Yeah I know the basics and the concept about GA. I learnt about it in a Machine Learning module at uni.
But never programmed it.

I know it probably is an overkill. But I have more complicated/interesting plans (involving servos and pressure sensors). This is just to get the hang of using a GA first.

I looked at this paper: [1002.2012] Implementing Genetic Algorithms on Arduino Micro-Controllers
But it seems too complicated, and I couldn't get the files too run.
Thought there might be a simpler way.


This is pretty simple and seems to be doing exactly what you want:

This is pretty simple and seems to be doing exactly what you want:

That is quite helpful. Thanks.
But my main problem is the programming part of it. I was looking for a sample code maybe. Something short and simple (if that's even possible for this kind of application). Or maybe some guidance on how to implement it.

Thanks again.