Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Controlling a Servo with ONLY a PC Audio Card and Flowstone

For general discussion related FlowStone

Controlling a Servo with ONLY a PC Audio Card and Flowstone

Postby granta1969 » Mon Apr 29, 2013 8:21 pm

Hello. I've been working on a little project for a while that hasn't gotten anywhere recently. I first started it with Synthedit and asked a lot of question on the synthedit website but now I've decided that it's probably more appropriate to ask over here on the flowstone website.

Basically what I'm trying to do is use my ordinary pc sound card to send the correct PWM signal to an ordinary servo controller.. the kind you'd find on an RC car. the one i'm using is a Turnigy TG9e 9g / 1.5kg / 0.10sec Eco Micro Servo. I got this one because it's super cheap. like £2.50 each. It's highly rated and it's not digital. It's tiny. The reason I've ventured into this odd experiment was because of handful of videos on Youtube that show people using their audio card signal to move the servo left and right. No other hardware required. You basically send the servo a .9 to 2.0ms pulse at 40 to 50HZ. Well, I've designed the software and with a lot of help from people on the synthedit website, I've put together something that should work.

But as of now, I don't seem to be able to control it. Usually when I send the signal it does nothing at all. once in a while, I've gotten it to respond but it's vibrating and shaking really badly and although it moves from left to right when I tell it to, it's just a mess. Other times it will just swing directly to one direction and stop when it reaches the end of it's trajectory. then nothing. the servo runs on 4.8 volts, but i'm giving it 4.5 but I dont' think that would be the reason. I put in 5 volts and it did the same. the power supply is clean because it's a battery pack.

when I look at the waveform in my software, it looks exactly like the waveforms generated with other software.. I've even tried using a program called Daqarta which someone else on the internet used to generated the 50HZ pulse. I followed their technique and it didn't produce the same results.

is it possible that it's just the servo I chose to use? Someone else on the net who used a sound card displayed a small schematic for a tiny two transistor amp that would bump the frequency to "drive" the servo. I'm using the amp module in flowstone to drive it. is that only going to create distortion on the output? Perhaps a EQ filter would be appropriate here to help filter out unwanted signals. I also read somewhere that the frequency of the soundcard output has to be properly divided by the pulse signal but it was way over my head. I have the sound card set to 48khz output but setting it to 44khz hasn't made any different and when I set it even higher it made no difference.

I've also used two different computers. my main desktop and also tried it with my laptop. no real difference in the output.

I thought that before I go and buy another servo I would ask for some advice here in case someone might have a good idea. I've reached the point where I'll sit here for a good 7 hours just trying things and get no where..

I've been working on this for ages and spent a long time creating the software and now I'm at a standstill. Any help would be greatly appreciated. I'd really like to get my project finished. :-)

take it easy,

Grant
granta1969
 
Posts: 7
Joined: Fri Sep 21, 2012 5:11 am

Re: Controlling a Servo with ONLY a PC Audio Card and Flowst

Postby trogluddite » Mon Apr 29, 2013 11:38 pm

granta1969 wrote:small schematic for a tiny two transistor amp that would bump the frequency to "drive" the servo. I'm using the amp module in flowstone to drive it. is that only going to create distortion on the output?

I would say that this is the area that you need to look at - from my small experience of them, servo's are usually pretty tolerant of slight errors in the exact frequency etc. - they often used to be driven by analogue circuits where even the values of individual components can vary by 5-10% or so.

There are a couple of things that might make the soundcard output incompatible electrically...

1)
The voltage level from the soundcard- strength of the signal, so to speak. Especially with cheap consumer cards, the level is likely to be quite low - just enough to drive a small pair of ear-buds, usually. A servo running from 4.5-5V probably needs the 'on' part of the pulses to be around the 3.5-4V mark to be reliable - which could well be out of the range of the soundcard's output circuits.
As you suspect - boosting the signal in FlowStone, won't take it any higher than the soundcard circuitry allows.

2)
Outputs for sound are generally designed so that the voltage goes plus and minus, either side of the 'silent' zero voltage - whereas a servo would expect only zero or a positive voltage. I doubt that a negative voltage would do it much harm - but a signal centred around zero will, again, shift everything downwards - reducing the level of the 'on' pulses.

So an electronic circuit to 'condition' the signal by removing the negative voltages, and boost the 'on' voltage sounds like what is needed. It needn't cost you much - a couple of pints of beer should easily cover the components (Rapid Electronics are a good cheap on-line source) - though of course, there's a bit of soldering to do, so you might need a few tools.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Controlling a Servo with ONLY a PC Audio Card and Flowst

