w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
ValueError: The channel sent is invalid on a Raspberry Pi - Controlling GPIO Pin 2 (BOARD) using Python causes Error

You can't. Pin 2 of the Raspberry Pi expansion header is connected directly to the USB power supply — it isn't controlled by the CPU.

Do not try to connect the fan directly to a GPIO pin; not only do they not output the right voltage, but they can't source/sink enough current to run the fan either. Trying to do so is very likely to destroy the pin driver, and may cause damage to other parts of the BCM2835 as well.

If you need to turn a 5V fan on and off, you will need some support hardware to control it (e.g, a FET).

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.