DIY hardware interface for simple data collection and robot control?

For issues with communication ports, protocols, etc.
BasicCoder2
Posts: 3243
Joined: Jan 01, 2009 7:03

Re: DIY hardware interface for simple data collection and robot control?

Postby BasicCoder2 » Jan 22, 2018 23:12

grindstone wrote: "New" doesn't necessarily mean "better", and outdated or not, IMHO for h4tt3n's purpose the parallel port (if available) is still the best solution.

Good or bad the reality is the next generation will have to learn to use the hardware that exists today and that includes the USB port unless you want to build your own computer (which is essentially what the Arduino is) without having to worry about a multitasking operating system getting in your way. If a student ever gets into microprocessors they will learn all that stuff we had to know back in the good old days.

So I would say the best solution is to use what we have today to give the next generation the skills they need.

Just as an exercise I am attempting to use the Arduino to act like a parallel port to a FreeBASIC program. You just have to write your own FreeBASIC functions to imitate the OUT and IN QBASIC commands just as you can using the K8055 board. I don't know if it is possible to just use the FT232R chip to do it in a more direct fashion.
http://www.ftdichip.com/Support/Documen ... FT232R.pdf

The Arduino uses this circuit which you can use to make your own Arduino,
https://www.sparkfun.com/products/12731
grindstone
Posts: 527
Joined: May 05, 2015 5:35
Location: Germany

Re: DIY hardware interface for simple data collection and robot control?

Postby grindstone » Jan 23, 2018 0:44

BasicCoder2 wrote:So I would say the best solution is to use what we have today to give the next generation the skills they need.
I fully agree.

And anyhow I'll grope about a data latch IC here (I'm pretty sure I have one...somewhere...in some dark corner...or box...or...) to make the printer cable work.
MrSwiss
Posts: 2735
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: DIY hardware interface for simple data collection and robot control?

Postby MrSwiss » Jan 23, 2018 1:51

BasicCoder2 wrote:You just have to write your own FreeBASIC functions to imitate the OUT and IN QBASIC commands ...
Nope, you are on the wrong track, none of that, is actually required.

In FB you just have to Open Com (with parameters) to establish contact with the Arduino.
On which you have to implement (in Arduino C), what it has to do, in response to the
command (can be a single Byte, here) sent to it, which then sets/resets the respective
digital pin(s) of the Arduino (and, maybe sends back, a completed msg. to FB).

That is it, in short, how FB to Microprocessor communication works (aka: Serial coms.).

@grindstone,
just out of curiosity, I've today checked some prices. The Printer Cable and the cheapest
Arduino Clone, cost exactly the same (about US$ 15.-- , in Switzerland, Tax incl.).
BasicCoder2
Posts: 3243
Joined: Jan 01, 2009 7:03

Re: DIY hardware interface for simple data collection and robot control?

Postby BasicCoder2 » Jan 23, 2018 4:40

MrSwiss wrote:
BasicCoder2 wrote:You just have to write your own FreeBASIC functions to imitate the OUT and IN QBASIC commands ...
Nope, you are on the wrong track, none of that, is actually required.
In FB you just have to Open Com (with parameters) to establish contact with the Arduino.

Yes I understand that. It had to do with readability. Recognising it as being like the OUT or IN of a QBasic command. Just as these make use of the LINE command but will have the same look as my C++ functions that use the SDL library. Easy translation between the two languages. Consistency in the way they read.

Code: Select all

sub drawLine(x1,y1,x2,y2,color)
    line(x1,y1)-(x2,y2),color
end sub

Code: Select all

sub drawRectangle(x1,y1,w,y,color,fill)
   if fill = 0 then
       line(x1,y1)-(x2,y2),color,b
    else
       line(x1,y1)-(x2,y2),color,bf
    end if
end sub

Found the arduino C code you wrote a bit over a year ago along with a lot of arduino stuff I had sort of forgotten I wrote to control motors with encoder feedback and to communicate with FreeBASIC. For some reason I lost all interest at the time and hadn't thought about it again until now!!
Although FreeBASIC might be a good vehicle to do math examples when it comes to electronic projects involving programming I would see something like the Arduino development system a better choice.
grindstone
Posts: 527
Joined: May 05, 2015 5:35
Location: Germany

