Lesson 10 Motor

Introduction

Motor is a kind of device, which can transfer electric energy into kinetic energy according to the law in electromagnetic induction. In this experiment, we are going to use a switch to control the start and stop of a motor.

What you need

  • micro:bit board
  • Micro USB Cable
  • micro:bit breadboard adaptor
  • Breadboard
  • 5V DC Motor
  • TIP120 NPN Transistor
  • 1N4007 Diode
  • 100 Ohm resistor
  • 2x Alligator Clips
  • Male to male jumper wires

DC Motor

Motor is a kind of device that can transfer electric energy into kinetic energy according to the law of electromagnetic induction. Motors have a lot of applications in commercial and industrial areas. In our experiment, the motor we use is DC motor. When we supply DC voltage to the two terminals of the motor, it will rotate in a direction. The higher the voltage, the faster it rotates.

Diodes

Diode is a kind of component with two polarities: one is for positive and the other is negative. It allows current to move from the positive end to the negative end only. We can regard it as an electronic check valve.
For common diode, we can judge from the color of tube for its polarity. The terminal with white color is negative polar. We typically use diodes with motors because of the motor characteristic, sometimes some negative energy will go backwards through the circuit and this diode will prevent that from happening.

Alligator Clips

Similar to the usage of jumper cables, alligator clip wire are used when some components are not suitable to use jumper cable for connection.

In this experiment, we use alligator clip wire to connect our motor.

Hardware Connection

Please complete hardware connection according to the breadboard diagram below.

The drive current on micro:bit IO port is too feasible to connect to the motor directly. At this time, we have to use a transistor to amplify the current of IO port. The circuit diagram of using transistor to amplify current on IO port is very similar to the circuit diagram of our last lesson “micro:bit Experiment 09 Buzzer ”. The only difference is the motor has two diodes on its both terminals. And the diode in this circuit is called Freewheel Diode.

Within the motor, there is a coil. When current flows through the coil, it will produce induced electromotive force on the both terminals. When current is removed, the induced electromotive force will generate backward voltage to the components in the circuit (It might damage these components). Freewheel diode connects the two terminals of the coil in anti-parallel. When we cut off the power supply of the inductance coil, the induced electromotive force will not disappear immediately and the residual force will be released by the diode. This is a typical design of component protection.

Below is the partial circuit diagram of the usage of triode in amplifying the IO port current.

After connecting the circuit, you will see:

Programming

Please open Microsoft Makecode, write your code in the edit area.

Of course, you can download the whole program from the link below.

Link of the whole program: https://makecode.microbit.org/_Kid26LToz2mU

Code Explanation

In the software aspect, this experiment do not have new knowledge points. The thing we have to pay special attention to is P1 port connect button. Under block “on start”, we have to set P1 to be up mode, or it can not recognise button signal properly.

Results

Press down the button, the motor starts rotate. Press again, it will stop move.
Attention: The voltage of micro:bit power source is low. It is 3V only. Press down the button, the motor may not start. If this happened, please stir the fan blade of the motor so that it can move properly.

Taking it further

If we want to use potentiometer to control the motor speed, then how would you design the circuit and program it?

micro:bit Starter Kit Lessons

  • Lesson 01 – LED
  • Lesson 02 – Button
  • Lesson 03 – Trimpot
  • Lesson 04 – Photocell
  • Lesson 05 – RGB LED
  • Lesson 06 – Self-lock Switch
  • Lesson 07 – Temperature Sensor
  • Lesson 08 – Servo
  • Lesson 09 – Buzzer
  • Lesson 10 – Motor
  • Lesson 11 – Rainbow LED
  • Lesson 12 – Accelerometer
  • Lesson 13 – Compass
  • Lesson 14 – Ambient Light

 

First published at 3:45pm on July 9, 2019
Last updated at 3:45pm on July 9, 2019