Home › Forums › TinyG › TinyG Feature Requests › First test of Android CNC app
- This topic has 35 replies, 4 voices, and was last updated 12 years, 5 months ago by greyhound716.
-
AuthorPosts
-
April 27, 2012 at 8:33 pm #1146greyhound716Member
As some of you know, I’ve been working on some non-PC CNC controller options. Ultimately I’d like to get a direct connection between my Android tablet and TinyG, but as a first step Riley and I have been working together to have my Android app talk via the network to his tgFX GUI. I have a link to a video at http://randommusicdesign.blogspot.com/2012/04/android-cnc-app.html, and you’ll hear the CNC motors running in the background. No shots of tgFX right now, but that’s coming along really nicely too.
Let me know if this is something you’re interested in as well, and what features you’d like to see in the app. Next step is to make it a little more user configurable and robust, filling in the Android bits, and then I want to take a little time to review the design.
April 30, 2012 at 8:50 pm #1147RileyKeymasterVery cool stuff! Looking forward to more integration in the future!
ril3y
April 30, 2012 at 9:00 pm #1148aldenMemberSecond that! Really nice work.
– Alden
May 8, 2012 at 9:36 am #1149greyhound716MemberThanks. It’s starting to come together. I’ve added some new display capabilities, allowing you to interrogate (and soon change) the TinyG settings (motors, axis, system). In the process, I’ve run into a problem with tgFX. It seems to only be sending me every other JSON response from TinyG. I can confirm the lines aren’t being sent from tgFX, and if I use the same app pointing to a simple serial to network java app, I get all of the data. I assume it’s related in some way to the OK handshaking, but I haven’t looked into it too much.
Most of the base functionality on a small scale (phone sized) unit is there. I still have to do some work on file uploads and I’d like to see if I can get the fragments to work properly on a tablet-sized unit. I hope to have a real demo out in the next week or so.
-MattMay 11, 2012 at 4:33 am #1150lpdcMemberHello,
I am very interested in this project of yours as I am also considering controlling TinyG from my android ICS tablet.I had only started to think of the way to do this before I saw your post.
I am intending to use SL4A and python/pyserial on the tablet as python is the language I am most proficient with.The major difficulty will be to find drivers for the FTDI chip on Android.
On the FTDI website there is a document explaining how to build a kernel with FTDI support or how to build a kernel module but this is quite above my skill level.
I am running Cyanogen Mod 9 on a HP touchpad so I will check if the drivers are possibly already included (I read that some Cyanogen Mod distros ship with the drivers) I will only be able to make sure of this when :
-> I have received the TinyG I ordered yesterday
-> I have found a way to plug TinyG into the tablet (requires a cable with micro USB on one side and mini USB on the other)looking forward to reading from your progress,
Fabrice
May 11, 2012 at 9:12 am #1151RileyKeymasterJust use bluetooth and get a hardware bluetooth serial port adapter. Of course I have not tried this yet. But it should work…
http://www.dealextreme.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299?item=4
Something like that..
Not sure why you want to play with SLA for talking to tinyg. I think that will be pretty cumbersome.
They way Matt and I came up with was 2 things. The bluetooth way / direct serial port or using a network connection to tgFX.
You could use SLA and use the network connection to connect to tgFX too if you wanted that way you do not have to mess with kernel drivers etc..
Riley
May 11, 2012 at 10:01 am #1152lpdcMemberHello Riley,
I am aware that using SL4A can appear cumbersome but as I said, Python is by far the language I am most proficient with, so for me it is more a matter of being able to doing it at all, rather than doing it elegantly.
I will probably first write a controller to be used on a PC. This controller will be written in Python so installing SL4A on the tablet would enable me to port the controller very effortlessly, provided I can get the serial communication working.Thank you for the tip regarding the bluetooth serial port adapter, this is also something that may prove interesting to look at.
From what I understood, going through tgFX means having TinyG connected to a computer and driving it wirelessly from the tablet. I am looking forward to seeing how this solution evolves but my original idea of driving TinyG from the tablet was to make the system very portable and do away with the computer altogether.
Cheers,
Fabrice
May 11, 2012 at 12:39 pm #1153greyhound716MemberFabrice,
I have a Viewsonic tablet running ICS, and it sees the FTDI natively. On my github site (https://github.com/mattstock), you’ll find a few applications I think you will find useful. In particular, the USB-Device-Info app that I forked will be able to tell you if your tablet sees the USB device at all. If yours is similar to mine, it should show up.
I’m looking to do the same thing you are. If you look at one of my other github projects android-tinyg-usb, that’s going to be my solution for what you describe. I’m using the USB host mode API to obtain the I/O streams, and from that point on the interactions will be similar to my existing jogger application.
If you want to play around but you aren’t ready to use tgFX, I also have a NetToSerial java program you can run on your PC connected to TinyG. Use the android-tinyg app to connect to the PC via your wireless network. I need to put together some documentation on this soon.
The Android architecture I’m planning to use will involve a “core” application (android-tinyg) that has the main UI and the network-to-tgFX code, and a helper application that have an Android service and a few setup activities that will connect directly via local USB in host mode. If you want to use USB, you’ll need to install the 2nd app, but it shouldn’t require much else.
If you have any thoughts about the design or want to help with testing, let me know.
-MattMay 11, 2012 at 12:47 pm #1154lpdcMemberMatt,
Thanks a lot for these details.
I will have a look at your github files and will be eagerly following your progress.Fabrice
May 11, 2012 at 7:35 pm #1155greyhound716MemberSince the basic jog code is working fairly well, I’m putting some work into the USB code. Lot of loose ends, but before I polish anything up I want to get all of the parts working. I’ll try to get another video up this weekend.
-MattMay 15, 2012 at 8:36 am #1157RileyKeymasterBTW, Matt… I got bluetooth working with TinyG directly. Now you COULD just use BT to talk to TinyG from your table.
It was SUPER EASY to do.
Power the bluetooth chip, plug in the TX RX wires to the “Arduino” Female header on TinyG. Connected with “blueterm” android app and was able to send commands.
FYI.
Riley
May 15, 2012 at 12:33 pm #1158greyhound716MemberCool. The difference between bluetooth and USB I suspect isn’t very high at a programmatic level. If blueterm exports a service I can use to talk to it from another activity, it might be worth supporting as another “endpoint.” I don’t have a bluetooth chip right now though, and frankly I’m concerned about gcode file transmissions/flow control and interference. It’s taking me a little longer to refactor the code to support talking to a service in another android app, but I believe I should have something soon. The learning curve on the deep Android stuff has been steep, but the code is getting cleaner the father I go.
Some things I’m working on:
Broadcasting of TinyG status info – any activity can listen and get data.
Messaging to send TinyG commands – works between apps, which is needed for USB.
Common abstraction for network and USB drivers – makes adding more features easier.
Display and edit machine parametersOnce I get the current feature set working reliably with network (again), I’m going to get the rest of the USB stuff together. The hardest part of this is actually having the user select which USB device to use!
I’ll do a longer demo video once I get the network part functioning. More when I have it.
May 19, 2012 at 2:21 pm #1159greyhound716MemberI got the USB serial code working! It’s going to take me a little while to integrate my testing code into the TinyG app itself, but now that I know how to set the line control settings, it’s mostly a matter of writing the correct buffering code. libftdi was a huge help.
Fabrice, do you have your TinyG yet? If so, are you willing to give the code a test run? Should be ready in a day or two.
-MattMay 19, 2012 at 4:58 pm #1160lpdcMemberThanks for the update Matt.
I haven’t received my TinyG yet, hopefully it should arrive next week.
The first step for me before I can test your code will be to check if the Kernel drivers for FTDI are installed and if not, to find a way to source them.Fabrice
May 19, 2012 at 10:52 pm #1161greyhound716MemberThe USB mode seems to be working fairly well – I’m getting some spurious junk in the sr responses every so often that I have to track down. Doesn’t impact functionality.
I’ve uploaded binaries to github for both the base TinyG for Android app that supports network connections via tgFX, and the USB Service which allows direct connection for Android 3.1 and up using USB host mode. See https://github.com/mattstock for details. I want to do some additional tweaking to make things more robust before I publish to Google Play.
I’m having trouble getting decent video – focus issues on the tablet screen. It’s very cool though – this is exactly why I bought the TinyG.
-Matt -
AuthorPosts
- You must be logged in to reply to this topic.