leewillis77
Posts: 5
Joined: Mon Apr 16, 2012 9:23 pm

Hardware know-nothing looking for banana synth advice

Fri May 18, 2012 8:28 pm

I have a pi, and am successfully using it as a Squeezebox server, SAMBA server, and for nightly backup infrastructure - all good and I'm pretty happy.

Aside from that though I do actually want to get into hardware hacking a bit, and would like some fun projects to do with it with my two children (7 and 5). I came across this today and thought it would make a great project that I know my kids would love:

http://www.gadgetgangster.com/news/56-j ... synth.html

Now, programming I can do just fine, but hardware I need a helping hand with - so can anyone who's hardware knowledgable tell me if this could be done with a PI. If so what extra hardware would be required?

All advice gratefully received

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Hardware know-nothing looking for banana synth advice

Mon May 21, 2012 8:10 am

You are going to need some kind of hardware board for this, you can't just "plug a banana" into the Raspberry Pi as there is no native "Banana Driver for a Raspberry" - sorry couldn't resist the fruit based joke :lol:

I haven't used one, but as this is designed to work the propeller I suggest you start there.
http://www.gadgetgangster.com/find-a-pr ... ectnum=258

There are some guides including programming with Linux. You'd probably need to work through the tutorials.
http://www.gadgetgangster.com/sell-your-project/293

Good luck - sounds like fun.

leewillis77
Posts: 5
Joined: Mon Apr 16, 2012 9:23 pm

Re: Hardware know-nothing looking for banana synth advice

Mon May 21, 2012 8:30 pm

penguintutor wrote:You are going to need some kind of hardware board for this, you can't just "plug a banana" into the Raspberry Pi as there is no native "Banana Driver for a Raspberry" - sorry couldn't resist the fruit based joke :lol:
So I can't hook them straight up to the GPIO pins then ... I was going for just swapping out the propeller board for the Pi, and doing the output in software through video out, therefore just wiring and bananas needed and a bit of s/w know-how

Told you I was a h/w newbie ;) Any explanations of why this is a bad idea appreciated - I'd like to learn along the way!

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Hardware know-nothing looking for banana synth advice

Tue May 22, 2012 11:05 am

Theoretically it may be possible, but it's not something that I would recommend.
These are low power connections with no real protection to prevent damage to the Raspberry Pi:

The following are taken from the Wiki:
Extreme caution should be exercised when interfacing hardware at a low level, you may damage your RPi, your equipment and potentially yourself and others. Doing so is at your own risk!
and
GPIO voltage levels are 3v3 and are not 5v tolerant. There is no over-voltage protection on the board - the intention is that people interested in serious interfacing will use an external board with buffers, level conversion and analog I/O rather than soldering directly onto the main board.
saying that there is not much harm you can do with a banana, so perhaps it's possible.

The circuit works by charging and discharging the banana and measuring how long it retains it's charge for. I would have expected this to use analog ports, but whilst I don't know anything about spin the source files appear to suggest they are actually using digital ports.

The problem with using a digital port is that you have only a small threshold voltage that is classed as being high and the same as low, but then a large area in between that is unknown. So most likely the circuit is detecting when the voltage enters a certain point in that undefined voltage area. This probably works just fine for the purpose of detecting the charge of a banana, but would not be reliable for something that needs to be more accurate.

Whilst it may be possible to use the GPIO ports, but not recommended.

The following two pages from the Wiki may help:

http://elinux.org/Rpi_Low-level_peripherals
http://elinux.org/RPi_Tutorial_Easy_GPI ... 6_Software

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Hardware know-nothing looking for banana synth advice

Tue May 22, 2012 11:11 am

I would also add that the internal resistance and capacitance of the GPIO may be very different from the Propeller, so the speed that you are trying to measure might be ten or more times faster or slower. You may find that Linux is not fast enough to detect the difference in speed.

leewillis77
Posts: 5
Joined: Mon Apr 16, 2012 9:23 pm

Re: Hardware know-nothing looking for banana synth advice

Tue May 22, 2012 8:24 pm

Brilliant feedback - thanks guys. I'm reading those threads right now :)

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Hardware know-nothing looking for banana synth advice

Tue May 22, 2012 8:35 pm

Google for makeymakey ;-)
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: Hardware know-nothing looking for banana synth advice

Tue May 22, 2012 9:05 pm

People you've all missed the obvious:
The GPIO is 3V, and very sensitive.

Everybody knows that bananas are 5V...


There are plenty of microcontrollers (such as the some Microchip PIC series) that can produce a cap-sense style system. There are also some decent guides explaining how to do it with those chips. At least most of your work would be back in software then. But remember, most PICs are 5V, some can be run at lower voltages but I've never really paid much attention to that.

I'm sure Gert can put together a set pretty soon ;)

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13009
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Hardware know-nothing looking for banana synth advice

Wed May 23, 2012 12:06 am

That the Propeller runs on 5V, and RPI's I/O's are 3V3 doesn't make much of a difference, nor are the R-PI GPIO pins that more vulnerable than those of any other microcontroller.
The trick used here is quite universal and can be done with almost all microcontrollers with programmable I/O that use some kind of CMOS technology (Transistor logic isn't suitable for this trick).

The trick is that the "banana" can be seen as a very small capacitor to ground, and that you can affect the leakage of that capacitor. it will leak any charge it has to ground quicker when your body provides an additional path to ground when you touch the "banana" (read "any slightly conductive mass isolated from ground").

All that the microcontroller does is measuring how much time any charge takes to leak away.
It does that by switching a GPIO pin (connected to a banana) as an output, then outputting a "1", so that the "banana" is charged up (to 3V3 in this example), then immediately the software switches the GPIO pin to input, (it must be an input without pull-ups or pull-down resistors enabled) the RPI can do that.
Then it counts with a very fast machine language loop how long it takes for the charge to drop below the level that the GPIO (used as a digital input) reads as "1".
The more the charge has a path to leak away, the shorter this (very short) period lasts.
The absolute time doesn't matter, just the relative time from one sampling to the next.

Al this the RPI can do, even under Linux, it only has to run a very short machine language routine once in a while, The only critical point being that it is essential that during the machine language routine interrupts must be disabled.

Return to “Beginners”