

MotorSpeedController
setup() { ... // Init SPI SPI.begin (); SPI.setClockDivider(SPICLOCKDIV4);
- Copper layers
- 2
- Thickness
- 0.8 mm
- Parts
- 24
- Nets
- 19
- Pads
- 133
- Tracks, vias
- 122, 23
- Pours
- 6
- Routed
- Yes
- KiCad
- KiCad 6 (file 20211014)
- Created
- 17 Jan 2021
- Updated
- 4 Mar 2022
Overview
MotorSpeedController is an open-source printed circuit board by sdsmt-robotics, from the sdsmt-robotics/MotorSpeedController repository on GitHub. It is a 2-layer board with 24 parts on 19 nets, routed with 122 tracks and 23 vias.
It is built around the ATMEGA328P-AU and MC7805CT. Its parts include 9 capacitors, 3 resistors, 3 ICs, 3 diodes and 2 connectors. It belongs with the AVR (ATmega, ATtiny) boards of this library.
Main components
2README
README.mdMotorSpeedController
yaya.
Hardware
Software
Contains code for the controller itself and code for a master device to interface with the controller.
- controller - Code for the speed controller itself.
- controllerInterfaceLib - Library files for use on a master device to interface with the controller.
Wiring Connections and Interface
This controller uses standard SPI communications.
| Arduino | Speed Controller |
|---|---|
| 5V | 5V |
| GND | GND |
| MOSI | MOSI |
| MISO | MISO |
| SCK | SCK |
| SS* | SS |
*The SS pin must be used for at least one of the connections. Additional speed controllers may use other digital IO pins.
Status LED
The green LED on the board will indicate state of the controller. The key is as follows.
| State | Pattern |
|---|---|
| Off | --------- |
| Brake | -__-__-__ |
| Speed Control | --__--__-- |
| Power Control | --_--_--_ |
| Timeout | -_-_-_-_- |
Interface Lib Usage
Create:
Create an instance of the class.
Nidec24hController motor(SPI, ssPin); SPI - the SPI singleton object from the SPI.h library.
ssPin - pin to use as chip select. Should simply be SS for first controller.
Initialize:
Create an instance of the class.
setup() {
...
// Init SPI
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV4);
//Init motor controller
motor.init();
...
}Set Speed:
Set the speed for the motor in RPM. Negative values are allowed. This will switch the motor to speed control mode if in power control mode or braking.
motor.setSpeed(speed); speed - the speed for the motor in RPM.
Set Power:
Set the power for the motor (-1000 to 1000). This will switch the motor to power control mode if in speed control mode or braking.
motor.setPower(power); power - the power for the motor (-1000 to 1000).
Brake:
Engage the electronic braking and stop the motor..
motor.brake(); Set Direction Inverted:
Set whether the motor control should be inverted.
motor.invertDirection(invertDir); invertDir - boolean to set if direction should be inverted.
Get Current Speed:
Get the current speed of the motor in RPM.
motor.getSpeed(); Get Current Power:
Get the current power the motor is running at. If in speed control mode, this will be varied automatically by the PID algorithm.
motor.getPower(); Get the Target Speed:
Get the target speed the controller is attempting to regulate the motor at.
motor.getTargetSpeed(); Parts
24| Qty | Value | Footprint | References |
|---|---|---|---|
| 5 | 0.1uF | Capacitor_SMD:C_0603_1608Metric | C3, C5, C6, C7, C8 |
| 3 | MountingHole_Pad | MountingHole:MountingHole_3mm_Pad_Via | H1, H2, H3 |
| 2 | 10k | Resistor_SMD:R_0603_1608Metric | R2, R3 |
| 2 | 1uF | Capacitor_SMD:C_0603_1608Metric | C1, C9 |
| 2 | 22pF | Capacitor_SMD:C_0603_1608Metric | C2, C4 |
| 2 | LED_Small_ALT | Diode_SMD:D_0603_1608Metric_Castellated | D1, D2 |
| 1 | 16MHz | Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm | Y1 |
| 1 | 1k | Resistor_SMD:R_0603_1608Metric | R1 |
| 1 | AS5134 | MotorSpeedController:SOIC-20 | U2 |
| 1 | ATmega328P-AU | Package_QFP:TQFP-32_7x7mm_P0.8mm | U1 |
| 1 | Conn_01x05_Female | Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_Vertical | J2 |
| 1 | Conn_01x08_Female | Connector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_Vertical | J1 |
| 1 | D_Small | Diode_SMD:D_2010_5025Metric_Castellated | D3 |
| 1 | MC7805 | Package_TO_SOT_SMD:TO-252-2 | U3 |
Questions
What parts does the MotorSpeedController use?
24 parts, built around the ATMEGA328P-AU and MC7805CT. 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 MotorSpeedController KiCad files?
From the sdsmt-robotics/MotorSpeedController repository on GitHub, at the commit this page was made from: the board is Hardware/MotorSpeedController.kicad_pcb and its schematic Hardware/MotorSpeedController.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the MotorSpeedController design in my own project?
Its repository states no licence, so its author keeps all rights: ask sdsmt-robotics before reusing the design.
Similar boards
- 2 layers113 × 49 mm

- 2 layers60 × 98 mm

ENNOID Dual Gate Driver
jagdeepsingh02/ENNOID-Dual-Gate-Driver
Dual Gate Driver for IGBT or Mosfet modules
146 parts5 - 2 layers

- 4 layers100 × 100 mm

- 4 layers266.7 × 123.2 mm

- 2 layers43.5 × 29 mm

- 2 layers80 × 110 mm

NucDeck Left Controller PCB
dmcke5/NucDeck
The Open Source DIY Handheld Gaming PC!
59 parts561CERN-OHL-S-2.0 - 2 layers50.5 × 128.5 mm
