3.13 Fan/Motor Module

3.13.1 Overview

The motor adopts HR1124S motor control chip that is a single channel H-bridge driver chip used in DC motors. The H-bridge drive uses PMOS and NMOS power tubes with low on-resistance, ensuring lower power loss and longer safe working time. In addition, its standby and static working current are both low, so it is commonly used in toys.

3.13.2 Schematic Diagram

6-13

Motor control logic table:

IO18

IO17

motor state

HIGH

LOW

forward rotate

LOW

HIGH

reverse rotate

HIGH

HIGH

stop (a gradual stop)

LOW

LOW

brake (a brake stop)

3.13.3 Code Blocks

6-13

This block controls the rotation of the motor. You only need to set motor pins and output levels of the pins.

3.13.4 Test Code

3.13.4.1 Build Code

There are two ways to upload the code: directly open the code file we provide; or manually build blocks.

Directly open the code file we provide:

  1. Click and choose Load from your computer

  1. We have already downloaded the codes on computer desktop, so open the file and choose 3-13-fan.sb3

Manually build blocks:

  1. In events, find j1 block.

  2. In control, find and place j2 block under j1.

6-1-4-1-1

  1. In motor, put 6-13 into j2, and set pin IO17 to output LOW and pin IO18 to output HIGH.

  2. Add a delay of 2S.

6-13

  1. Duplicate the above code and modify pin IO17 to HIGH and IO18 to LOW.

  2. Duplicate again and set both IO17 and IO18 to LOW.

Complete Test Code

6-13

3.13.4.2 Test Result

After uploading code, you will see the fan forward rotates for 2s and then reverses for another 2s. Then it stops. These actions repeat.