Benjamin Larralde
Published

Motor Controlled with Arduino

A simple way to control a motor with a potentiometer and an Arduino.

BeginnerProtip46,957
Motor Controlled with Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Motor
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
MOFSET
×1
Resistor 10k ohm
Resistor 10k ohm
×2

Story

Read more

Schematics

Fritzing capture

I drew this by looking at the photo so I'm not 100% sure it's correct.

Full Fritzing file

Wiring

Code

sketch.c

C/C++
sketch.c
#define MOF_PIN 6
#define POT_PIN A1

int pot = 0;

void setup() {
  pinMode(MOF_PIN, OUTPUT);
  pinMode(POT_PIN, INPUT);
  Serial.begin(9600);
}

void loop() {
  pot = analogRead(POT_PIN);
  Serial.println(pot);
  
  analogWrite(MOF_PIN, pot/4);
}

Credits

Benjamin Larralde

Benjamin Larralde

2 projects • 125 followers
Founder @hackster.io, hardware and crowdfunding enthusiast

Comments