USB servo via trinket

by unixnerd777 on Wed Oct 30, 2013 4:01 pm

I got the 3V trinket yesterday and then realized the 8MHz vs 16MHz. I got the trinket to be a hardware volume knob, so I ordered the 16MHz trinket and am trying to use the 3V 8MHz as a USB servo controller (sorta a combination of http://learn.adafruit.com/trinket-fake-usb-serial and http://learn.adafruit.com/trinket-gemma-servo-control). Has anyone gotten the usb serial to work in linux (I would like to see an example of how exactly to use the python script mentioned in the guide). I was thinking of using http://www.servocity.com/html/spt200_pa ... ystem.html and http://www.servocity.com/html/hs-985mg_ ... orque.html -does anyone know of a cheaper solution?

At the very least, I need to be able to SSH over the internet and move it, defaulting to a wider shot if I loose connection. I will probably achieve this via dvgrab | tee >(ffmpeg -i - -qscale 10 disk_quality.mp4) >(ffmpeg -i - -an -s 300x300 -qscale 40 small.mp4 #for streaming). I intend to use OpenCV to track, but am having problems with background subtraction ATM (I have face detection working, but he tends to turn his head when he walks to the side, which it doesn't follow).
unixnerd777
 
Posts: 3
Joined: Tue Jun 18, 2013 9:37 pm

Re: USB servo via trinket

by adafruit_support_mike on Thu Oct 31, 2013 12:07 pm

unixnerd777 wrote:At the very least, I need to be able to SSH over the internet and move it, defaulting to a wider shot if I loose connection. I will probably achieve this via dvgrab | tee >(ffmpeg -i - -qscale 10 disk_quality.mp4) >(ffmpeg -i - -an -s 300x300 -qscale 40 small.mp4 #for streaming). I intend to use OpenCV to track, but am having problems with background subtraction ATM (I have face detection working, but he tends to turn his head when he walks to the side, which it doesn't follow).


You seem to have run ahead of your details. I have no idea what 'it' you're trying to control. You certainly won't be able to connect to a Trinket with ssh or run ffmpeg on it.. the microcontroller only has 8k of Flash memory and 512 bytes of RAM.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7029
Joined: Thu Feb 11, 2010 1:51 pm

Re: USB servo via trinket

by unixnerd777 on Thu Oct 31, 2013 1:22 pm

I am trying to use the trinket as a bridge between a SSH-able linux system, and the servo (to control the servo over USB) I may also get another trinket to run a IR LED to control the camera's zoom.
unixnerd777
 
Posts: 3
Joined: Tue Jun 18, 2013 9:37 pm

Re: USB servo via trinket

by adafruit_support_mike on Thu Oct 31, 2013 5:33 pm

Okay, that makes more sense. I take it you want to use the FakeUSB interface to send information from the Linux machine to the Trinket.

I don't recall any posts with people using the fake USB script on Linux, but that's usually a good thing. We mostly get conversations here in the forum when something /doesn't/ work as expected.

I'll send a note to Frank (who wrote that tutorial) and see if he can give you any advice.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7029
Joined: Thu Feb 11, 2010 1:51 pm

Re: USB servo via trinket

by adafruit on Thu Oct 31, 2013 6:17 pm

Any USB data requires 16mhz, so it wont work well on the 3V trinkets - that is considered overclocking. honestly, the USB-fake-serial is a bit of a hack, if you cant get it working (reliably) with a 5V trinket, go with an Arduino Micro :)
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: USB servo via trinket

by frank26080115 on Thu Oct 31, 2013 6:28 pm

The tutorial does tell you how to use the script. Did you try it?

http://learn.adafruit.com/trinket-fake- ... -slash-mac

The steps were to install Python and all the required Python libraries that are needed. Then to setup the virtual bridge using the "socat" command. Then just run the Python script "TrinketFakeUsbSerialHostSW.py", then just start using Arduino like you normally would.

Try it out.

I'm not sure on how to provide more details in the instruction unless you give me specific questions or specific error messages to solve.
frank26080115
 
Posts: 120
Joined: Fri Jun 15, 2007 12:04 am

Re: USB servo via trinket

by frank26080115 on Thu Oct 31, 2013 6:44 pm

keep in mind that USB fake serial is designed for people who do not want to learn how to use USB properly

the majority of the setup process for the fake serial port involves... well... some hacked up solution that makes a fake serial port, this complexity in the installation is the trade off for simplicity in the usage.

you sound like the kind of guy who might benefit from using true USB protocols. a servo controller sounds like the kind of application that might benefit from using simple control request messages. You'll end up with better responsiveness, it will be less error prone, and it will take up less code space. This is because control requests have a defined structure. Remember, "serial" is not inherently packetized, while control requests are. A servo controller is definitely something that benefits from something packetized.

If you use "serial" instead, then you'd have to define another custom protocol layer and thus write a parser for that layer, which is always a pain in the ass. Also my fake serial protocol is not designed to be fast.
frank26080115
 
Posts: 120
Joined: Fri Jun 15, 2007 12:04 am