1

I'm looking to create some kind of "pianoplaying" Pi robot. I started to look into ways to create some kind of "arm" that can make a lateral movement and came across solenoids.I'm looking to create three arms and was thinking that I could use three solenoids for the movement of the arms and three solenoids to push the keys down on the piano.

What I need to know though is if it's possible to determine the range of motion for the solenoid using the GPIO library? Since it will be needed to determine which pianokey that should be pressed. If not is there a better simple way to create an arm that makes a lateral movement where you're able to decide the range of motion?

2

A quick rule of thumb for if the GPIO is suitable for some type of input is to ask if the information you want is digital. That is, if the information you want is either on or off. Considering you're looking to track a variable position, the GPIO probably isn't suitable.

You might be able to use a linear encoder of some type and use the GPIO to count pulses and hence position. The general solution for variable input however is to use an analogue-to-digital converter like an MCP3008 combined with a potentiometer. (This is what an XBox or PlayStation controller uses for an 'analogue stick'.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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