DIY Fan With an ON-OFF Button - M5StickC ESP32

by RonFrtek in Circuits > Arduino

1016 Views, 1 Favorites, 0 Comments

DIY Fan With an ON-OFF Button - M5StickC ESP32

DIY Fan With an ON-OFF Button - M5StickC ESP32

In this project we will learn how to use a FAN L9110 module using a M5StickC ESP32 board.

What You Will Need

FUPA768K36U3RSQ.LARGE.jpg
arduino-fan2.jpg
VisuinoAdvrtisementRaspberryPiRobot1.jpg

The Circuit

2020-10-27_18-38-24.jpg
  • Connect StickC pin 5V to FAN module pin VCC
  • Connect StickC pin GND to FAN module pin GND
  • Connect StickC pin G26 to FAN module pin INA

Start Visuino, and Select the M5 Stack Stick C Board Type

F5ZAEMUK36U3RS2.LARGE.jpg
FBZIDQ4K36U3RS3.LARGE.jpg

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "M5 Stack Stick C" as shown on Picture 2

In Visuino Add & Set Components

2020-10-27_17-48-34.jpg
2020-10-27_19-54-30.jpg
2020-10-27_19-54-50.jpg
2020-10-27_19-55-12.jpg
2020-10-27_19-57-34.jpg
2020-10-27_19-57-51.jpg
2020-10-27_19-58-03.jpg
2020-10-27_7-56-19.jpg
2020-10-27_7-55-59.jpg
2020-10-27_19-58-35.jpg
2020-10-27_19-58-56.jpg
  • Add "Detect Edge" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Digital Multi Source" component
  • Add "Text Value" component
  • Double click on the "TextValue1" and in the Elments window:
  • drag "Set Value" to the left side and in the properties window set Value to "FAN ON"
  • drag "Set Value" to the left side and in the properties window set Value to "FAN OFF"
  • Close the Elements window
  • Select "M5 Stack Stick C" board and in the properties window expand Modules>Display ST7735 and:
    • set Orientation to goRight
    • Select Elements and click on the 3 dots button and in the elements window
      • drag "Text: Field" to the left and in the properties window set size to 3 and Initial Value to "FAN OFF"
  • Close the Elements window

In Visuino Connect Components

2020-10-27_20-10-31.jpg
stickc-fan.png
  • Connect "M5 Stack Stick C" button pin A(M5) to "DetectEdge1" pin In
  • Connect "DetectEdge1" pin Out to "TFlipFlop1"pin Clock
  • Connect "TFlipFlop1" pin Out to "DigitalMultiSource1" pin In
  • Connect "TFlipFlop1" pin Inverted to "TextValue1" > Set Value2 >pin Clock
  • Connect "DigitalMultiSource1" pin[0] to "TextValue1" > Set Value1 >pin Clock
  • Connect "DigitalMultiSource1" pin[1] to "M5 Stack Stick C" pin GPPIO26
  • Connect "TextValue1" pin Out to "M5 Stack Stick C" pin Text Field1 pin Clock
  • Connect "TextValue1" pin Out to "M5 Stack Stick C" pin Text Field1 pin In

Generate, Compile, and Upload the Code

2020-10-27_18-20-02.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the M5StickC module the FAN will start to rotate and you can turn it OFF or ON using a Orange Button M5, also you will see the status on the Display.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu

Troubleshooting

2020-10-28_19-06-42.jpg

  • Make sure you selected the right StickC board, check your model
  • Sometimes you need to turn OFF/ON the StickC module before the use, you can do that by holding a side button for a 5+ seconds.