Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino-Controlled Motor with Encoder Feedback and Data Logging

Image of Arduino-Controlled Motor with Encoder Feedback and Data Logging

Circuit Documentation

Summary

This document provides a detailed overview of a circuit that includes an Arduino UNO as the central microcontroller, interfaced with various sensors, a motor driver, a gear motor with an integrated encoder, a real-time clock (RTC), an SD card module, and a pushbutton. The circuit is powered by DC power sources and includes a current sensor for monitoring electrical current. The Arduino UNO is programmed to interact with these components, and the code for the microcontroller is included in this documentation.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

Pushbutton

  • A simple switch mechanism for controlling some aspect of a machine or a process.

Gear Motor with Integrated Encoder

  • An electric motor combined with a gear reduction system.
  • It includes an encoder for providing feedback on the motor's speed and position.

L298N DC Motor Driver

  • An integrated monolithic circuit in a 15-lead Multiwatt and PowerSO20 packages.
  • It is a high voltage, high current dual full-bridge driver designed to accept standard TTL logic levels.

DC Power Source

  • Provides the electrical power to the circuit.

USB Power

  • Power supply through a USB interface.

ACS712 Current Sensor 5A 20A 30A

  • A hall effect-based linear current sensor.
  • It provides a voltage output that is proportional to the AC or DC current flowing through the sensor.

Inductive Sensor

  • A non-contact sensor that detects metallic objects.

RTC DS3231

  • A low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal.

SD Module

  • A module that allows reading and writing to an SD card using a microcontroller.

Wiring Details

Arduino UNO

  • 3.3V connected to RTC DS3231 VCC
  • GND connected to multiple components' ground pins
  • A0 connected to ACS712 Current Sensor OUT
  • A1 connected to Inductive Sensor Signal
  • A2 connected to Inductive Sensor Signal
  • A4 connected to RTC DS3231 SDA
  • A5 connected to RTC DS3231 SCL
  • D13 connected to SDmodule SCK
  • D12 connected to SDmodule MISO
  • D11 connected to SDmodule MOSI
  • D10 connected to SDmodule CS
  • D8 connected to Pushbutton Pin 2 (in)
  • D4 connected to L298N DC motor driver IN2
  • D3 connected to L298N DC motor driver IN1

Pushbutton

  • Pin 2 (in) connected to Arduino UNO D8

Gear Motor with Integrated Encoder

  • MOTOR - connected to L298N DC motor driver OUT2
  • MOTOR+ connected to L298N DC motor driver OUT1
  • Encoder - connected to GND
  • Encoder + connected to VCC

L298N DC Motor Driver

  • OUT1 and OUT2 connected to Gear Motor
  • 12V and GND connected to DC Power Source
  • 5V-ENA-JMP-I shorted to 5V-ENA-JMP-O
  • IN1 and IN2 connected to Arduino UNO D3 and D4

DC Power Source

  • Ground connected to GND of various components
  • Positive connected to VCC of various components

ACS712 Current Sensor 5A 20A 30A

  • VCC and GND connected to DC Power Source
  • OUT connected to Arduino UNO A0

Inductive Sensor

  • Signal connected to Arduino UNO A1 and A2
  • VCC and GND connected to DC Power Source

RTC DS3231

  • VCC and GND connected to Arduino UNO 3.3V and GND
  • SDA and SCL connected to Arduino UNO A4 and A5

SD Module

  • CS, SCK, MOSI, MISO connected to Arduino UNO D10, D13, D11, D12
  • VCC and GND connected to DC Power Source

Documented Code

Arduino UNO Code (sketch.ino)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

This code is a template for the Arduino UNO microcontroller. The setup() function is called once when the microcontroller is first powered on or reset. It is used to initialize the environment. The loop() function is called repeatedly and contains the main logic of the program. The actual implementation details will depend on the specific requirements of the circuit's operation.