james_so
Posts: 5
Joined: Mon May 28, 2012 9:23 pm

Replacing berry clip buzzer with fan

Mon Aug 19, 2013 10:37 pm

Just wondering whether replacing the buzzer with a 5v fan would cause and damage to anything (I'm working on the presumption that the supply to the buzzer would be good to drive a 5v fan of course ;) )?

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Replacing berry clip buzzer with fan

Tue Aug 20, 2013 6:30 am

I presume this is what you mean by a berry clip buzzer - https://www.modmypi.com/berry-clip-rasp ... d-on-board

That buzzer looks like one I use - it's piezo driven and thus can run directly from the 3.3V from a GPIO pin drawing just a milliamp or two. I suspect your fan needs much higher voltage and current, and may even be mains powered.

So the answer to your question is yes and no - all depending on the fan. Regardless of the type, you're probably going to need a buffer and or relay to take the low power available from the GPIO pins to the buzzer, and allow that to switch the (probably) higher voltage and current required by the fan.

Choice of the relay depends on what current / power drives the fan at the moment. If you can supply more details about the fan, I might be able to help more. It is mains or battery powered? If battery, how many of what type? Do you have a photo or a brand / manufacturers name for it?
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

james_so
Posts: 5
Joined: Mon May 28, 2012 9:23 pm

Re: Replacing berry clip buzzer with fan

Tue Aug 20, 2013 10:56 am

Thanks for the reply, my understanding from the parts description is that the buzzer is 5v, the fan is a 20mm 5v fan which draws ~0.06Amps.

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Replacing berry clip buzzer with fan

Tue Aug 20, 2013 12:51 pm

My suspicion is the buzzer is this one: http://uk.farnell.com/jsp/search/produc ... KU=1022392. It'll happily run from 3V - 16V DC drawing 3ma - given I can't see any switching or transistors on the board, so I think the buzzer is being directly driven from the GPIO point at 3.3V - that certainly how I'm doing it and it works fine.

Based upon that suspicion, the GPIO pins @3.3V probably won't supply enough oomph to drive your 5V fan - simplest way though is just to try it - if the fan is drawing just 60ma, although that might be too much for more than a few seconds, it's more than enough for a quick test: try attaching 1 fan wire to ground and the other to a high GPIO output pin and see if it spins the fan or not.

Good luck!
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: Replacing berry clip buzzer with fan

Wed Aug 21, 2013 7:16 am

Hello,

The GPIO pins can each supply a maximum of 16mA @ 3.3 Volts. (normally 8mA, has to be set for higher than 8).
The total current from all the pins, should not exceed 55mA.

Regards

james_so
Posts: 5
Joined: Mon May 28, 2012 9:23 pm

Re: Replacing berry clip buzzer with fan

Wed Aug 21, 2013 1:08 pm

Ahh, sounds like it may not be a good idea to try to run a cooling fan off of it then, thanks ;)

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Replacing berry clip buzzer with fan

Wed Aug 21, 2013 1:53 pm

Don't be put off too quickly - it's only the matter of a single NPN transistor to use the GPIO 3.3v to turn on 5V @ 60ma through the fan. Probably pennies to buy. Transistor base to GPIO pin output with either internal or external pull down resistor. Collector connected to one side of the fan motor. Other side of the fan connected to 5V. Emitter of the tranisitor connected to common ground shard by both the RPi ground and your 5V supply ground.

Job's a good 'un.

Code: Select all

       |/ collector
base --|
       |\ emitter (- pointy arrow symbol hard to show in just text)
        

www.pistuffing.co.uk - Raspberry Pi and other stuffing!

james_so
Posts: 5
Joined: Mon May 28, 2012 9:23 pm

Re: Replacing berry clip buzzer with fan

Thu Aug 22, 2013 4:53 pm

Thanks Hove, I'd love to try it but knowing what resistor and transistor to use is beyond me, I can solder but need parts lists for such things ;)

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Replacing berry clip buzzer with fan

Thu Aug 22, 2013 6:16 pm

OK, I'll try to help, but with a slight change of plan: instead of a normal transistor, I've dug out this MOSFET (metal oxide silicon field effect transistor). I can't remember much about all the details of the difference, but I do know they are better at acting as switches which is what you need.

MOSFET 2N7000G should do the job - it's available at Farnell - http://uk.farnell.com/on-semiconductor/ ... dp/1459027 or Maplins http://www.maplin.co.uk/mos-fet-transistors-33843 - Maplin may well have a shop local to you and will sell in smaller quantities.

Here's the data sheet for this device: http://www.farnell.com/datasheets/4586.pdf

With it's flat side facing you, connect left pin (pin 1, the source) to ground (pin 6 on the GPIO connector), the middle pin (pin 2, the gate) to the GPIO pin (11 in the example code below), and the right pin (pin 3, the drain) to one end of your fan. Connect the other end of the fan to 5v (pin 2 on the GPIO connector).

No resistor is needed - you can use the one in the GPIO hardware instead - assuming you are using python then this code should do the job, but no guarantees, it's completely untested, so on your head be it (caveat over). Rather than soldering, I'd start first with one of the many breadboard kits available - here's some and connector wire kits from Maplin again: http://www.maplin.co.uk/productsearch?c ... readboards

Code: Select all

import RPi.GPIO as GPIO # import the GPIO python library
import time # import the time python library
GPIO.setmode(GPIO.BOARD) # set up GPIO to use GPIO plug pin numbers, not the chip pin numbers
GPIO.setup(11, GPIO.OUT, GPIO.LOW) # set up pin 11 to be an output, set low at startup (fan off)
time.sleep(1.0) # sleep for a second
GPIO.output(11, GPIO.HIGH) # turn the fan
time.sleep(10.0) # leave it on for 10s
GPIO.output(11.GPIO.LOW) # turn it off again
GPIO.cleanup() # housekeeping!
Best of luck,

Hove
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

james_so
Posts: 5
Joined: Mon May 28, 2012 9:23 pm

Re: Replacing berry clip buzzer with fan

Sat Aug 24, 2013 10:37 pm

Looks doable, there's a Maplin shop not too far away so I'll take a look next time I'm over that way. If I get the parts and feel brave enough to fiddle I'll be sure to let you know how it goes ;)

Return to “HATs and other add-ons”