What is PWM?
Pulse-width Modulation

Go to https://github.com/sarfata/pi-blaster/
and Download.

Installing:

sudo apt-get install autoconf

Then unzip pi-blaster-master.zip and do:

./autogen.sh
./configure && make

To start pi-blaster and have it relaunched automatically on every reboot:

sudo make install

 

Afterwards it should look like this:

/etc/init.d/pi-blaster.boot.sh start
Using hardware: PWM
Number of channels: 8
PWM frequency: 100 Hz
PWM steps: 1000
Maximum period (100 %): 10000us
Minimum period (0.100%): 10us

How to use

Pi-Blaster creates a special FIFO file in /dev/pi-blaster. Any application on your Raspberry Pi can write to it (this means that only pi-blaster needs to be root, your application can run as a normal user).

Important: when using pi-blaster, the GPIO pins you send to it are configured as output.

To set the value of a PIN, you write a command to /dev/pi-blaster in the form <GPIOPinName>=<value> where <value> must be a number between 0 and 1 (included).

For a short example, this is how we set GPIO pin 17 to a PWM of 70%:

echo "17=0.7" > /dev/pi-blaster

 

I figured out which Gpio-ports are working for revision B:

  
 GPIO number   Pin in P1 header   wPi numbers
      4              P1-7              7
      17             P1-11             0
      18             P1-12             1
      21             P1-13             2
      22             P1-15             3
      23             P1-16             4
      24             P1-18             5
      25             P1-22             6

 

 

Kommentar hinterlassen