Saturday, 24 May 2014

mechanical - Is it possible to control and reverse the direction of a dc motor through a headphone socket?


Yesterday, I found that it was possible to control a servo using a headphone socket with a fairly simple circuit. I've got a project where I need to to control a dc motor via a headphone socket. Is such a thing possible? I basically need it to rotate at various speeds as well as change direction quickly. Apparently it is possible to modify servos to rotate continuously but none of them seem to have the speed I require for my project


Here's some context as to why I need this. Yesterday, I had an idea on how to automate the black card technique in landscape photography where you move a black card up and down in front of the camera during a long exposure. I want to build it on the cheap so this is my design:


enter image description here


Animated and annotated versions


The DC motor is stuck to the bolt, which is rotated. The nut is stuck to the plastic cylinder so when the bolt rotates, the cylinder travels up. If you reverse the current, the cylinder travels down. The DC motor therefore needs to work in both directions with the headphone socket circuit. As this is already quite a bulky setup, I'd rather not build a whole arduino into it so if I could get it working via the headphone socket of my phone or music player, that would be ideal!



I've never really done much electronic engineering before so go easy on me please ;)


Any help is much appreciated!



Answer



Within reason, it is possible to drive almost anything from a headphone socket if you have some 'smarts' on the other side decoding the signal. As you have said, you'd prefer not to use the Arduino, but there are of course much smaller microcontroller systems if physical size is a problem.


For bidirectional control of a DC motor, you need at least a power supply and an H-Bridge. It would actually be possible (with perhaps some risk to your phone) to drive the 'A' channel on the H-bridge with your left audio output and the 'B' channel with your right audio output. This makes some assumptions which may or may not be true depending on your phone, for example, that your audio output is DC coupled (that is, it will pass a very low frequency signal). Of course, you would likely have to use a transistor on each input to shift the levels from ~1V P2P to ~5V P2P (if you are using a common H-bridge chip such as the L298). So you are looking at probably about half a dozen parts anyway including passives.


Probably the best thing is to invest in doing it the 'right way' by devising some simple digital protocol which may be transmitted by your software and using a simple microcontroller on the device. It would be fairly straightforward to do with even the simplest 6-pin microcontroller.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...