Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

First off I would like to apologise for my lack of electronics knowledge so I might have trouble even phrasing my question correctly.

In a nutshell, I have an old arcade cabinet that I am refurbishing for my son (and who am I to lie, it's for me too). I am using the whole project to learn about electronics and android programming. My goal is to have an app on my smartphone that can control the arcade cabinet. Yeah, I know, it's a bit dumb but I just want to see if it's possible. It'd also be handy to be able to reset the cabinet from afar when when my son refuses to go to bed.

Anyway, the buttons appear to operate on a constant 5v circuit. When the button is pressed the circuit is broken and the cabinet performs the requested action. Current flows again when the button is released. What I would like to achieve is to somehow enable the Raspberry Pi to perform the same action by breaking the button[s] circuit.

I have so far tried using a solenoid that would break the circuit but for some reason the GPIO pins cannot send enough current to activate the solenoid (which is odd becuase the solenoid works if I connect it to the 3.3v and ground pins on the Pi - and SNAPS shut when I attach to the 5v pin). I basically followed this page: http://www.rmweb.co.uk/community/index.php?/blog/1261/entry-11000-2-driving-an-led/

I verified the voltage using a multimeter and the Pi is doing what it should - sending 3.3v when my code tells it to.. If I attach an LED the LED responds appropriately.

So now I've given up with the solenoid idea because I'd need about ten solenoids and they're a pain in the backside to use, so I would like to try other ways of cutting a seperate circuit using the Pi. I have been reading up about transistors but have so far been unable to get anything to work because as I've said, my electronic knowledge is rubbish.

Can anyone help me with this? I feel like it should be very simple to achieve but either a) It's actually difficult or b) I'm just being dumb

More likely b)!

Thanks in advance!

(for the record I've read the "similar questions" - e.g. Closing a circuit with GPIO but have just ended up confusing myself.. The software side of things I'm pretty good at, being a PHP programmer.. Am just feeling really dense because I can't seem to get my head around to the hardware, even simplistic stuff like this)

share|improve this question
    
To do this, and also make the arcade still usable with normal button pressing, you could either use a PNP transistor, or a relay. Can you measure the current going through the button? For higher currents (or higher voltages) a relay is more appropriate. –  Gerben Aug 13 '13 at 18:16
1  
Hi. The voltage going through the buttons is 5v - I'm not sure about the current until tomorrow. It's probably more than the pi can handle judging by the size of the wires. Think I'll take your advice and go and get some transistors tomorrow, they've got to be easier than any other approach I've tried. Thanks for your advice! –  Hugo Rune Aug 13 '13 at 23:20
    
Let me know if you need help with how to wire them. Also note that you need PNP transistors, not the more common NPN type! –  Gerben Aug 14 '13 at 11:57
    
Hi @Gerben, thanks for your help! This morning I pulled a transistor from a dead PC I had lying about and discovered what you mean about NPN and PNP transistors (I've been doing some reading too :) I did manage to get the NPN transistor to work, albeit the wrong way around. I've been loosely following this wiring diagram - davidhunt.ie/?p=2718 and I'm hoping it'll work? For PNP transistors would these be sufficient? maplin.co.uk/standard-bipolar-pnp-power-transistors-33879 Thanks again, your help is appreciated! –  Hugo Rune Aug 14 '13 at 15:18
    
That tutorial looks fine. Just make sure you add the resistor in that tutorial. One of the images has it omitted, but it's really necessary. The transistor you linked to are some more heavy duty transistors, so they would work in most cases. But since you haven't measured the current, I can't know for sure. The current could also be used to get a more appropriate resistor value. I started doing some electronics only a few months ago. There is a bit of a learning curve, but luckily there's also a lot of info available on the net. So I know want you're going through :-) –  Gerben Aug 14 '13 at 19:39

2 Answers 2

There are many relays availible for use with the Pi. It's very similar to a transistor, except its digital rather then analogue, once the input is at a high enough the relay will turn on its normally off output. There are 5 inputs and 2 outputs. One output is normally on, the other is normally off. In between is the input for the relay. There are 3 more inputs the other side of the board that will have GPIO pins. 2 are for VCC(+5V) and the other is the GND(-). The third pin is the input that controls the relay, changing it's state from normally on/off. You can connect the GPIO pins directly from your Pi. This is how a 1 relay board works, but if you're using a 2 relay (or more) board, it should be easy to work out.

share|improve this answer
up vote 0 down vote accepted

Thanks for all your help with this.

In the end I used some relays to solve my problem. The cabinet's voltage was not steady and didn't work 100% of the time using a transistor alone so a 5v relay worked out way better. The relay also produces a very satisfying "click" sound too.

I need better reputation to post images here but instead I've put the schematics on my server if anyone is interested.

http://runeindustries.com/sites/cabinet/breadboard.png and the actual final "prototype" http://runeindustries.com/sites/cabinet/photo.jpg

For info, I used LU-5 (1205) 5V relay, BD442 PNP transistor, 1N4001 diode and a 1K ohm resistor.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.