eric.frederich
Posts: 11
Joined: Tue Oct 11, 2011 11:53 am

Controlling 88 motors

Sun Aug 12, 2012 2:13 pm

Lets say I wanted to build something to play the piano.
The Gertboard doesn't have 88 different outputs, so is it possible to drive 88 different motors?

What kind of tricks would you use to get this done?

User avatar
RaTTuS
Posts: 10539
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Controlling 88 motors

Sun Aug 12, 2012 2:18 pm

muliplexing
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

eric.frederich
Posts: 11
Joined: Tue Oct 11, 2011 11:53 am

Re: Controlling 88 motors

Sun Aug 12, 2012 4:37 pm

RaTTuS wrote:muliplexing
Very newbie quesion I know, hence the one word answer ;-)
Can you help me understand it a little better...

So if I send out a multiplexed signal from the Gertboard and then have a demuxer on another board.
How would I get the two boards to be in sync with each other? Would they share a clock somehow? Would I use one of the IO ports as the ticker?

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Controlling 88 motors

Sun Aug 12, 2012 5:35 pm

I think the one word answer was given because the question was "bad", or better: "incomplete".
This is NOT to pick on you, as 95% of the people ask a question in that style.
But to get a "good" answer it helps a lot of you ask a "good " question.

As you understand yourself, your are asking to do something out of the ordinary.
I have not problem with that. in fact is is rather refreshing and more challenging then
'How do I connect an LED'. But then, it is so out of the ordinary, that we can not give an answer.

In order to give a more answer you have to specify a lot more of what you want to do.
Mostly you have to specify at what rate and with what accuracy you want to control you 88 motors.
Think about that very hard! It is crucial! It determines how fast, how often and how accurate you have
to control them. It defines 90% of the output circuit circuit and also defines if it can be done at all. (or NOT!)

Next: what kind of motors are you thinking off? You mention a piano so do you really need motors
(To play from PPP to FFF) or are mechanical on/off actuators good enough. (e.g. a tower with 88 bells)
What kind of power do you need to control 88 times: 6V at 250mA, 12V at 1A or 240V at 10A?

I have to warn you: Linux is not very suited for real time tasks. So if you really want to play
music on a piano you are looking at something very complex.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Controlling 88 motors

Sun Aug 12, 2012 9:01 pm

Batteries not included, Some assembly required.

User avatar
Vindicator
Posts: 314
Joined: Sat Sep 17, 2011 11:10 pm
Location: Susanville Ca USA
Contact: Website

Re: Controlling 88 motors

Sun Aug 12, 2012 9:22 pm

Very good link Dexos
If you are more worried about ,spelling, punctuation or grammar you have probably already missed the point so please just move on.

eric.frederich
Posts: 11
Joined: Tue Oct 11, 2011 11:53 am

Re: Controlling 88 motors

Mon Aug 13, 2012 2:04 pm

Gert, thanks for hanging out on the forums and taking your time replying to what must be real simple questions. I feel like I'm asking Newton for help in basic algebra.
Gert van Loo wrote:Mostly you have to specify at what rate and with what accuracy you want to control you 88 motors.
Think about that very hard! It is crucial! It determines how fast, how often and how accurate you have
to control them. It defines 90% of the output circuit circuit and also defines if it can be done at all. (or NOT!)
Well... from what I read in the Gertboard user manual it says that that clock runs at around 12MHz. Does that mean that you can switch the GPIOs at a 12MHz frequency? If so, even if each output is multiplexed 8 ways, you're still at 1.5MHz which is extremely accurate. Really I just want to build a toy. Accuracy within a 10th of a second is probably the most I would tolerate, and anything more accurate than a 100th of a second is great but my ears won't hear it.
Gert van Loo wrote:Next: what kind of motors are you thinking off? You mention a piano so do you really need motors
(To play from PPP to FFF) or are mechanical on/off actuators good enough. (e.g. a tower with 88 bells)
I was using a piano as an example. I do want to play music, but I do not not necessarily need a full 88. Maybe a little xylophone, marimba, bells, jars of water, etc. The main point was how do you, with 12 pins, control more than 12 things.
On/off actuators will probably suffice, though I'd like to have 2 per note; one to strike the note and another to dampen it. No varying levels of volume.
Gert van Loo wrote: What kind of power do you need to control 88 times: 6V at 250mA, 12V at 1A or 240V at 10A?
Absolutely no clue. I will get the help of someone more electrically inclined when the time comes. I mainly do software... that's about it.
Gert van Loo wrote: I have to warn you: Linux is not very suited for real time tasks. So if you really want to play
music on a piano you are looking at something very complex.
You mentioned this before here: http://www.raspberrypi.org/archives/1734#comment-29464

So how would you overcome this? From what I read, the IO on the Gertboard is buffered. So would I use Linux on the RP to fill the Gertboard buffers which in then move the actuators?

