Driving Arduino from PC- not the usual!

I can do the Arduino end of the following, I think. I wasn't sure how difficult the PC end would be, or where to start...

It seems to me that now parallel ports are not common, and "hard" to fit to a laptop(!), there would be a place for an Arduino running a trivial program.

I'll explain my idea in simple terms. There's a "frill" I would introduce, if I can find an interested party....

The Arduino, continuously connected to a host PC when being used in this application, would monitor it's serial port, watching for strings of three ASCII characters. The first character, in this simple scenario for forum discussion, would be a "d" for "display" or "r" for "report".

On receipt of a "d" string-of-three characters, the Arduino would interpret the 2nd and 3rd characters as a byte expressed in hex, and put that byte on 8 of the Arduino's i/o pins. (Those pins having been initialized as being for input as part of the Arduino's general init sequence.) You'd probably want the Arduino to then send the byte (as hex-in-Ascii (two characters) plus a checksum character) back to the host PC as a confirmation. We're going to need that "back to the host" channel for what comes next, anyway. Might has well keep things similar for the "d" scenario and the "r" scenario.

On receipt of an "r" string-of-three characters, the Arduino would ignore the 2nd and 3rd characters.... but it would read what is present on however many pins were available to dedicate to being inputs, and send the reading back to the host PC, again as hex-in-Ascii (two characters) plus a checksum character.

As I say... I'm not sure what would be best at the PC end. Maybe (for Windows) a .DLL, which could be made available as an open source entity, with the compiled DLL available to those who just want to make use of it, and the sourcecode there for others? I trust there's something like a DLL in the Linux world?

Of course, if the Arduino end is done properly, there is nothing to stop the wider community from re-inventing, and re-inventing again and again better "wheels" to work with the Arduino "USB Parallel Port Replicator".

The idea of using a DLL is to make using the whole Arduino-as-digital-I/O-over-USB a "unit" which can be "plugged into" bigger projects. I would be prepared to consider handling distributing pre-programmed Arduinos to people outside the Arduino community... on a non-exclusive basis. If anyone else thinks they would like the headaches, they are welcome to take them on!

So.. that's my idea, my "dream product".

If you think you could work something like that up, and would consider doing so, but need a reason... contact me? If this idea takes off, i.e. gets refined in a discussion here at the forum, I might consider paying someone for the development work.

See....

http://sheepdogguides.com/arduino//proj/ppr/ppr1.htm

... for a more thorough discussion of this idea, including the details of the "frill".

This sounds a lot like what Firmata and bitlash do. There are already Firmata interface libraries that can be plugged directly into applications and used to control the Arduino from the PC / Mac.

For instance I could use this one to write an app for Windows / Mac / Linux without writing a single line of code for the Arduino.

Sems likely Robert is right... but neither he nor I have the time to do the "modest" work to put everything together.

If anyone can build what i spec'd, I don't mind if it doesn't take "much" work, due to using Firmata and bitlash... although a "from scratch" answer, with no "stuff" adhering would be more attractive.

Still mostly worried about the PC side... but maybe Firmata (BitLash?) can generate the .DLL (or similar) I'm after.

You don't need a DLL. Any programming language can access a serial port.

For some users of what I'm hoping to create, you are quite right.

However, the idea behind using the .DLL (or similar) is to make the services I would put into the Arduino accessible to a wider audience of users.

Perhaps the .DLL is a distraction. If anyone wanted to do an implementation of the project (described more fully at the web page cited above) but which used Hyperterminal (or similar) for the PC end of things, that would attract some of the development fees I mentioned. Of couse the "extra frills" wouldn't be possible, but it would be a start.

The eventual goal is to create a product which others can buy as a "black box"... they don't need to know (much) about the Arduino, they don't need to know about serial I/O...

All they need to know about the Arduino is that pins a,b,c...h are the outputs, and pins j,k,l... are inputs.

The idea is to give even novices a replacement for the parallel port, as used years ago by hobbyists for simple digital I/O.

If your goal is to implement a "virtual" parallel port, then the 8 bit's you are mentioning are not enough.

The parallel port has a handfull of other pins that is used to signal various conditions. Some are pins the the PC should read. This might or might not be a problem depending on what the parallel port is used for.

Also there might be some timing issues when you first send the bytes over a serial link and then have to interpret them with Arduino and then set / read the pins.

You can get USB to parallelport converters rather cheap!

Understood: My UPPR won't "do" for connecting a printer. But, happily, that's not what I want it for.

The "Parallel port via USB" adapters may work okay for driving printers, scanners, etc. (though with 40 years of compter experience, I think my reluctance to believe it is based on more than my inherent pessimism)...

.... but I've tried them for "LED fun", etc... and got nowhere.

Thanks for trying to help, but I REALLY DO want to do what I described!! :-)

If you believe that opening a serial port and sending or reading a handful of characters is too complicated for your target audience, I think you’re severely underestimating the average programmer’s intelligence.

