Welcome! Log In Create A New Profile

Advanced

Reprap Host software over USB on Android

Posted by WiESELMan 
Reprap Host software over USB on Android
November 05, 2012 07:31PM
I am an Electrical Engineering student starting work on my Senior design project that involves an Android to Zigbee bridge device with an Android App and an Android Accessory.

I'm also a Reprap nut, and want to help contribute to the cause. I was thinking a good first step for my project would be to write an Android app that would use the USB port on an Android phone (I have an extra LG Optimus) that acts as a touch screen controller for my 3D printer.

I have been looking around quite a bit looking for other projects to fork and build from, but I haven't found any clear options. I have seen the bluetooth Reprap app but all I would end up using from it is the front end and i think I should just start from scratch with that.

I have a few choices that I need to make before I go forward. Ultimately I would like to make this program have as many features as people have requests, but I need to start somewhere.

I need to decide if I am going to start with the Android Open Accessory Protocol, or the Android Host API.

If I use the Open Accessory Protocol, the set up necessary to run the app would be as follows:

Android Device requirement:

Any phone or tablet with Android 2.3.4 and up.

This lets more phones come to the party, from what I understand this is something like 80% of Android phones in use. I have my extra LG Optimus that would fit the bill.

Reprap controller requirement:

Controller with USB host capabilities.

This really limits things, the only controller that I can think of off the top of my head would be an Arduino ADK or Arduino Due with a RAMPS Shield. Luckily I have an ADK with a RAMPS 1.4.

Firmware requirement:

Forked firmware with Android Open Accessory Library included as an alternative source of communication.

I was thinking of just forking Marlin and pushing commands sent over the USB host connection to the command buffer instead of the FTDI/AVR USB to UART.

If I use the Android Host API I have the next set of requirements:

Android Phone requirement:
Any phone or tablet with USB OTG (on the go) and Android 3.1 and up and a USB OTG cable (5-10 dollars on Amazon/Merritline)

This limits the devices quite a bit, mostly phones released in the last year and tablets that are made by a big company (Samsung, Asus, Toshiba, Motorola)
I have a Galaxy Nexus and a Nexus 7 that I can develop with so this is not a problem.

Reprap controller requirement:

Technically any controller that has a common USB driver, FTDI/Atmel USB to UART (Arduino w/Ramps, Sanguinololu, Gen 5/6/7, MightyBoard), or a Microcontroller running the USB Device stack in CDC mode (PrintrBoard). The Android app would need implementations using both drivers, but really all that would be is enumerating different vendor IDs

Firmware requirement:

I would think that any firmware would work as long as the app speaks its flavor of G-code and the firmware doesn't have some strange timing requirement.

Believe it or not but I think the first option would take less work to get working. I would only need to write the app to talk to one firmware (my fork) and to talk to one controller (ADK w/RAMPS). But my final project will require that I use the CDC driver because I'm using an MSP430F55xx with USB Device.

I would love to hear your feedback/comments/suggestions.

Thanks

WiESELMan
wiesel.ece.utah.edu
Re: Reprap Host software over USB on Android
November 06, 2012 11:02AM
This is a good idea. Would love to see it implemented.

Good luck with CDC USB Driver smiling smiley
Re: Reprap Host software over USB on Android
November 07, 2012 07:49AM
My recommendation for this is to make the code modular. Printrun is a good example:

- low level python library for communicating with the printer
- mid level command line interface (uses the library)
- graphical interface (uses the library)

This makes it easier for other people to use parts of your work for their own purposes (if it will be open source). That in turn results in more popularity and hopefully more changes being submitted back to you. Also it makes it easier for you to maintain.

Good luck, Andy

Edited 1 time(s). Last edit at 11/07/2012 07:50AM by ajayre.
Re: Reprap Host software over USB on Android
November 08, 2012 08:46PM
Of coarse It will be OSS. I wouldn't have it any other way. And no silly adverts or donation versions.
I will host everything I do on a public Github page (not made yet).

I think I have come to a conclusion on what I will shoot for on the first version.

I will use the USB Host drivers and that will likely be the only interface for a while so that means:

