Pimoroni Tiny2040 turns a vibration motor ON and OFF

Description: A vibration motor alternates turning ON and OFF for 1 second with a Pimoroni Tiny 2040.

Pimoroni Tiny2040 turns ON and OFF a vibration motor

Notes: To prevent back EMF, a 1N4004 Rectifer Diode is placed between the motor and the pins. The onboard RGB LED appears to be illuminating by default, and can be turned off by putting the pins 20, 19, and 18 to HIGH.


1 – Breadboard 400 Points
1 – Pimoroni Tiny 2040
1 – 1N4004 Rectifier Diode   >> Link <<  
1 – Vibration Motor 1.5-3V 8000-16000RPM   >> Link <<

Arduino Code:

#define motor A2

void setup() {

  pinMode(motor, OUTPUT);

  // Onboard RGB LED Pins
  pinMode(20, OUTPUT);
  pinMode(19, OUTPUT);
  pinMode(18, OUTPUT);

  // Turns OFF the onboard RGB LED
  digitalWrite(20, HIGH);
  digitalWrite(19, HIGH);
  digitalWrite(18, HIGH);


void loop() {

  digitalWrite(motor, HIGH);
  digitalWrite(motor, LOW);


Leave a Comment

54 − 44 =