yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
CUBE Pi Case📖
1. Assembly tutorial
  • 1. Installation video
  • 3. Hardware wiring instructions
2. CUBE Pi interface description and precautions
  • CUBE Pi interface description and precautions
3. Chassis driver tutorial
4. RGB light strip driver
  • RGB light strip driver
3. Fan drive
  • Fan drive
2. OLED display
  • OLED display
1. Install driver library
  • Install driver library
5. Set up auto-startup
  • Set up auto-startup
6. M.2 expansion board information (optional)
  • Installation steps
  • System Mount
Download
  • Code
  • System_Image_File
  • Communication Protocol
  • Instruction_Manual
Download ZIP

Welcome to CUBE Pi Case repository

当製品の日本語版マニュアル資料は、こちらからご取得ください。

Fan drive

Fan drive

Fan drive1. Learning objectives2. Preparation before the experiment3. Use the CubeRaspberry driver library to control the fan1. Import the CubeRaspberry driver library and create an object2. Set the fan switch3. Code demonstration4. Using Jupyter lab control fan1. Import CubeRaspberry driver library and create objects2. Turn off the fan3. Turn on the fan4. Delete the object5. Experimental Phenomenon

1. Learning objectives

  • Master the Raspberry Pi fan driver
  • Use the CubeRaspberry driver library to control the fan
  • Control the fan through Jupyter lab

2. Preparation before the experiment

Install the Raspberry Pi chassis according to the assembly video tutorial. You can also refer to the "Raspberry Pi chassis_hardware wiring" tutorial document for installation. Here, the chassis expansion board and RGB light strip and fan hardware connections are shown.

1

Chassis expansion board3Pin interface2Pin interface
 RGB light stripFan

3. Use the CubeRaspberry driver library to control the fan

1. Import the CubeRaspberry driver library and create an object

The name of the CubeRaspberry driver library is CubeRaspberryLib. Use CubeRaspberryLib to import the library in the program.

xxxxxxxxxx
from CubeRaspberryLib import CubeRaspberry

CubeRaspberryLib library functions needed to control the fan:

xxxxxxxxxx
set_Fan(state) # Set the fan switch

2. Set the fan switch

| set_Fan(state) :Set the fan switch | | :---------------------------: |

state valueFan state
0Off
1On

3. Code demonstration

  • Turn on/off the fan (python interactive interface: each statement needs to be run separately)
xxxxxxxxxx
from CubeRaspberryLib import CubeRaspberry
bot = CubeRaspberry(i2c_bus=1)
bot.set_Fan(0)
bot.set_Fan(1)
del bot
exit()

2

  • Turn on the fan (Fan_start.py)

xxxxxxxxxx
from CubeRaspberryLib import CubeRaspberry
​
if __name__ ==  '__main__':
    bot = CubeRaspberry(i2c_bus=1)
    bot.set_Fan(1)
  • Turn off the fan (Fan_stop.py)

xxxxxxxxxx
from CubeRaspberryLib import CubeRaspberry
​
if __name__ ==  '__main__':
    bot = CubeRaspberry(i2c_bus=1)
    bot.set_Fan(0)

image-20230717205831540

Note: Press Ctrl + C to terminate the run

4. Using Jupyter lab control fan

Create a new file in the Jupyter lab interface and create the following code blocks, edit the following contents respectively (Fan_Test.ipynb):

1. Import CubeRaspberry driver library and create objects

xxxxxxxxxx
from CubeRaspberryLib import CubeRaspberry
​
bot = CubeRaspberry(i2c_bus=1)

2. Turn off the fan

xxxxxxxxxx
bot.set_Fan(0)

3. Turn on the fan

xxxxxxxxxx
bot.set_Fan(1)

4. Delete the object

xxxxxxxxxx
del bot

image-20230717221917728

  • Jupyter lab basic operations

If you find that the code runs abnormally, it is recommended to follow the steps in the figure and then retest the code block.

image-20230717222058190

5. Experimental Phenomenon

  • Run the code or file related to opening the fan:

You can see that the fan in the chassis turns on the blue light and rotates

image-20230717222058191

  • Run the code or file related to closing the fan:

You can see that the blue light of the fan in the chassis turns off and stops rotating

image-20230727222058190

RGB light strip driver
OLED display

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文