Postby granta1969 » Wed May 01, 2013 3:08 am

="trogluddite
I would say that this is the area that you need to look at - from my small experience of them, servo's are usually pretty tolerant of slight errors in the exact frequency etc. - they often used to be driven by analogue circuits where even the values of individual components can vary by 5-10% or so.


Hey Trog.. thanks for the input. I was the guy who was tearing apart the X-box controller along time ago to make a midi foot controller. It came out really well. I eventually used arcade style buttons because they are super soft to press but yet are very quick and responive. the great thing about those buttons is that they come in a million different colours so you can really set up a dynamic looking controller. Remember you said that you were going to take the xbox controller into work and hook it up to some of your equipment and see if you get some good PWM's coming out.? did you ever do that and if so, what did you discover.?

I really struggled for while getting the hang of synthedit but now after all this time, it's becoming really easy to think creatively with it. I'm now just starting to learn Ruby. I've also been playing with the Raspberry Pi 2. I'm really getting into the whole creative idea of connecting software to the outside world.

which brings me to my current project, the one I was describing with the servo. What I'm doing is trying to create an ultra cheap (and I mean cheap) way to connect a sound card to a servo without having to add electronics of any kind. the reason being is that I want anyone to be able to copy the project themselves without having to buy anything other than a servo and perhaps an ultra cheap audio cable. (perhaps a soldering iron, etc.)

I mentioned before that a lot of people on the net have had luck doing it. I've seen a lot of videos. it's nothng more than the audio card driving the servo by sending it 50HZ and altering between .9 and 2.5ms or so.. (depends on the servo I suppose). But after reading your reply I see that perhaps they're having luck because of the particular card they are using. Some ASUS medium range audio cards (£100) come with amps built in and you can even change out the OP amps (a bit of novelty I suppose) to alter the colour of the sound. Perhaps they are using something like that? I'll figure it out eventually.

but let me tell you about the creative idea I had. I've been in digital photography for a long time and I own a variety of cameras. One of them is a tiny little Panasonic Lumix 10 megapixel. lovely little camera but it's getting a little dated now. It has one awesome feature though. the black and white high contrast grain effect is better than any other camera I've ever seen. It's just amazing. Nothing else about the camera really stands out as exceptional though. this black and white grain effect also lets the camera take pictures really quickly one after the other at a full ten megapixels. One day while in Saint Andrews, I was walking by the old graveyard and just snapped about 10 pictures one after the other as I was walking along. when I get home and put these onto my computer and view them with my picture view, one right after the other, it gave me a cool stop motion film effect and of course that really gave me a creative buzz. since then I've been thinking about ways in which I could create my own stop motion camera interface that would be easy for anyone to build and would work with any camera you might have. I'd like to be able to set it up and leave it for a day and make time lapse films of the amazing cloud formations that I get here in Glasgow. I'm up on the 18th floor and overlooking the centre of Glasgow so I have an amazing view. I also have an interest in making stop motion animation films and if you stop to think about it, an inexpensive 10megapixel camera could basically give you picture quality to produce an HD film. I've always been a big fan of the brothers Quay.

and on top of that, with my previous experience designing an interface for the x-box controller, I'm suddenly seeing a lot of potential of using flowstone to create an all in one time lapse/stop motion editor. One button triggers the camera and then the image is transfered (via one of those SD cards with built in wi-fi) to your hard drive where it's then uploaded into flowstone. You press another button on the controller to preview the last several frames and see if they are fluid. If you don't like it, you delete it from both the hard drive and the camera. I'm wondering if Flowstone could output the bitmap image onto it's another video monitor, since my graphics supports dual monitor ouuput. I would probably output the video to a small HD television so I could see how it would look on t.v rather than a computer monitor. I also have no idea how to even begin working with bitmaps in flowstone and it might take me a while to learn enough ruby to figure it all out.

So thats my current project that has been entertaining my imagination for some time now. I've always wanted to capture the entire day or week in time lapse and also explore strange weird stop motion film and to have the flexibility to use any camera I want. I have the software designed for the most part.. just having a hard time getting my servo working..

take it easy,

Grant
granta1969
 
Posts: 7
Joined: Fri Sep 21, 2012 5:11 am


Return to General

Who is online

Users browsing this forum: No registered users and 11 guests