Robotics in artificial intelligence and machine learning

This exercise introduces students to the concept of a simple neuron using a line follower robot. We’ll start by creating a basic neuron model with input from a light sensor and output to a PWM-controlled LED.

To understand the basic function of a neuron and how it can be used to control an output device, like an LED, in response to sensor input. This lays the groundwork for understanding how a group of neurons can control a robot.

Steps

  1. Setup the Circuit

    • Connect the light sensor to analog pin A0.
    • Connect the LED to digital pin D6 (PWM capable), with a $220 \Omega$ resistor in series.
    • Make sure to common the ground and supply rail of the breadboard with the Arduino.
  2. Write the Arduino Code

The library neural_network.h can be downloaded here

    #include "neural_network.h"
    const int LIGHT_INPUT_PIN = A0;
    const int OUTPUT_PIN = 6;
    
    Neuron my_first_neuron(LIGHT_INPUT_PIN, -0.5, OUTPUT_PIN);
    
    void setup() {
    }
    
    void loop() {
      Left_neuron.update();
      delay(100);
    }
  1. Experiment and Observe

    • Place different light sources or cover the light sensor to observe how the LED’s brightness changes in response.
    • Discuss how this mirrors the function of a simple neuron, where the input (light sensor) influences the output (LED brightness).
  2. Extensions

    • Replace the LED with a motor to simulate the neuron influencing a motor’s speed for robot movement.
    • Use two neurons: one for each motor, and discuss how this setup can control a line-following robot.

Conclusion

Through this exercise, students gain a foundational understanding of how simple neurons work by transforming input data into an actionable output. By relating this to a line follower robot, they can see a practical application of AI concepts in robotics. This hands-on approach enhances grasping the dynamic nature of artificial intelligence and its real-world implementations.