Enjoy Your Cool Summer With a M5StickC ESP32 Fan - Adjustable Speed
by RonFrtek in Circuits > Arduino
737 Views, 1 Favorites, 0 Comments
Enjoy Your Cool Summer With a M5StickC ESP32 Fan - Adjustable Speed
In this project we will learn how to control a FAN speed using a M5StickC ESP32 board and L9110 fan module.
What You Will Need
- M5StickC ESP32
- FAN module L9110
- Visuino software: Download Visuino here: https://www.visuino.eu
The Circuit
- Connect StickC pin 5V to FAN module pin VCC
- Connect StickC pin GND to FAN module pin GND
- Connect StickC pin G0 to FAN module pin INA
Start Visuino, and Select the M5 Stack Stick C Board Type
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
- Add "Counter" component
- Add "Detect Edge" component
- Add "Integer To Analog" component
- Add "Subtract From Analog Value" component
- Select "Counter1" and in the properties window: set Max>Value to 10,set Min>Value to 0
- Select "IntegerToAnalog1" and in the properties window set Scale to 0.1
- Select "SubtractFromValue1" and in the properties window set Value to 1
- 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 "Draw Text:" to the left and in the properties window set size to 2 and text to "FAN SPEED"
- drag "Text: Field" to the left and in the properties window set size to 3 and Y to 30
- Close the Elements window
In Visuino Connect Components
- Connect "M5 Stack Stick C" button pin A(M5) to "DetectEdge1" pin In
- Connect "DetectEdge1" pin Out to "Counter1"pin In
- Connect "Counter1" pin Out to "IntegerToAnalog1" pin In and "M5 Stack Stick C" >Text Field1> pin In
- Connect "IntegerToAnalog1" pin Out to "SubtractFromValue1" pin In
- Connect "SubtractFromValue1" pin Out to "M5 Stack Stick C" to GPIO[0] pin Analog PWM
Generate, Compile, and Upload the Code
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 change its speed using a Orange Button M5, also you will see the speed 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
Downloads
Troubleshooting
- 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.