A serial port is just about the most cross-platform concept you’ll find. If you write code to wrap the serial port, it’ll be a DLL of just a few lines, and talking to the DLL will take as much coding as talking directly to the serial port. And you couldn’t possibly duplicate the effort for every platform and language out there. It would narrow, not widen, the possible audience.

Crossplatform solutions are as simple as deciding to work with JAVA, Python or TCL for example.

I can't imagine that the DLL approach is the simplest.

If I were to do this... I'd probably add a shield to the arduino that had 2 PCF8574's and then use I2C to manipulate the 8 pins on each device to treat is as input or output on command.

It would be great if this thread reached someone who wants the money that is on offer to do something that is, I believe, quite simple. In the meantime, I can but continue the "Why do it that way?" discussion. I'm sorry that my initial post, and the more extensive discussion at the webpage...

http://sheepdogguides.com/arduino//proj/ppr/ppr1.htm

...seem not to have conveyed very well what I am trying to do/ arrange to be done. (I'd do it myself, apart from "the day job"s, and weak .DLL creation skills!)

My product, as envisioned, would open a lot of fun to people who can barely get their computer to say "Hello world". I have a page on the web about using the becoming-extinct parallel port for fun things, and it has been very popular for years. (No, I don't get paid for anything off of that site, unless you count pennies in Adsense revenues from Google.)

ALL the NON-PROGRAMMER user would need to do would be....

Buy the pre-programmed Arduino, complete with USB cable... this is what I'm trying to bring to market, at a reasonable price, with marketing open to anyone who can be bothered. Put the .DLL (or similar) on his/ her system. Put a small XLM worksheet function on a page of an Excel worksheet ... That would define UpprOut, a connection to the .DLL Put a number in one cell, and a call to UpprOut in another.

Once that was done, each time the worksheet was refreshed, the number in the cell would be passed to the output pins of the Arduino.

And that's just one quick example of the sort of thing a non-programmer, or novice programmer, could do.

Yes... FOR A PROGRAMMER dealing with serial streams is not the end of the day... but there are many, many people out there who are not programmers, but who can follow simple "cookbook" instructions.

Furthermore, there are many people out there who are not programmers yet, but would like to learn. While they can manage, in whatever language you want to name, the equivalent of....

print "hello world" print 5+5 .... and, if my product ever gets out there, to copy a file to a .DLL folder, and put....

call(UpprOut(47))

... in a program. They (beginner programmers) are a long way from being able to manage serial streams.

=== If anyone has information on why my idea is a non-starter via a .DLL, I'd be delighted to be educated. But, in this case, I'm not particularly interested in "Why don't you do it this way?", unless "this way" provides a similar very, very simple "outward face" for the customer: Someone who knows nothing, or only very little, about programming.

I hope you'll understand I wasn't ungrateful for the "do you want to do it that way?" posts.

Tom

(Oh yes... a little "PS": Open Office's spreadsheet (and probably the other components, too, e.g. the wonderful dtabase) can access .DLLs too... I cited Excel because it is used by more people... at the moment!)

I'm so sorry. I guess we were trying to add fodder to the discussion and it's not wanted. Maybe we are just too geeky and not looking to make extra cash from the Arduino so we have the wrong mindset.

My problem is, even after reading all of your information (yes, I did read it) I'm not convinced yours is the best way for a complete novice. I mean... who are these people and why do they only understand the parallel port interfacing? Your DLL idea seems to be such a niche thing that I think excluding the MAC's and LINUX might not serve you well. I honestly can say I can't wrap my head around the intended audience...

Are these like ELEKTOR readers we are talking about or are we talking about folks that know nothing about electronics of programming but want to create Christmas light shows?

Regarding "extra cash"....

I'll be delighted if anyone but me takes on supplying the units, if they ever get built. The design is to be open source. Anyone supplying them in such a marketplace will not, I hope, be able to charge for more than their materials, something for their time in programming the Arduino, and the hassle of packing and posting the thing... and dealing with the customers who will return it "because it doesn't work" after they've done something foolish and fried it.

If someone does manage to sell such a device for, say, $50 above costs, maybe the product isn't so un-wanted anyway, and maybe someone kind, but not quite so greedy, will come in and sell it at $40 above costs.

If I got fewer "how do I do these things on my parallel-port-less laptop?" enquiries arising from my (not-for-profit) page about using the parallel port, I would forget the whole thing.

Regarding "excluding Macs and Linux"....

I would be very disappointed if a Linux box could not be given something like a DLL (or, as I have said repeatedly, somehting similar)... I just don't know Linux well enough, yet, to use the right term.

In any case, and to address the "niche market" question, I can't see why, if the product were created along the lines I am proposing, there would be nothing to stop the intermediate programmer of any system, in any language, from talking to the device via the serial routines which have been mentioned several times. The product might even be a great "first serial project" for someone learning about that corner of programming.