3.13 Fan 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

t108

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

Blocks in :

  1. t109 is a block included in coding box library. It controls the rotation of the motor in the coding box.

Motor control logic table for the blocks:

motor state

value (speed)

forward rotate

1~100

reverse rotate

-1~-100

stop rotating

0

3.13.4 Test Code

You can manually build blocks, or directly open the code file we provide: 3-13-Fan.ubp. If you have any questions about how to open code files or upload code, please back to 1.9 Upload Code.

Build code blocks:

  1. In , drag and to the script area, and stack them together.

t34

  1. In , drag t109 and put it into.

t110

  1. In , drag t4 block and set delay to 2000. And put it under t109.

t111

  1. Duplicate all t109 but modify power to -50.

  2. Duplicate all t109 again but modify power to 0.

Complete code:

t112

3.13.5 Test Result

Connect the coding box to the MicroBlocks via USB or Bluetooth, and click t59 to upload the code to the coding box. You will see the fan forward rotates for 2s and then reverses for another 2s. Then it stops rotating for 2 seconds. These actions repeat.