First test of Android CNC app

Home Forums TinyG TinyG Feature Requests First test of Android CNC app

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #1146
    greyhound716
    Member

    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.

    #1147
    Riley
    Keymaster

    Very cool stuff! Looking forward to more integration in the future!

    ril3y

    #1148
    alden
    Member

    Second that! Really nice work.

    – Alden

    #1149
    greyhound716
    Member

    Thanks. 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.
    -Matt

    #1150
    lpdc
    Member

    Hello,
    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

    #1151
    Riley
    Keymaster

    Just 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

    #1152
    lpdc
    Member

    Hello 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

    #1153
    greyhound716
    Member

    Fabrice,

    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.
    -Matt

    #1154
    lpdc
    Member

    Matt,
    Thanks a lot for these details.
    I will have a look at your github files and will be eagerly following your progress.

    Fabrice

    #1155
    greyhound716
    Member

    Since 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.
    -Matt

    #1157
    Riley
    Keymaster

    BTW, 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

    #1158
    greyhound716
    Member

    Cool. 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 parameters

    Once 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.

    #1159
    greyhound716
    Member

    I 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.
    -Matt

    #1160
    lpdc
    Member

    Thanks 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

    #1161
    greyhound716
    Member

    The 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

Viewing 15 posts - 1 through 15 (of 36 total)
  • You must be logged in to reply to this topic.