简体   繁体   English

使用Android设备控制电机

[英]Controlling a motor with an android device

I am trying to get a custom android app (running on a Packard Bell "liberty tab", android 3.2) to control an external motor. 我想获得一个自定义的Android应用程序(运行在Packard Bell“自由选项卡”,android 3.2)来控制外部电机。 No need for fine control, just a way to signal "on" and "off". 无需精细控制,只需一种发出“开”和“关”信号的方式。 Which port on the device can I use to get that output, and how do I program it? 我可以使用设备上的哪个端口来获取输出,以及如何对其进行编程? Being able to simply turn on or off the power on the USB would be perfect, but I read an answer to another question on this site that told me it is not possible with android. 能够简单地打开或关闭USB上的电源将是完美的,但我读到了该网站上的另一个问题的答案,该问题告诉我它不可能与Android。

I have been thinking of simply playing a sound on the headphone jack and then build a relay that will react to this current. 我一直在考虑简单地在耳机插孔上播放声音,然后构建一个能够对此电流作出反应的继电器。

For those wondering about the reason, the tablet is going to be used to train a blue-and-gold macaw (huge parrot). 对于那些想知道原因的人来说,这款平板电脑将用于训练一只蓝金金刚鹦鹉(巨型鹦鹉)。 The tablet is going to be set it up in her cage (suitably protected, but in a way so that she can use her tongue on the screen) with a program specifically written to train her and connected to an automatic feed dispenser. 平板电脑将被放置在笼子里(适当保护,但在某种程度上,以便她可以在屏幕上使用她的舌头)与专门编写的程序训练她并连接到自动饲料分配器。 What I need is a simple way of controlling this dispenser, which is also going to be custom build, probably with a small DC motor. 我需要的是一种控制这种分配器的简单方法,它也可以是定制的,可能配备一个小型直流电机。

如果平板电脑支持ADK(附件开发套件) ,这将是一个完美的应用程序。

有一些方法可以在Android使用RS232 (带有适当的适配器),因此您可以简单地使用串行端口发信号通知继电器或其他东西来打开/关闭电机。

If your tablet has bluetooth, I'm working on an RC boat controlled by an Android phone over Bluetooth. 如果你的平板电脑有蓝牙,我正在使用由蓝牙安卓手机控制的遥控船。 Basically I connected a bluetooth module and the speed controller for the motors to an Arduino and wrote some code the interprets signals from a program running on the Android phone. 基本上我将电机的蓝牙模块和速度控制器连接到Arduino,并编写了一些代码来解释来自Android手机上运行的程序的信号。 There are existing libraries that make this task very easy. 现有的库使这项任务变得非常简单。 Instead of these high power motors you can attach small servo motors to the Arduino directly, which is very simple and should be perfect for your case. 您可以直接将小型伺服电机连接到Arduino,而不是这些大功率电机,这非常简单,非常适合您的情况。

For details see this blog post . 有关详细信息,请参阅此博文

Just as an option, you could use an existing app that uses IR to trigger the camera shutter. 作为一个选项,您可以使用使用IR的现有应用程序来触发相机快门。 For example This one You can create the IR emisor very easily, check this video 比如这一次 ,您可以emisor很容易创建IR,检查该视频

Then you can use an arduino to get the IR signal and move the motor. 然后你可以使用arduino来获取IR信号并移动电机。 You have more information in this tutorial IF you're lucky, you might find something very similar and avoid having to start from scratch. 您在本教程中有更多信息如果您很幸运,您可能会发现非常相似的内容并避免从头开始。 Good luck, it sounds like an interesting project. 祝你好运,这听起来像一个有趣的项目。

You could use something like this, but no java binding out of box. 你可以使用这样的东西,但没有开箱即用的Java绑定。 Not sure if your tablet supports running a dll. 不确定您的平板电脑是否支持运行dll。

http://www.pc-control.co.uk/motorbee_info.htm http://www.pc-control.co.uk/motorbee_info.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM