SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By Mee_n_Mac
jacopomtk wrote:Using paint wire is not a problem,but i don't understund if it's the wire to be painted with 2-4mm section or it's the distance at which the wire can be from the sensor.
It cost a little bit but do you think i need the digital Breakout board?
Since i need to use 2 of them instead of 1 encoder (instead of 12 encoder i've 24 sensor),doesn't it mean that i've to read every input with more speed?
What's an indicative max speed of the wire with section of 2mm?
Hopefully the attached pic below will explain my thinking. The "wire" is painted, alternating between white sections which reflect the IR light and black sections which don't. The detectors are spaced so one goes from detecting to not-detecting when the other is in the middle a section. Thus there are 24 detectors and 24 outputs, same as you had with 12 detectors and A&B outputs for each one (=24 outputs). I don't know the response time of the detectors above but it'll be fast, measured in usec.

Now this idea will be more of a PITA to do but would allow you to keep high speed wire motion with good resolution and won't wear out as quickly (did you check the spec for the encoders ?). Perhaps you can come up with an even better concept. 8)

ps - which digital breakout board ??
(wire moves left <-> right and/or right <-> left)
You do not have the required permissions to view the files attached to this post.
Last edited by Mee_n_Mac on Tue Nov 29, 2011 11:06 pm, edited 2 times in total.
By Mee_n_Mac
BTW the above was just to get you thinking about an alternate way of getting the same type of data your present scheme tries to get. I gave it a bit more thought at lunch today and I think I have a much better, easier and pretty sure it really will work way. It's a hybrid of the above and your scheme. I'll make another diagram when I get a chance but consider a pulley like you have, with the wire wrapped around it. It's mounted just like before but on a shaft, no encoder. Instead the pulley has alternating stripes of white and black. There are 2 detectors like I have above that "look" at these stripes on the pulley. As the pulley rotates each detector "sees" alternating reflective and non-reflective portions of the pulley. You get pulses out like before. Making 12 pulleys w/stripes has got to be easier than painting wire every 2-4 mm ! You've basically made your own version of the rotary quadrature encoder, but using electronic sensors instead of mechanical switches, which might just solve your speed vs settling time problem. Whether you could find and buy a better encoder for less $$s than you it'll cost you to patch together your own is another question.
By Mee_n_Mac
Just to illustrate my prior ramblings on using 2X the number of shift registers to minimize the number of ports reads to get all the data in. In the below I use the aforementioned 8 bit shift registers but I only use 4 of their 8 bits. So they are loaded (input the encoder to the SRs) at whatever sample rate is deemed nessecary. Then their data is clocked out at 4x the sample rate and the port read after each clock to get the 4 bits of data. Process the 6 bits of data as you see fit. Do this over and over and over, adding in the occasional A/D read and output of whatever message you need to output.
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
And while my insomnia persists ...

I didn't show any circuitry between encoders and the shift registers in the above. Perhaps, if you get a better encoder or make your own, it won't be needed. But let's say you reduce the max speed of your wires and thus your pulleys and encoders, at least for some initial demo and so stick with your initial choice. Let's further say the prior question re: the V1 and V2 offset voltages is to be ignored. This still leaves you with how to handle the bouncing/chattering. Well the app note for the switch ... ... ommon.html
... suggests this simple (partial) debouncing circuit.
I would modify some of the values slightly but the general idea is that when a switch has been open for long enough and the open/close/open/close/open bouncing has settled, the capacitor gets charged up to 5V (or whatever Vcc you choose) through the 2 resistors. Using the above values for Rs and Cs, this charging up will be quaranteed to be done if the switch has just 1 msec of settled time. after the bouncing stops, before it has to switch to a closed position.

Then when the switch closes, the cap is drained through 1 resistor to ground. I'd make this resistor value much smaller than the 10K they use but I do understand the switch is only rated for 0.5 mA of current. The general idea is that as the switch bounces from closed to open to closed, etc; and that each time switch closes the cap drains to a lower voltage quicker than it charges up when the switch bounces open. Ideally when voltage gets low enough the shift register will record it as a logic 0 and this takes a shorter time to happen than the time it takes for the switch to completely settle to a closed position. Thus you'd want to use the open to close transition (logic 1 to logic 0) as the state transistion to figure out if a pulse happened and in then in what direction the encoder is rotating. Still, the software has to be "smart" (whenever you read in the port and try to figure out what state the encoder was really in) knowing that the switch might still be bouncing on the closed to open transitions.
By jacopomtk
The optical sensor way seems the more affordable i think,with ~20$ i can have 10 sensor that are enough.
I the max length the wire should move is 3 cm so isn't so hard to paint 5 wire for 3 cm.
I it would have moved for an half meter than yes,painting it will became difficult :mrgreen:
So i prefer the two sensor solution instead op the pulley+optical one.
Unfortunately the speed of the wire can't be less that 2-3in/s
I meant this breakout board since it could be more easy to read from digital signal.

Yes,the shift register solution was similar on how i understood and yes,i can use it since those register are cheap :D

So,staying to the 2 sensor solution,assuming (...knowing :roll: ) that more simply is the electronic part (i'm a programmer) is that it's better,should i take the breakout board for the sensor?

Sorry if i prefer easy solution instead of efficient one but i really have hard time on understanding what to do using.. "non ready" components :roll:

By Mee_n_Mac
I thought you were going to have 12+ wires, hence the need for 12+ encoders. If you are really only going to have 5 wires and 5 encoders (10 digital outputs) then they may be a lot easier ways to do this. Remember the whole reason for the mux and all the fast polling/sampling was that the Netduino only has 14 I/O pins.

Assuming you need 12 or so "encoders" and want to make your own linear opto versions, I have to ask how "fat" are these wires ? I'm now thinking that they're pretty small diameter as you're only moving ~3 cm. If they are "skinny" it may make it hard for the detector to see the difference between a white section and a black section. Can you give us some better idea of the whole concept of what your doing ? It may help in trying to find a way that works best. Only moving 3 cm but at up to 7.5 cm/sec means some pretty large accelerations and decelerations. Now I'm concerned you're trying to make a controller to start, move, stop all these wires in +/- 3 cm and that's has a lot of other problems with it ... namely trying to get your Netduino + PC to react quick enough. And with only 3 cm of movement, my guess it that gears and rods would be better than wires.

As for the breakout board ... let me think about it but I don't believe the digital version is the one you want. I think you want the analog version. The digital version will output short pulses when the detector changes state going from black to white or white to black. You need logic levels dependant on the white or black being detected, not a short pulse that comes out only at the transistion which might get missed. Unless you really only need 5 wires, 10 detectors. Then you might want to use the digital version ... for reasons I can explain if this is the case.
By jacopomtk
Ohhhh My mistake!!Yes,i need a lot more sensor!!!! omg :roll:
Sorry,yes,now,reducing everything to the minimum amount of thing i need...I still need 8-10 encoder OR 16-20 sensor...
Ok,anyway basically i'm trying to make a controller (mainly for fun..),doing this: (using encoders so it's simple to explain)
-i'd like to try getting the angle in wich the wrist/fingers are.
-the encoder/sensor are attached to the arm and their position are fixed so they won't move.
-the others end of wire are attached to the finger.
-having the angle range within fingers are moving (for calibration calibration),and having how much the wire is moving i can get the current angle of each finger.

(i don't want to do this for all finger,so i don't need encoder for every finger,it's just to try)
So that's it...

By Mee_n_Mac
Interesting ! Your version of a dataglove.

May I ask why you didn't use something like the below to measure the flex/angle ? Supposedly that's what they've been used for in the past. Using something like this would simplify the electrical end of your design. And simplify the software too I think.

I can now understand why something like the linear encoder thingee I suggested would be beneficial. It would be flatter, thinner and my guess is that this part would mount on your forearm (where thin is nice to have). Of course something with pulleys and springs wold have a kewl steampunk look. :mrgreen:

I've got some thoughts on how to better make a better linear encoder than what I proposed earlier. Give me some time to think it though and I'll bore you some more with it at a later point in time.

BTW : Can you explain your thinking on how all these sensors/encoders get used ? Can I assume that the 12 are for both arms, 6 per arm, 1 per finger and 1 for the wrist ? That somehow all the encoders go to a single Netduino ? Because if this is the case you might want to consider a couple of options that would make things simpler though at a slightly higher cost (perhaps another Netduino).
By Mee_n_Mac
Mee_n_Mac wrote:I've got some thoughts on how to better make a better linear encoder than what I proposed earlier. Give me some time to think it though and I'll bore you some more with it at a later point in time.
So instead of looking "up" at some painted wire, I think it would work better if instead you made a clear film to look through and then obscure sections of it (so light won't pass through it). This could be mounted in a rigid frame (if needed) and attached to the wires you've been talking about. I've assumed the other end would be attached to a sping of some sort, no matter what encoder scheme you'd use. Why is this better ? Well for one thing I'm now thinking your wires are of tiny diameter and so detecting the IR light reflected off them won't be easy. You could do a scheme like the below but with the aforementioned reflecting/detecting sensors but I don't know how wide the pattern of light coming off their transmitter LED is. This way that doesn't matter, you can control the light that gets to the detector. Ideally you want a sharp transition from on to off and off to on so the detector makes as binary a signal as possible.
[alternate idea : drill holes in an opaque slider]
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
And just to really confuse you ...

You could do something that's mechanically similar to the above but use some slide pot instead of an encoder. This would be like using the flex sensors and have the advantage that you'd only read the pots as often as you needed to such as when sendimg a message from the Netduino to the PC. At each read you'd have the position of the wrist and fingers, no need to keep track of all the incremental movements since reset to know where the wrist and fingers are. The question would be whether you could get the resolution you want ... does 4 mm of motion make a big enough change in % of resistance ... and is it repeatable ? ... ?P=1z0vkp2