Switching (and wiring) a relay from Python - Raspberry Pi Forums
hi guys
i'm prototyping bmx start gate using python , breadboard. final version wait button press play wav "riders ready, watch gate" followed random delay , firing gatedrop() code sounds buzzer , leds in order.
i've worked through camjam exercises , reworking buzzer, button , led examples own project.
trying add relay switched when final green led lights up. have single channel 5v arduino relay operate 12v door magnet. green led on, magnet off, gate drops , off go.
questions:
1: can wire relay straight off header on pi jumper wires , use relay gpio commands in python fire it? (it sounds simple me)
2: magnet energised (so relay closed) @ rest. case of dropping relay.on() in @ start of code? haven't checked relay commands yet.
3: can cut connector off 12v power supply , wire relay provide power magnet? (cost issue here, have loads of 12v adapters electrical items no longer posses!!!)
4: best way of testing 12v supply beyond relay? magnet £30+ want complete prototyping before purchase ideally.
forum helped me out loads on previous project (twitter wall) figured best place ask.
i'm prototyping bmx start gate using python , breadboard. final version wait button press play wav "riders ready, watch gate" followed random delay , firing gatedrop() code sounds buzzer , leds in order.
i've worked through camjam exercises , reworking buzzer, button , led examples own project.
trying add relay switched when final green led lights up. have single channel 5v arduino relay operate 12v door magnet. green led on, magnet off, gate drops , off go.
questions:
1: can wire relay straight off header on pi jumper wires , use relay gpio commands in python fire it? (it sounds simple me)
2: magnet energised (so relay closed) @ rest. case of dropping relay.on() in @ start of code? haven't checked relay commands yet.
3: can cut connector off 12v power supply , wire relay provide power magnet? (cost issue here, have loads of 12v adapters electrical items no longer posses!!!)
4: best way of testing 12v supply beyond relay? magnet £30+ want complete prototyping before purchase ideally.
forum helped me out loads on previous project (twitter wall) figured best place ask.
gpio pins on pi cannot directly drive relay (each gpio pin can supply 15ma, not enough relay). unless using relay module designed work pi (or similar) need additional circuitry drive relay. transistor, resistors , diode you'll need. example circuit can found here http://www.susa.net/wordpress/2012/06/r ... sing-gpio/
many relays double pole meaning there open , closed terminal. if want magnet on @ rest i'd suggest connecting closed terminal , powering relay break circuit powering magnet (and open gate).
yes likely, make sure 12v supply provides enough current drive relay/magnet.
12v automotive bulb thing test with. friends may have old 12v bulbs stored away in drawers or pick 1 scrap yard.
raspberrypi
Comments
Post a Comment