Shop OBEX P1 Docs P2 Docs Learn Events
Line Level to Servo Movement — Parallax Forums

Line Level to Servo Movement

uliuli Posts: 6
edited 2004-12-01 16:59 in BASIC Stamp
Hi All,

I have a strange question: I want to move Servos by feeding in a line level (music) the servo should move proportional to the volume of the line signal. How do I do that with a stamp and/or is there an easier way to convert voltage into servo-signals? Thanx a lot for help!

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2004-12-01 09:34
    Uli -

    This may not be not a complete solution, but it should give you the builing blocks to reach your goal. A number of manufacturers, Texas Instrument among them, offer voltage to frequency conversion chips. These chips take an analog voltage as input and output a digital frequency which is directly proportional to the level of the input voltage. I would imagine you could then read that generated frequency into a Stamp (via PULSIN or some other method), and then develop an appropriate time parameter to be used in a subsequent PULSOUT. The time parameter calculated by the Stamp may need to be ranged or modified as well, to fit the requirements of the servo. The PULSOUT would drive a servo within the limits of rotational swing that you require. Here is a typical voltage to frequency chip from Texas Instruments:
    http://focus.ti.com/docs/prod/folders/print/vfc320.html

    You may need to condition, limit or adjust the input voltage (line level) to ensure that it falls into an appropriate range prior to the frequency conversion. I'm sure one of the analog gurus can assist you in doing that, if it's required.

    Regards,

    Bruce Bates
  • K de JongK de Jong Posts: 154
    edited 2004-12-01 13:58
    Hi Uli,

    You could use a simple rail to rail opamp (TLV271, or TLV272 for Stereo) and a single diode and capacitor to get a positive signal that goes up and down with your music. Then some simple ADC to convert the generated voltage to numbers in your Stamp, with these numbers you then should be able to control a servo.

    Klaus
  • uliuli Posts: 6
    edited 2004-12-01 14:55
    Hi Klaus, bedankt voor uw help! May I ask one more question? What exactly does "rail to rail" mean? Does the output go between Gnd and Vdd with the same frequence as the input?

    Thanks one again,



    Uli
  • K de JongK de Jong Posts: 154
    edited 2004-12-01 15:44
    Yes, I will answer your qouestion.

    'Rail to rail' means that the opamp can operate on a single 5Volt power supply and that the output will go from (close to) 0 Volt to (close to) 5 Volt. Classic opamps such as the well known uA741 or the OP27 require a dual power supply of -15 and +15 Volt.

    So, 'rail to rail' is far more easy to use smile.gif.

    The output will go in the same frequency but I would suggest you charge a 10uF capacitor by putting a diode from the output of the opamp to the +side of the capacitor. Then discharge the capacitor with a resistor 10k to 100k (experiment) placed from +capacitor to ground.

    Klaus
  • uliuli Posts: 6
    edited 2004-12-01 16:03
    Hi Klaus,

    sorry for being ignorant but I think I still do not quite understand the role of the cap and the diode and how they must be connected. Let me try:

    Vdd = +5V

    GND= 0V

    in+ and in- are connected to the lineout (+/-)

    Out= to CAP via diode (diode open towards Cap, closed towards Out)

    Cap+ = to GND via Resistor

    Cap- = to stamp



    Is that right? Thanks very much,



    Uli
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-01 16:51
    The diode is to half-wave rectify your AC signal so your AtoD converter has some DC value to convert to a number for your program. The capacitor is to hold the DC value so you can sample it. The resistor is so the capacitor will eventually discharge -- otherwise it could charge to the loudest point and then just stay there.

    Your wiring looks correct, except CAP+ should go to the AtoD converter, not CAP-. IN- and CAP- should both go to ground.
    The capacitor's role is not to de-couple the signal (you might need another 10 uF cap for that). The capacitor's role is to hold the DC voltage so the ADC can read it. You then connect the ADC8031 converter chip to the BS2.
  • uliuli Posts: 6
    edited 2004-12-01 16:59
    I hope I got it smhair.gif. I will try it and then tell you· :-)

    Thanx a lot again,

    Uli
Sign In or Register to comment.