Re: DIY hardware interface for simple data collection and robot control?

Postby grindstone » Jan 23, 2018 7:06

MrSwiss wrote:@grindstone,
just out of curiosity, I've today checked some prices. The Printer Cable and the cheapest
Arduino Clone, cost exactly the same (about US$ 15.-- , in Switzerland, Tax incl.).
Yes, it's quite the same. But I have the printer cable already here, so I'll give it a try. In the long term an Arduino (or something similar) is surely the better solution.
BasicCoder2
Posts: 3243
Joined: Jan 01, 2009 7:03

Re: DIY hardware interface for simple data collection and robot control?

Postby BasicCoder2 » Jan 23, 2018 12:16

@grindstone,
So these usb to parallel cables will work just like a real parallel port?
It has been a very long time since I used the parallel port and I would have been using Turbo C not QBASIC.
With the old parallel ports you didn't need a latch to test the output just a 470 ohm resistor in line with a LED between say pin 2 (D0) and the ground pins,18 to 25? Wiring the old ports incorrectly I think could damage them?
I seem to remember Windows does not let you directly access the parallel port without the Inpout32.dll ?
If you can get it to work I might buy one of those usb to parallel port cables myself. I see a local supplier offering a USB to Parallel Bi-Directional Cable for $40
dasyar
Posts: 333
Joined: Dec 04, 2008 15:31

Re: DIY hardware interface for simple data collection and robot control?

Postby dasyar » Jan 23, 2018 13:08

@h4tt3n, back on topic, I would like to suggest you look into, maybe using a Raspberry Pi. It has some exposed IO pins, you can load freeBasic to the system, and you would have Python as an alternative programming option. If you have some other questions about this kind of setup, feel free to post some questions.
MrSwiss
Posts: 2735
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: DIY hardware interface for simple data collection and robot control?

Postby MrSwiss » Jan 24, 2018 14:32

@h4tt3n,

