Connecting a motor and 1602 LCD to a Raspberry Pi

From BitWizard WIKI
Jump to: navigation, search

This page describes the demo that can be found on the following youtube link:

Things we used

We chose a small DC motor which works on 5VDC, so we could power it directly from the RPi. It is, however, possible to connect an external power supply, to drive motors (or other stuff) which require a different voltage then the 5V provided by the Pi.

Steps to take

We split this up in two seperate scripts:


bw_tool -C -t "BW spi 7fets PWM"
bw_tool -w 11:20
bw_tool -t "test: $pwmval"
bw_tool -a 88 -w 50:$pwmval


./set_pwm 58
./set_pwm 48
sleep 4
for i in 50 60 70 80 90 a0 b0 c0 d0 e0 f0 ff ; do
  ./set_pwm $i
  sleep 0.5
sleep 1
for i in ff f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 0 ; do
  ./set_pwm $i
  sleep 0.5

Put both scripts in your homedir, and run the test_pwm script as root, and you're done!