Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

Arduino Nano Neural Network Project

⚡️ Note:
This Arduino sketch demonstrates a simple artificial neural network (ANN) that learns to recognize patterns using backpropagation. It includes Ethernet initialization for potential network connectivity, though the main focus is on training the neural network with example input/output data. Training progress and results are displayed via the serial terminal, making it easy to monitor how the ANN learns over time.

Perfect for experimenting with basic neural networks on Arduino hardware!


Welcome to the Arduino Nano Neural Network Project! This guide provides detailed instructions and information on setting up a neural network using an Arduino Nano and ENC28J60 Ethernet module.


Table of Contents

  1. Support and References
  2. Project Overview
  3. Required Hardware
  4. Code Explanation
  5. Additional Resources
  6. Stay Tuned

Support and References

Support the UniversalBit Project and explore related topics:


Project Overview

This project demonstrates how to set up and train an artificial neural network using an Arduino Nano. The network is configured to process inputs, calculate outputs, and optimize weights using backpropagation.

Key features include:

  • MAC Address Configuration: Customize the network using a unique MAC address.
  • Network Training: Use training patterns to achieve a low error rate.
  • Real-time Monitoring: Display network training progress via the serial terminal.

Required Hardware

To build this project, you need the following:

  1. Arduino Nano
  2. Mini ENC28J60 Ethernet Module

Arduino Nano and Ethernet Module


Code Explanation

Overview

The provided Arduino script includes the following:

  • Network Configuration: Set up IP addresses, MAC addresses, and server details.
  • Neural Network Architecture:
    • Input Nodes: 7
    • Hidden Nodes: 8
    • Output Nodes: 4
  • Training Parameters:
    • Learning Rate: 0.3
    • Momentum: 0.9
    • Success Threshold: 0.0004

Example MAC Address

byte mac[] = { 0xDE, 0xAF, 0xCF, 0xEF, 0xFE, 0xBD };

Training Data

Input and target patterns for training:

const byte Input[PatternCount][InputNodes] = {
  { 1, 1, 1, 1, 1, 1, 0 },  // 0
  { 0, 1, 1, 0, 0, 0, 0 },  // 1
  { 1, 1, 0, 1, 1, 0, 1 },  // 2
  ...
};

const byte Target[PatternCount][OutputNodes] = {
  { 0, 0, 0, 0 },
  { 0, 0, 0, 1 },
  { 0, 0, 1, 0 },
  ...
};

Training Loop

The training loop randomizes input patterns, calculates errors, and updates weights using backpropagation:

for (TrainingCycle = 1; TrainingCycle < MAX_CYCLES; TrainingCycle++) {
  // Randomize input patterns
  // Compute activations
  // Backpropagate errors
  // Update weights
}

Serial Monitoring

Monitor training progress and outputs via the serial terminal:

void toTerminal() {
  Serial.print("Training Pattern: ");
  Serial.print(p);
  Serial.print(" Output: ");
  for (i = 0; i < OutputNodes; i++) {
    Serial.print(Output[i], 5);
    Serial.print(" ");
  }
}

Full Code

For the full implementation, refer to the script provided in this repository.


Additional Resources

Explore related references:

  1. Ethernet Client Library
  2. Ethernet Reference Documentation
  3. Arduino Neural Network Guide

Stay Tuned

Stay updated with the latest developments in this project!

Voice Cloning Example