Android Tablets that have been updated to 3.1 and above.
Phones that have been updated to 4.0 and above.
Any other ARMv7 single board computer dev board what ever with Android 3.1 and above, that includes:
Beagleboard, beagleboard XM, BeagleBone, Pandaboard (I mention these because I have them and will test them with ICS/Jcool smiley
I will try it on a Raspberry Pi with the latest built for it but I don't have one so it won't be priority.
Anything else (OLinuXino, APC) I will do what I can.

I plan to use the usb-serial-for-android library hosted on google code at:
[code.google.com]

So that means I will start with ardiuno based controller boards (FTDI USB to UART).

My first build (APLHA) will pretty much be like the GADGETS3D panel (move the head, hopefully run stuff from SD ramps)

[reprap.org]
Re: Reprap Host software over USB on Android
November 11, 2012 02:25PM
Why not have the USB-host offer one (additional or only) endpoint with the media-profile?
That would accept g-code files without the need for a host software.
Run, pause, control(rpm/feedrate/temperature offsets) and monitor the program via the printer's interface (screen and keys)


PS: this forum software still sucks. It didn't allow me to post without logging in fist but didn't offer the login right in this form and after login did not remember the already entered text, the thread and even the forum I was in.


-------------------------------------------
* homeprototype free 3d design repository
* Blog
* Google+
Re: Reprap Host software over USB on Android
November 11, 2012 02:52PM
Interesting idea. So if I understand what you are saying, the android device would in essence act as a flash drive/sd card with host capability. That could be an extra mode that I add at a later date.

To be honest I'm really making this for my use case first:

I have:
a printer
and arduino
a ramps 1.4 with 4 pololu stepper drivers
No SDRamps
No control panel
Think printrbot kit with nothing but the printrboard.
I do all my control and g-code streaming with my laptop.

Yes I could just buy a control panel for 50 USD but I have an excess of android devices and ARM dev boards (I am an embedded systems engineer).
I would just port Printrun to android but unfortunately python on Android does not have access to the USB port.

I also think this is the first step to get the whole process (stl download, slicing/gcode generation, printing) being done from the android platform.

I think I have the Android UI stuff mostly figured out, I now need to get all the usb stuff working (the important part)
Re: Reprap Host software over USB on Android
November 11, 2012 04:19PM
Nice , I've been preparing to start this project myself but haven't had any time since I was busy building my first printer ( prusa v2 , ramps 1.4 ) smiling smiley
I for one was gunning for the second option though I haven't had any real experience with the ADK or arduino scripting till recently

My reasoning for the API is that :
1.You don't need to load a special firmware on the printer
2.Root isn't needed in most cases
3.Cross devices - will operate with any firmware / android device since its native to the OS , are there any printers that don't use arduino and can make use of the serial connection?
4.To the contrary from what you said I believe there are plenty devices right now that support usb host mode ( it doesn't have to be "otg" ) - if not by stock then by custom rom

The question is if there is any technical limitation to the java api going further?
I'm a little bit puzzled by the usb-serial-for-android library you linked , it doesn't use the ADK as far as I can tell so it relates to the API route
I'm saying that since I actually saw a couple of apps that use the java API and native kernel/userspace drivers at the same time ( the drivers are mainly used to get low latency stuff afaik )
It's possible to use the 3 methods simultaneously to allow flexibility

here are a couple of stuff I meant to rely upon while researching further into this , you might find them helpful too:
[android.serverbox.ch]
[github.com]
[github.com]
[github.com]
[github.com]
[github.com]
[play.google.com]

I will defiantly try to find time and help with the effort whatever road you take and I have plenty of devices to test it with ( n1 , hd2 , galaxy nexus , galaxy s , galaxy note , nook color and finally nexus 7 grinning smiley )
Re: Reprap Host software over USB on Android
November 12, 2012 12:04AM
Getting Android USB host mode to communicate with FTDI/Atmel UARTs would not just allow controlling Repraps. The code could be re-used to allow an Android device to program an Arduino or communicate with one in any other way that a regular PC can (as well as other devices using the same USB-serial protocol). Frankly, I think it's pretty stupid that Android/Arduino connections weren't done this way from the start.


[whosawhatsis.com]
Re: Reprap Host software over USB on Android
December 01, 2012 11:13PM
whosawhatsis Wrote:
-------------------------------------------------------
> Getting Android USB host mode to communicate with
> FTDI/Atmel UARTs would not just allow controlling
> Repraps. The code could be re-used to allow an
> Android device to program an Arduino or
> communicate with one in any other way that a
> regular PC can (as well as other devices using the
> same USB-serial protocol). Frankly, I think it's
> pretty stupid that Android/Arduino connections
> weren't done this way from the start.


Hey guys! I am trying really really hard to understand this. Having done much programming in the past (buy stopping just past babycode), I'm really an engineer, and the subject matter is really beyond. Can you explain this one in particular to the novice better? What other application is there here? You want to flash the arudino with an android? You want 2 way communication? why?

IMO, this is the way I envision a printer, since my laptop is slave to the printer right now. A wifi networked android device (droid X/ tablet / etc) would be tied to dropbox. You put the gcode from a main computer there. The android only has to open the gcode and parse it line by line (not load the whole thing!!) since some can go into 500 MB easily. Then it simply executes a TTL command to arduino over android USB (if that is possible). It is highly valuable I think. A droid X used costs ~ $50 I think, plus I have some lying around.

How far along is this project right now? Is seems there are a few hardware options, but many are confusing. Also the bluetooth module is $40 and I think it even needs a TTL converter of sorts. In my experience bluetooth isn't reliable and powers down - then is a pain to reconnect.


Measure once, Cut twice, Print 3 times.
Re: Reprap Host software over USB on Android
December 13, 2012 01:30PM
Hi, my EAST Lab class is creating a RepRap machine. We have it built and some people are working on creating files that we can print with the machine. Could anyone tell me how we could get this running off of a Nexus 7 running Android 4.2.1? Has anyone even got that far yet? Please let me know because I would like to have it running off of my Nexus by the time we present it at National Conference in February. Anyone talk me through programming it myself?


Thanks,
Chris Stephens >grinning smiley<
Re: Reprap Host software over USB on Android
December 13, 2012 01:32PM
I've been looking actively and have found an android programmer to help with the project, but, dont expect anything before feb.
Re: Reprap Host software over USB on Android
December 13, 2012 01:52PM
Darn. Couldn't instruct me a little? No way to see it happen? We're hoping to win "Best Of Show".
Re: Reprap Host software over USB on Android
December 13, 2012 02:13PM
Okay. Steps to complete:

1. Download Android SDK
2. Learn Java
3. Learn Model-View-Controller programming paradigm
4. Learn USB CDC protocol
4.5 Read the rest of the thread
5. Copy and paste some Arduino code in for blog cred
6. Pour over ice
7. shake in a Boston shaker for 20 seconds
8. Pour into a 3D printed cocktail glass
9. Download to arduino
10. Enjoy
Re: Reprap Host software over USB on Android
December 13, 2012 02:13PM
I'm clueless :-)
There is usb to blue tooth available though
Re: Reprap Host software over USB on Android
December 13, 2012 03:48PM
What if we wired a blutooth transciever into the RepRap, and then put another one on the laptop. Would that work IYO? Then it would improve us having wires all over the place, and we could have someone sit to the side and control the printer. That would probably help us win. Another thing, too. Is there a way we could lock it down so no one could hijack our RepRap's bluetooth functions?


Thanks,
Chris Stephens
Re: Reprap Host software over USB on Android
December 13, 2012 03:49PM
Its already been done. Buy the bluetooth > arduino module. From my impression, bluetooth isn't reliable enough for this though, signals drop out.
Re: Reprap Host software over USB on Android
December 13, 2012 04:19PM
Bluetooth works, but it's best used to control a printer that is going to run its print from an SD card rather than streaming the gcode over the bluetooth link. There are good setup instructions on the Bukobot wiki: [bukobot.com]


[whosawhatsis.com]
Re: Reprap Host software over USB on Android
December 13, 2012 04:39PM
A better way to go would be a decent Ethernet solution for the RepRap electronics, then host software could pretty much be trivially hosted on anything.
It would also resolve the USB cabling issues that people seem to have.
Re: Reprap Host software over USB on Android
December 13, 2012 05:25PM
Yes, but the OP wants to control it with android. I don't know of android devices with Ethernet.
Re: Reprap Host software over USB on Android
December 13, 2012 05:41PM
Simba Wrote:
-------------------------------------------------------
> Yes, but the OP wants to control it with android.
> I don't know of android devices with Ethernet.

Don't most have Wifi?
You might need to increase the internal buffer sizes to deal with the additional latency of Wifi, but there is more than enough BW to do it.
Re: Reprap Host software over USB on Android
December 13, 2012 05:48PM
Adding Ethernet = money spent on extra stuff plus a computer is still being used to trickle G-code
using android phone/tablet/pandaboard = no extra money and my phone that was idle already is doing something while it is sitting.

That way I do computery stuff on the couch where I can watch my son. If my computer is teathered to my reprap in the bedroom I can't work, print, and watch my son at the same time.
Re: Reprap Host software over USB on Android
December 13, 2012 06:01PM
Polygonhell Wrote:
-------------------------------------------------------
> Simba Wrote:
> --------------------------------------------------
> -----
> > Yes, but the OP wants to control it with
> android.
> > I don't know of android devices with Ethernet.
>
> Don't most have Wifi?
> You might need to increase the internal buffer
> sizes to deal with the additional latency of Wifi,
> but there is more than enough BW to do it.

Save for us older gen guys who see ethernet as equivelant to hardwired connection.....

Good idea. if only there was a way to eliminate the cost associated with a wifi shield, and the uncertainty whether or not wifi shield is compatible with the ramps add on
Re: Reprap Host software over USB on Android
December 15, 2012 02:45PM
How do you use the Bluetooth app for android? Does it work?
Re: Reprap Host software over USB on Android
December 17, 2012 06:19PM
I haven't used it, but I talked to the developer. He said that you connect a bluetooth to arduino module directly to the RX/and TX lines. You then pair the items and send gcode with his software. Apparently it works. I do not know more details, sorry.
Re: Reprap Host software over USB on Android
July 07, 2013 05:48PM
Hi,

There is already TinyG on the market to control cnc and send gcode over usb tablet but it won't work fot my tablet.
I have aGOCLEVER i71 with 2 usb prot's adaptor but i have android 2.3.3. and it is not recognized by the tinyg app.

I was wondering if it is possible to install linux on the tablet and run a linux host for reprap therefor run a reprap autonimusly from the tablet.
Hope it helps. Sorry for my english.

Good luck.
Re: Reprap Host software over USB on Android
August 22, 2013 11:10AM
There is a beta version of GCode Simulator for Android available witch supports real printing over USB-OTG cable.
See [www.dietzm.de] for more details.

cu

Mathias
Re: Reprap Host software over USB on Android
September 05, 2013 10:01AM
Are you looking at using the Arduino Android ADK board for this?

Just about to order a ramps 1.4 and arduino mega but wondered about getting the android board just in case I want to go this route later on but don't want to run into any incompatibility problems by deviating from the normal arduino mega R3. All I could find is that the android board was compatible with the normal R3 pinout but thought it prudent to check.

Edited 1 time(s). Last edit at 09/05/2013 10:05AM by doc_ap.
Re: Reprap Host software over USB on Android
September 05, 2013 10:27AM
GCode Simulator does not require the Arduino ADK, it works with the normal Arduino Mega and a USB OTG cable + Android device.

cu

Mathias
Re: Reprap Host software over USB on Android
September 07, 2013 10:43AM
I know a lot of people especially in the Printrbot community that would die to be able to slice or print and edit from their android tablet. Weve all been waiting for a long time to be able to do this. So more power to you and I definitely will be following your progress.


--------------| For Everything |--------------------------
Check it out here:
[reprapsquad.wordpress.com].
---------| For Everything Prototype Related |------
Now featuring comp case mods:
[RepRapLab.wordpress.com]

--------------| Find us at Twitter|------------------------
@REPRAPSQUAD (RS Main)
[mobile.twitter.com]
@REPRAPSQUADHQ (ProtoLab)
[mobile.twitter.com]
woo
Re: Reprap Host software over USB on Android
November 21, 2013 01:01AM
[www.3ders.org]

i have tried demo on my phone, looks great in 4.5" display.


next month il buy some cheap 7" tablet just for controling printer,,,i think the only condition is that tablet has dedicated port for charging battery, not over usb otg becouse its used for controlling in my case ramps+arduino.

and sad thing i just have installed smart controller :lol:
Sorry, only registered users may post in this forum.

Click here to login