Skip to the content
2 layers104 × 49 mmControl, the printed circuit board in 3D

This project demonstrates motor control using an ACS712 current sensor with an Atmega324PB microcontroller. The microcontroller controls the motor speed and direction based on the current measured by the ACS712 sensor.

Size
104 × 49 mm
Copper layers
2
Thickness
1.6 mm
Parts
49
Nets
64
Pads
186
Tracks, vias
294, 11
Pours
76
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
4 Sep 2023
Updated
4 Sep 2023

Overview

Control is an open-source printed circuit board by mehmetkara7, from the mehmetkara7/DC-Motor-Control repository on GitHub. It is a 2-layer board of 104 × 49 mm with 49 parts on 64 nets, routed with 294 tracks and 11 vias.

It is built around the ATMEGA324PB-AU, L298N and L7812, with the SS24 among its other parts. Its parts include 12 capacitors, 9 resistors, 9 diodes, 6 connectors and 5 ICs. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

4

README

README.md

DC-Motor-Control

Motor Control with ACS712 Current Sensor and Atmega324PB Microcontroller

This project demonstrates motor control using an ACS712 current sensor with an Atmega324PB microcontroller. The microcontroller controls the motor speed and direction based on the current measured by the ACS712 sensor.

Components

  • Atmega324PB microcontroller
  • ACS712 current sensor
  • Motor driver circuit
  • Buzzer
  • Relay
  • Other necessary components (e.g., resistors, capacitors, power supply)

Getting Started

  1. Clone or download this repository to your local machine.
  2. Connect the components as shown in the circuit diagram.
  3. Compile and upload the code to your Atmega324PB microcontroller using an AVR programmer.
  4. Power up the circuit and observe the motor control based on current readings.

Code Explanation

  • setup(): Initializes the microcontroller pins and sets up the Timer/Counter1 for PWM control.
  • setMotorSpeed(uint8_t speed): Sets the motor speed using PWM (Pulse Width Modulation).
  • forward(), backward(), stop(): Functions to control the motor direction.
  • turnOnRelay(), turnOffRelay(): Functions to control the relay.
  • turnOnBuzzer(), turnOffBuzzer(): Functions to control the buzzer.
  • readACS712(): Reads the current value from the ACS712 sensor.
  • main(): The main control loop that reads current values and adjusts motor control accordingly.

Usage

Modify the code as needed to adjust the current threshold for motor control and the motor speed settings.

c
if (adcValue > 512) {
    // Current threshold exceeded, take action (e.g., stop motor and sound buzzer)
} else {
    // Current within the acceptable range, adjust motor speed and direction as needed
    // Example: forward(), setMotorSpeed(speed), _delay_ms(delay);
}

Parts

49
QtyValueFootprintReferences
5100nFCapacitor_SMD:C_0805_2012MetricC2, C3, C4, C5, C11
4D_SmallDiode_SMD:D_SMBD1, D2, D3, D4
310KResistor_SMD:R_0805_2012MetricR9, R12, R16
218pFCapacitor_SMD:C_0603_1608MetricC6, C7
21KResistor_SMD:R_0805_2012MetricR11, R14
21nFCapacitor_SMD:C_0805_2012MetricC12, C13
2220ufCapacitor_SMD:CP_Elec_8x6.7C9, C10
22N7002Package_TO_SOT_SMD:SOT-23Q1, Q2
2LED_SmallLED_SMD:LED_0805_2012MetricD11, D13
1120RInductor_SMD:L_1206_3216MetricFB1
116MHzCrystal:Crystal_SMD_5032-4Pin_5.0x3.2mmY1
11MResistor_SMD:R_0805_2012MetricR4
11kResistor_SMD:R_0805_2012MetricR13
11uFCapacitor_SMD:C_0805_2012MetricC1
12K2Resistor_SMD:R_0805_2012MetricR15
14K7Resistor_SMD:R_0805_2012MetricR1
16x6 SMDButton_Switch_SMD:SW_SPST_CK_RS282G05A3SW1
1ACS712Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU6
1ATmega324PB-APackage_QFP:TQFP-44_10x10mm_P0.8mmU1
1BuzzerBuzzer_Beeper:Buzzer_12x9.5RM7.6BZ1
1Conn_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ3
1Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ10
1G2RL-2Relay_THT:Relay_DPDT_Omron_G2RL-2K1
1I2CConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1
1ISPConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ5
1L298NPackage_TO_SOT_THT:TO-220-15_P2.54x2.54mm_StaggerOdd_Lead4.58mm_VerticalU2
1L7812Package_TO_SOT_SMD:TO-252-2U4
1LED_SmallLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD12
1LM78M05_TO252Package_TO_SOT_SMD:TO-252-2U5
1LOGOGOFootprint:formulaG***
1POWERTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ6
1SM712_SOT23Package_TO_SOT_SMD:SOT-23D9
1SS24Diode_SMD:D_SMBD5
1UARTConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ7

Similar boards

  • 2 layers68.8 × 68.1 mmSmartSensor, the printed circuit board in 3D

    SmartSensor

    AvansETI/SmartSensor

    SmartSensor: a sensor to be used as sensor and actuator within existing buildings.

    68 parts2GPL-3.0
  • 2 layers92 × 117 mmMicroLevelFour, the printed circuit board in 3D

    MicroLevelFour

    kvasilak/MicroLevel4PCB

    PCB files for MicroLevel 4

    144 parts
  • 2 layers100 × 70 mmWobbly, the printed circuit board in 3D

    Wobbly

    syic0o/wobbly-pcb

    102 parts
  • 2 layers24.4 × 64.5 mmArduino nano324, the printed circuit board in 3D

    Arduino nano324

    tomaskovacik/hw

    HW (pcb, schematics etc) for my projects

    51 parts27
  • 4 layers38 × 39 mmCLN17-V1.5, the printed circuit board in 3D

    CLN17-V1.5

    creapunk/CLN-ClosedLoopNemaDriver

    Compact closed-loop stepper motor driver designed for NEMA motors

    103 parts1.1k
  • 2 layers87.5 × 70 mm010 Implementation, the printed circuit board in 3D

    010 Implementation

    NewTec-GmbH/esp32-can-iot

    A ESP32 based interface between CAN-bus and IoT environments.

    70 parts51BSD-3-Clause
  • 4 layers44 × 44 mmHSLinkPro, the printed circuit board in 3D

    HSLinkPro

    cherry-embedded/HSLink-hardware

    A place to release hslink hardware

    155 parts44Apache-2.0
  • 4 layers100 × 100 mmRpi pico printer board, the printed circuit board in 3D

    Rpi pico printer board

    jackw01/pi-pico-printer-board

    Tinkerer-friendly Klipper compatible 3D printer control board using Raspberry Pi Pico

    224 parts42CERN-OHL-W-2.0

Questions

How big is the Control PCB?

It measures 104 × 49 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Control use?

49 parts, built around the ATMEGA324PB-AU, L298N, L7812 and SS24. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Control KiCad files?

From the mehmetkara7/DC-Motor-Control repository on GitHub, at the commit this page was made from: the board is control/control.kicad_pcb and its schematic control/IC.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Control design in my own project?

Its repository states no licence, so its author keeps all rights: ask mehmetkara7 before reusing the design.