position detection

hi

i’m quite the beginner to electronics and arduino…

i want to mount the print head assembly of an inkjet printer as a pitch control slider to the neck of a bass guitar. In order to let arduino move the head to a desired position, it needs a convenient (cheap) way to report the current position on the neck to arduino, fretwise. one idea is… to simply have something like small contact plates mounted at each fret position (i’ll use about 12 frets) and have these connected to 12 different circuits, with the ability of the head closing each circuit individually as it passes them. now… i have no idea what to search for as a “collector” for these circuits to send a signal along the lines of “circuit n closed” to arduino. maybe i’m totally off with this solution anyway. any suggestions?
thanks!

Not sure I quite understand what you want to do. The print head of a printer is controlled by a stepping motor, therefore to have it go where you want just let the Arduino give the appropriate number of pulses to the motor. There is no need to sense the position.
However, I am not sure what you want to do when it is at the right fret. I assume hold down the string while you play it? That is likely to be a bit difficult mechanically wise. Also I am not sure the whole thing is fast enough to actually play something.

I don’t play the bass but my son does.
Check out one of his songs on:- http://www.youtube.com/v/bBGqxSUlRBg

ha yes, i want to build kind of a bass robot.

the head pushes a small rubber wheel against the string, and if i can work it out, there will be a mechanic built in to lift the wheel off the string and /or a mute mechanic. If the lift/mute won’t work, it’ll be fine too. there is a magnetic hammer which slaps on a string, and of course it will not sound like a human played bass at all. the hammer does rhythmical stuff (it’s quite fast), while the printer head pitches around based on a MaxMSP patch. At least that’s the plan. Really looking forward to programming weird basslines.

for the printer motor; it’s a standard DC and works fine with 9V input. the slide has a range of about 40 cm, sufficient for fret 1 through 12.
so i’ll definitely need position sensing i guess… it doesn’t have to be super-accurate (±5mm should be okay enough). It also just needs to detect 12 ‘hot spots’ on the fretboard, with the head being capable of moving from one spot to a specified other…

so yeah, the next important step is how to get/build a 12-step position sensing system which sends noob-friendly data to arduino…
i’ve also been looking for linear potentiometers… what’s used in mixing desk sliders. But can’t quite find anything appropriate (inexpensive) yet.

nice song btw!

You could use 12 photo transistor / photodiode pairs and have a small “arm” or “flap” on the moving part that goes between the diode and transistor and use that to report the position. You would of coruse have to keep track of whitch direction you are moving somehow.

In the printer you scavenged the motor mechanism from you can probably find at least one of these photo transistor / photodiode pairs. They are frequently used in printers to detect when the printhead reaches “the end” of it’s allowe travel. They are usually encased in a smal “U shaped” black plastic package.

Another good source for photo transistor / photodiode pairs are computer mice (old ones from before optical mice) they usually have two pairs.

I think each photo transistor / photodiode pair could be hooked up to Arduino like any other switch, but i have not tried that.

EDIT:

I think (like Grumpy suggested) a stepper motor would be a better solution for this task, it’s not exactly trivial to control a DC motor with the precision you need. Some printers have stepper motors for printhead movement, but most have a DC motor. On the other hand, most printers use a stepper motor to feedthe paper, maybe you could hack the whole assembly to use the steppermotor in stead of the DC motor ? (probably mechanically difficult)

thanks for the help!
i have some of these transistors from old mice… but the more difficult part for me is to figure out how to merge the signals from the twelve transistors or whatever is used into something that doesn’t use up all of arduino’s pins. There must be some sort of basic ICs for this task, but i have no idea what to search for exactly… kind of like a 12-way switch, but the other way around?

the print head does pretty much instantly stop when power is turned off, so it should be accurate enough to hit a note clearly when it’s stopped at the position hot spots.

The stepper solution has a few disadvantages imho: probably less power and speed, and there is way more math involved, as the program would have to calculate: the distance from current fret to the target fret, where the spacing between frets is not even but decreases towards the bridge. Also there would be no way to detect the actual position of the head, so probably it would offset over time if the math formula did not exactly match the neck proportions… With the DC and pos detection in contrast, the head control program would be pretty simple (again, i guess): “give voltage at suited polarisation until pin n says I”.

thanks for the help!
i have some of these transistors from old mice… but the more difficult part for me is to figure out how to merge the signals from the twelve transistors or whatever is used into something that doesn’t use up all of arduino’s pins. There must be some sort of basic ICs for this task, but i have no idea what to search for exactly… kind of like a 12-way switch, but the other way around?

the print head does pretty much instantly stop when power is turned off, so it should be accurate enough to hit a note clearly when it’s stopped at the position hot spots.

The stepper solution has a few disadvantages imho: probably less power and speed, and there is way more math involved, as the program would have to calculate: the distance from current fret to the target fret, where the spacing between frets is not even but decreases towards the bridge. Also there would be no way to detect the actual position of the head, so probably it would offset over time if the math formula did not exactly match the neck proportions… With the DC and pos detection in contrast, the head control program would be pretty simple (again, i guess): “give voltage at suited polarisation until pin n says I”.

OK two things you could do:-

  1. Add a wheel and opto slot detector to your DC motor and count the pulses so you know where you are. This is like the old type of mouse worked, the one with a ball.

  2. Use something like a 74LS148. It’s a 8 line to 3 line Priority encoder to gather your sensors into a few inputs. As you want 12 inputs you will have to cascade two together, it shows you how in the data sheet.

okay thanks a bunch!
the priority encoder is perfect! (if i can figure out how)

hi

Just a idea for sensing posistion, you could use some resistance wire along the lenght of the guitar wired as part of a voltage divider, the more wire the current has to go through (posistion) the higher the resistance, the voltage could then be measured by a analog input on the arduino.

Lee

hi

Just a idea for sensing posistion, you could use some resistance wire along the lenght of the guitar wired as part of a voltage divider, the more wire the current has to go through (posistion) the higher the resistance, the voltage could then be measured by a analog input on the arduino.

Lee

Good in theory but a nightmare mechanically. Over time the wire oxidises and makes intermittent contact. Plus the wire resistance is too low meaning it will draw too much current.

To hook up the 12 sensors you need to multiplex the digital inputs on the Arduino board.

Check this:

To hook up the 12 sensors you need to multiplex the digital inputs on the Arduino board.

No this is wast full having to clock a shift register or multiplexer every time you want to read it. In this application only one sensor will be triggerd at a time and so a 74LS148 is a much better solution.

Oh yes, i didn’t think about the fact that only one switch wil ever be on at any given time.