ATTINY Neural Network version2

this time, I am trying out bigger network. 4 sensor input from the glove sensed by 2 attiny as input layer, 4 hidden layer1, 3 hidden layer2, and 3 output layer to recognize 3 different hand gestures.

The network is first prototyped and tested on python. here is the python code >>

The data used in this code is taken from a glove I made, equipped with 4 textile bend sensors on fingers (thumb, index, middle, ring) and collected by me doing these gestures. The input range is 0-1023 as arduino works with 10bit for analog inputs. here are the original data >>

schematics and materials, breadboard prototypes
schematic materials glovesbreadboard prototype

single neuron embroidery test with SMD parts.

embroidery circuit test embroidery circuit test embroidery circuit test smd parts on thread test

Draping on a doll to sketch the sleeve design

sleeve design test sleeve design test sleeve design testsleeve design test

Placement on the fabric. IC socket is embedded in the felt to reduce the height and connections are made with copper conductive thread (Karl Grimm thread) for further embroidery connection. back of the felt is enforced with hot glue to protect the solder joints.

placement on the fabric placement on the fabric felted sockets IMG_5856 felted socket with IC felted socket with IC

I added drop of hot glue on the LDR to create diffuse layer on it so the light gets distributed from the thin optic fiber outlet. It also helps to keep the optic fiber in place. On LED side, I needed to place more than one optic fiber on one LED. Connection between optic fibre and LED, LDR is made with black shrink tubes. It takes quite long time to make these necessary parts.

LDR with hot glue shrink tube, 3.2mm LED + optic fibre LDRparts optic fibre + led + ldr

All the LED-LDR parts are tested with 55-255 PWM and listed so it can be used for calibration for each neuron later.

The process of embroidering. it is tricky to keep the fiber in right places.

embroidery process embroidery process embroidery process embroidery process

The embroidery process is finished.

embroidery process embroidery process

I had a meeting with Ben (the pattern maker) to see the possible ways to make a garment with this technique. The fabric does not drape as well as I thought due to the fiber optic’s stiffness.

possible sleeve drape possible sleeve drape possible sleeve drape

necessary components (resister, capacitor) are added onto the embroidery. I chose to use SMD components and directly soldering onto the copper thread and cut the extra connection. It is finicky to work with, but manageable.

SMD components on the embroidery SMD components on the embroidery SMD components on the embroidery SMD components on the embroidery

finished embroidered ANN

SMD components on the embroidery SMD components on the embroidery details details

Now ATTINY85 (set as 1MHz internal clock) is programmed with USB TINY programmer. 2 of the input neurons have this code ( and the other hidden/output layers are programmed with this code ( For hidden layer neurons, one need to change the nodeNumber to match the position/connection of the neuron in the network. I have collected the glove’s sensor input data with arduino and used it to train the Python simulator (

programming ATTINY as a neurone programming ATTINY as a neurone debug tool with attiny and ftdi glove sensor recorder with 3 buttons

After few tweeking and debugging, it seems to work quite ok. The “scissor” gesture is not very well recognized… it only works sometimes. I am not sure if it is due to bad connection on the circuit or not well calibrated LDR or specific optic fiber that came out and not seeing the light well… But for now I am very happy with how it came out. I like the slow delay between the change of gesture and the result/light.

embroidered ANN embroidered ANNembroidered ANN embroidered ANN
embroidered ANN test
embroiderd ANN test

The problem was simply a power problem. I have all the microcontrollers connected in parallel and the last in the chain (the output layer) was lacking current. Now I added few more lines (electrical connection) of power and ground to the last in chain, and it works fine. It can recognize all 3 gestures (paper rock scissors) smoothly.