Shop OBEX P1 Docs P2 Docs Learn Events
Motor as a rotational sensor? — Parallax Forums

Motor as a rotational sensor?

julijonasjulijonas Posts: 4
edited 2006-06-17 23:05 in BASIC Stamp
Hello,

I would like to ask you how to make a small motor as a rotational speed sensor for microcontroller, i.e. I want to pick up the output from the motor (as from a small generator). Should·I need to amplify voltage the motor produces (it produces from 0 to 0,7V)?·Shall I use RCTIME?·How here to protect a microcontroller from damage?
Thank you!

·

Comments

  • A.C. fishingA.C. fishing Posts: 262
    edited 2006-06-15 10:52
    I don't think that the motor will produce enough electricity to harm the stamp, and the IO pins are really sensitive. I don't think RCTIME wpuld be nessesary.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Somebody said...
    -Never Underestimate the power of human stupidity.
    ·
  • julijonasjulijonas Posts: 4
    edited 2006-06-15 11:24
    Shall i use PULSIN to measure the voltage?
    Thnks
  • Tricky NekroTricky Nekro Posts: 218
    edited 2006-06-15 12:12
    I would be fairly easier to use encorders...



    You need a bridge of diodes because the current produces by a generator is AC and then RC time is a good solution...

    I have something in mind that might help (A doc about RCtime circuits but I don't remember the exact URL)...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • steve_bsteve_b Posts: 1,563
    edited 2006-06-15 13:39
    You haven't said what kind of motor it is!? How about how fast you'd be going...
    AC/DC motor?

    Personally, I'd try to optically isolate the motor windings from my stamp....get creative and use a lightbulb on the motor (rated properly of course) and put it in a box with a photocell. Use RCTime with the photocell to see how its resistance changes with the light levels from the motor speed.

    an A/D works too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-15 14:08
    Steve has a point..You should definately isolate the motor from the Stamp pin.· If the output really is only 0.7V max then the BASIC Stamp would never see anything but a low on the pin.· An A/D converter might be in order.· I guess it depends on whether you're just trying to detect that it is spinning or how fast.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tricky NekroTricky Nekro Posts: 218
    edited 2006-06-15 16:11
    hehh... I forgot that... the guys before are right... Using a optocoupler is just the best solution and then a ADC...
    Look for 1KC317... should do the trick for ya...

    Provas, Greece

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • steve_bsteve_b Posts: 1,563
    edited 2006-06-15 17:01
    If you use an optocoupler....would an ADC still be valid? Does the opto vary at all with it's input....or does it just go "on" when the right voltage is reached?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • julijonasjulijonas Posts: 4
    edited 2006-06-15 17:36
    I want to measure the speed of the motor. I think the motor is DC, from small RC car(http://www.animenmore.com/gs05.shtml).
    Could I solve this without additional IC's, e.g. using RC circuit with common-base amplifier? Does optocoupler transfer variable voltage or binary (i.e. is it analog or digital)?
    thnks
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-06-15 17:46
    Assuming the DCmotor voltage varies analog you might consider this circuit, works for me.· If it's PWM then you'll have to add a diode and a cap to the input (before the 4K7)

    attachment.php?attachmentid=40518
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-15 18:13
    Hello everyone...Optocouplers generally are considered analog devices·since within a certain range you will get a fairly proportional output in relation to the input.· Remember, there is a lower range and an upper range where you're not going to see anything significant in changes in the output for two reasons.· For starters the LED will require a minimum amount of voltage/current to start lighting up.· Second since the phototransistor will also require a certain amount to start conducting.· Once that happens the transistor will conduct increasingly until it reaches saturation.· This concept was used by a forum member who built a charging/monitor circuit for his electric car.· Monitoring the range of voltage of car batteries with the Stamp required feeding the outputs through a trimmer pot into the opto, then the outputs were read by the ADC.· This also allows calibration of each circuit to compensate for varying part tolerances, etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tricky NekroTricky Nekro Posts: 218
    edited 2006-06-15 20:20
    Have a look at these optocouplers especially the last one... Download their data sheets and have fun...



    4N25,· AN-3001,· PC2SD11NTZ······ ·cool.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • julijonasjulijonas Posts: 4
    edited 2006-06-16 16:29
    Thanks for the suggestions!

    ·
  • RinksCustomsRinksCustoms Posts: 531
    edited 2006-06-17 22:55
    If your looking for an easy solution for rotational measurement the Brushed DC motor can be of some value. It's fairly simple in theory, but full of drawbacks. One of the more complex problems is that there are multiple "contactors" on the armature (the part that spins with the wire on it). With one diode connected so that the stripe/neg lead goes to ground and the other lead of the diode to one of the connectors on the motor, the other connector will now produce positive pulses. Unfortunately you'll probably need an osciliscope to measure just how many pulses per revolution you get. I just tested a 3-12VDC Radioshack hoby motor on my osciliscope (off e-bay for $20 used), and i counted 6 pulses per revolution. I'm pretty sure that your motor will have different internals than mine, so you'll have to measure the PPR yourself somehow. If you don't have an osciliscope (not many people do), you can google "discover circuits" and look for a simple comarator circuit using an LM741 IC to light up an led when it sees even a small voltage at the input. You could then mark the shaft or put a piece of sturdy tape on the shaft and count how many times the light comes on when you rotate the shaft, you'll have to rotate the shaft slow to get an acurate count.

    If you don't go through all this trouble, you won't know how many pulses per revolution to compensate for in your code, and you'll frustrate yourself with false readings.

    Although, if you like simple, you can scratch up a few bucks and spring for a hall effect sensor, more acurate, more stable in opperation, no (resistor capacitance), or voltage spike/regulation issues associated with "conditioning" a pulse that becomes increasingly difficult with increased armeture velocity through a magnetic field coupled with "brush noise" (false pulses from carbon buildup on the armature).

    I'm sure the last bit was completely overkill but I figured i would throw 2 cents in, i thought it might be helpful for future troubleshooting. Me personally, I'd just go get a hall effect sensor from the parallax store, they even include code examples (which would be smaller and faster than the coding you'd need to compensate for multiple pulses per revolution).
  • RinksCustomsRinksCustoms Posts: 531
    edited 2006-06-17 23:05
    Oh yes, almost forgot, an ADC does what? It converts an analog voltage to a digital value, while you could measure the voltage being generated and sclae it for a reading, wouldn't you have slower code, not to mention the calibration of the scaling factor would be difficult, would it not?

    You could utilize a hall effect sensor and maybe a real time clock module to get truely acurate readings, maybe with less coding too.
Sign In or Register to comment.