X
Home > Blog > STEM for Arduino > HOW to Make a Manual Control Fan with KidsIOT

HOW to Make a Manual Control Fan with KidsIOT

By r October 21st, 2024 34 views

In this project, we adopt a capacitive touch sensor and an 130 motor to combine a fan in manual mode. We can control the startup of the fan by the capacitive touch sensor.

Flow

4401

Assembly

line1

Required Components

44_00

line1

Step 1

44_01

line1

Step 2

44_02

line1

Step 3

44_03

line1

Step 4

44_04

line1

Step 5

44_05

line1

Step 6

44_06

line1

Step 7

44_07

line1

Completed

44_08

line1

Wiring Diagram

4402

Test Code

Open KidsBlock and connect the board to computer. Choose File –> Load from your computer.

3111

Choose path D:\Code\2.Code_kidsIOT and open 4.4Manual mode.sb3

4403

Click 3209 to connect to port and then 2210.

Explanations

5top

Code Blocks

Blocks

Code block

Events

begin

P

setmode

P

readdigital

Vari

variablename

Vari

setvariable

Vari

variable

Operators

=

Operators

and

Motor

Motor_analogWrite

Control

forever

Control

if

line5

Build blocks:

Click add to import library DC Motor for esp32.

3907

  1. Initialization

    Set the sensor pin to IO27. Define a variable press with an initial value of 0 to monitor the state of motor.

    4404

line3

  1. Main Code

    Loop:

    • When the module is touched (IO27 reads 1) and press = 0, the fan rotates, and press will be reassigned to 1.

    • When the module is touched (IO27 reads 1) and press = 1, the fan stops, and press will be reassigned to 0.

    4405

5bottom

Test Result

4top

After uploading code, touch the module and the fan starts to work. Touch it again, and the fan will stop.

4403

4bottom

HOW to Make a Remote Control Fan with KidsIOT
Previous
HOW to Make a Remote Control Fan with KidsIOT
Read More
HOW to Make a Track Alarm with KidsIOT
Next
HOW to Make a Track Alarm with KidsIOT
Read More
Message Us