ATTINY Neural Network

Here are my tryout on making neural network using ATTINY85 chip as single neurons and connecting them via optic fibers and sending “fire” information between two neurons using LED and LDR.

To start with, I went through bunch of ANN tutorials and made a python version. here are the code >>

The example I am using here is the one with the flower petals. To be able to input the petal size to the microcontroller version, I have converted the scale of 0-1.0 using height as 0-8cm and width as 0-3cm. here is the python code that I used for simulating it.

Then I tried with ATTINY to see if I can convert each of the neurons behavior to microcontrollers so I can run it as physical microcontroller network. At first, I tried with ATTINY45, but the memory space run out. Now I am using ATTINY85 and it seems fine. For future, I may have to upgrade to ATTINY84 to get more pins as the network gets complex.

ATTINY neural net Prototypes ATTINY neural net Prototypes neural net test

The Arduino code for this forward propagation is here >>

The first experiment is only with forward propagation with weights and bias already calculated in the python simulation. Now I am adding the possibility to back propagate. For this, I am adding two buttons to tell the correct answer, and also this is the cue to “learn” mode. I am not sure how well it is learning, but after a while of “training” it seems to improve its guess.

back propagation test back propagation test back propagation test back propagation test

Here is the code for back propagation:
output neuron with UNO >>