as much as the FB-heart bleeds, FreeBASIC is probably the wrong lanuage choice,
for teaching kids (it's just to much low level, like C or also C++).
Kids need, to be kept at programming, what is called *instant gratification* (which
FB just can't provide), therefore, a scripting language like: LUA, Python etc., as a
starting off language, is IMHO far better suited, for the purpose ...
h4tt3n
Posts: 663
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: DIY hardware interface for simple data collection and robot control?

Postby h4tt3n » Jan 24, 2018 20:07

Thanks for all your replies, I didn't know it was such a sensitive topic. While I know that the old serial / parallel ports are decommissioned, I expected there to be a newer alternative - which there apparently is not?!? Oh, I miss the old days with full hardware access...

If I am not mistaken, what I am taking away from this discussion so far is that my students won't be able to solder up a piece of hardware by themselves that will allow them to do simple data collection and robot control from a modern PC?

Do you know of an economic, software controllable piece of hardware that will allow us to flip a series of pins on/off or do measurements on them?

I mean, will I really have to dust off my old Commodore 128 to pull this off?

Cheers,
Mike
MrSwiss
Posts: 2735
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: DIY hardware interface for simple data collection and robot control?

Postby MrSwiss » Jan 24, 2018 20:36

h4tt3n wrote:Do you know of an economic, software controllable piece of hardware that will allow us to flip a series of pins on/off or do measurements on them?
Yes, have a look at Arduino, or any of the many Clones: "Open Source HW", as well as
plenty possible add on Modules (for many specific tasks, such as Network, Robotics etc.).
Controlled by itself, autonomous mode (external control via VCP, serial communication).

Price here, for a Uno/Clone: 15 - 25 US$/piece (completely assembled/soldered board).
There are even special sets available, for educational purposes.
BasicCoder2
Posts: 3243
Joined: Jan 01, 2009 7:03

Re: DIY hardware interface for simple data collection and robot control?

Postby BasicCoder2 » Jan 24, 2018 21:16

h4tt3n wrote:If I am not mistaken, what I am taking away from this discussion so far is that my students won't be able to solder up a piece of hardware by themselves that will allow them to do simple data collection and robot control from a modern PC?


Well do they need to solder? It is common now to use a solderless breadboard. Soldering is a separate skill. The Arduino connected to a PC will allow you to collect data (wirelessly if you want) and control all sorts of hardware including a robot. Best of all there is loads of information on the internet and in magazines and books showing how to do it along with a dedicated community of enthusiasts!
badidea
Posts: 907
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: DIY hardware interface for simple data collection and robot control?

Postby badidea » Jan 24, 2018 22:00

Apart from the hardware, do you have practical (automation) ideas that the students would interest? I once bought this robot http://www.arexx.com/rp6/html/en/rp6.htm (not cheap). I thought it would be fun, but I could never think of something interesting to do with it. Only tried some default programs like controlling the movement with a TV-remote.
grindstone
Posts: 527
Joined: May 05, 2015 5:35
Location: Germany

Re: DIY hardware interface for simple data collection and robot control?

Postby grindstone » Jan 24, 2018 22:16

BascCoder2 wrote:I see a local supplier offering a USB to Parallel Bi-Directional Cable for $40
That caused me to have a closer look of what is available in this regard.

In general, there seem to be two types of cables, on the one hand USB-to-printer cables (with Centronics plug), and on the other hand USB-to-parallel cables (with a female D-Sub 25 plug). And I discovered a promising one of the second type (LogiLink UA0054A) with ECP and EPP cabability and a very interesting price (5,90 €). Alas, it wasn't available at the local computer store, so I ordered one, expected to be delivered next week. I'm curious if it works.

BascCoder2 wrote:Well do they need to solder? It is common now to use a solderless breadboard. Soldering is a separate skill.
And what's wrong to learn it? It's not rocket science and makes a lot of fun, once you got it.

badidea wrote:Apart from the hardware, do you have practical (automation) ideas that the students would interest?
For the beginning, I would suggest a model of a crossroads with a computer controlled traffic light.
badidea
Posts: 907
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: DIY hardware interface for simple data collection and robot control?

Postby badidea » Jan 24, 2018 23:02

grindstone wrote:For the beginning, I would suggest a model of a crossroads with a computer controlled traffic light.

That's funny, I was making a list which included the same:

* An swing where an electromagnetic coil is activated at the right moment each swing movement to increase the amplitude using an optical position sensor.
* A small (safe) heater to warm up some object to a certain temperature (without overshoot) and leds indicating 'too cold', 'temperature ok', 'too hot'.
* A light with adjusts its brightness an the amount of ambient light, together with a sound sensor with allows (de)activation by capping.
* Small motor driven conveyor belt which moves an object back and forth on two end-swiches.
* A motor driven fan which blow air onto a vane flow sensor with a reed-relay contact its position. Obtain a steady flow around the switch position.
* Control leds (or other actuators) by input from a TV-remote signal, using an IR-sensor.
* Something with small electrical trains ...
* Small scale (lego?) road crossing with traffic lights, car sensors, pedestrian lights with buttons.
* An simple elevator (a box, a wire, a motor) and up and down request buttons.
* A miniature fusion plant plant (advanced course).

In most cases some programming, electronics and mechanics are needed.
h4tt3n
Posts: 663
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: DIY hardware interface for simple data collection and robot control?

Postby h4tt3n » Jan 25, 2018 17:46

BasicCoder2 wrote:
h4tt3n wrote:If I am not mistaken, what I am taking away from this discussion so far is that my students won't be able to solder up a piece of hardware by themselves that will allow them to do simple data collection and robot control from a modern PC?


Well do they need to solder? It is common now to use a solderless breadboard. Soldering is a separate skill. !


Yes they will, it's a part of what I want them to be able to do. Parallel to all this I will also be teaching gardening and blacksmithing, and I put great emphasis on the fact that an integral part of being an educated person is being able to use your hands and at least have some experience in a range of trades and crafts. Too many people sit on their hands in this day and age, and imho that's a bad thing.

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest