I've got a mechanical IR cut filter that I'm planning on using to convert the IR PiCamera to a Normal light version depending on the levels of ambient light (+/- external IR LED array). This particular mechanical IR filter I think is based on a solenoid that moves the IR filter when a current is applied. If I connect it 5V and GND, it moves the IR filter one way. To move it back, I need to swop V and GND around. I had the idea of using an L293D ic in the same way as used to run a DC motor forwards or backwards as a way of achieving the same effect of manually swopping the polarity around of the 5v and GND connections.
I've built my bread board as follows, which is based on the following blog post:
http://computers.tutsplus.com/tutorials ... -cms-20051
My main modification is to remove the external batteries for the 'motor Vcc' input and substitue with the 5V supply of the Pi, on the basis that the IR cut filter is activated by connecting directly to the 5V pin and GND.
My layout is as follows:
Code as follows:
Code: Select all
import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BOARD) Motor1A = 16 Motor1B = 18 Motor1E = 22 GPIO.setup(Motor1A,GPIO.OUT) GPIO.setup(Motor1B,GPIO.OUT) GPIO.setup(Motor1E,GPIO.OUT) print "Going forwards" GPIO.output(Motor1A,GPIO.HIGH) GPIO.output(Motor1B,GPIO.LOW) GPIO.output(Motor1E,GPIO.HIGH) sleep(2) print "Going backwards" GPIO.output(Motor1A,GPIO.LOW) GPIO.output(Motor1B,GPIO.HIGH) GPIO.output(Motor1E,GPIO.HIGH) sleep(2) print "Now stop" GPIO.output(Motor1E,GPIO.LOW) GPIO.cleanup()
I can detect voltage changing as per the code in the enabling GPIO lead and both the other two, but cannot get any output to work. Power form the Pi seems okay, and GPIO pins go high / low as they should.
Any ideas - or have a made silly mistake ?