User avatar
RaTTuS
Posts: 10539
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Controlling 88 motors

Mon Aug 13, 2012 2:09 pm

How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
Grumpy Mike
Posts: 932
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Controlling 88 motors

Mon Aug 13, 2012 2:36 pm

From what I read, the IO on the Gertboard is buffered. So would I use Linux on the RP to fill the Gertboard buffers which in then move the actuators?
You are mixing up two meanings of the word buffered. You can buffer a pin and that means putting some sort of transistor between that and the outside world. This is what Gert's board does.
Then you can buffer signals, that means holding them until they are needed. This involves using what is known as a FIFO ( First In First Out ) memory. The Gert board does not offer that directly although it might be possible to program the processor on it to do such a thing.
Have a look at this project:-
http://www.thebox.myzen.co.uk/Hardware/ ... spiel.html
I interfaced it to the Pi with:-
http://www.thebox.myzen.co.uk/Raspberry ... Board.html
However this does not get more output than you have pins. To do this you need a chip called a port expander. Perhaps one of the I2C expanders like the 23016, this gives 16 outputs and you can have 8 on the same I2C bus giving you a maximum total of 128 inputs or outputs. You will then have to buffer the outputs of this to drive your actuators.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Controlling 88 motors

Mon Aug 13, 2012 5:00 pm

Of course two simple robot arms with say three fingers each would need less than 88 motors. Quite a complex thing to program, though :)

MadCow42
Posts: 106
Joined: Sun Jul 01, 2012 12:48 am

Re: Controlling 88 motors

Mon Aug 13, 2012 8:41 pm

Well, it's certainly possible. If you just want an "on/off" signal for each motor (or whatever you want to strike the string with - probably a solenoid of some sort), you could go a route similar to how I'm driving stepper motors.

You need only 3 GPIO outputs. One for the data, one for a clock signal, and one to "latch" the data to the output pins.

You can do this using a shift register. It takes serial data in (on one pin, regulated by the clock signal), and outputs it on separate parallel pins - one for each "motor". Normally shift registers have 4 or 8 outputs, but you can daisy-chain multiple chips together. You'd need 11x 8-bit shift registers to do 88 keys.

As for output speed and accuracy - I'm getting >1300 steps per second for my need, but that's not limited by the Pi... it's limited by the motors. I'm only using 4 bits. Simple math says you could get at least 60 cycles a second (or 30 discreet notes, each being "on/off"). And that's in a brute-force method where you're loading data for all 88 keys every time - there are much better ways if you'd need more speed. You may have the occasional hiccup, but from my stepper motor work it should be much less than the 1/100sec you mention.

See this thread for wiring diagrams and some example code: http://www.raspberrypi.org/phpBB3/viewt ... 32&t=10483

Kevin.

Phil Spiegel
Posts: 210
Joined: Tue Jan 17, 2012 8:17 am
Contact: Website

Re: Controlling 88 motors

Tue Aug 14, 2012 9:21 am

128 64 32 16 08 04 02 01 > 8 bits would be sufficient to identify a SINGLE note out of the 88, with a spare for the dampening pedal - and this value could be loaded into a register ['next' latch 1], and then clocked through on time ['now' latch 2]... but would be a single note at a time eg a 'Rolf Harris Stylophone'. For Polyphony, ...say 10 fingers (more for a duet!) then 10 such registers could be loaded 'each cycle' , and then simultaneously acted upon by being latched through by 'the clock' ... so that's 10 x 8 bit 'next' latches + 2 x 88 'now' latches, and a clock ... fastest timing required perhaps for demi semi quavers ?... but all this would only be crude control such as a fairground organ/pianola without further command options.

If it was for an air-operated organ, the Gertboard's control of a motor could vary the air volume too!
I recall from the 70's a project (wireless world?) which turned an IBM Golfball typewriter into an LQ Quality printer by mounting solenoids over every key ... a case of solenoids operating solenoids! -as the Golfball's were all electro-mechanical and not electronic.

User avatar
Mortimer
Posts: 925
Joined: Sun Jun 10, 2012 3:57 pm

Re: Controlling 88 motors

Tue Aug 14, 2012 9:59 am

I would have thought some sort shift register long enough to hold 88-bits would be better. He might want to play chords.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

mikerr
Posts: 2814
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Controlling 88 motors

Tue Aug 14, 2012 10:12 am

It's tempting to put a solenoid per key - but all piano music is designed to be played by humans after all
and we only have 2 hands (and five relatively slow moving digits/arms) - less motors could be used.

http://www.youtube.com/watch?v=vzmojKfKY8E

For simple music, Ignoring chords, you could probably do it with an x-axis carriage system with just 2 motors (think of a printer)

[edit] I meant direct on keys, but here's a slow version direct on strings:

http://www.youtube.com/watch?v=DhGwgBB4 ... ure=relmfu
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Return to “HATs and other add-ons”