DIY hardware interface for simple data collection and robot control?

For issues with communication ports, protocols, etc.
h4tt3n
Posts: 669
Joined: Oct 22, 2005 21:12
Location: Denmark

DIY hardware interface for simple data collection and robot control?

Postby h4tt3n » Jan 20, 2018 10:29

Hello folks,

I have just landed a very exciting job as a 5th to 8th grade math/science teacher, and I am planning on using FB as an integral part of my education. I'll be teaching in a type of school with less restrictions, and there is considerably less "chalkboard teaching" than in a typical public school. Besides science, I will also be doing blacksmithing and gardening with the kids. One of the things I would like to use FreeBASIC for is to collect data and control simple, home-made robots via a hardware interface. I am keeping everything as simple as possible, as my pupils will be making everything themselves, and I don't want to discourage them by throwing too hard challenges at them.

So, my question is: Since I haven't worked with hardware interfaces since the happy Commodore 64 days, could someone here provide blueprints or simply a link to some good resources about this topic? I would like to be able to do simple stuff like turning LED's / low voltage electric motors on and off, read data from a feedback switch / electromagnetic coil / light sensitive resistor, and perhaps control a stepper motor for more advanced stuff.

Cheers,
Michael
grindstone
Posts: 555
Joined: May 05, 2015 5:35
Location: Germany

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

Postby grindstone » Jan 20, 2018 11:56

Great project! I've done a lot of such stuff in the past and I'd like to offer you my support (including the derivation of the Bresenham algo from the line equation).

First of all: To keep things easy you will need a computer with a parallel port and for Win >= XP a driver called "inpout32.dll".

For now a few links:
https://www.codeproject.com/articles/4981/i-o-ports-uncensored-controlling-leds-light-emit
https://kartikmohta.com/tech/parallelport/
http://electronics-diy.com/stepper_motors.php
http://www.globu.net/pp/english/pp/ne555.htm
http://electrosofts.com/parallel/lcd.html
Last edited by grindstone on Jan 20, 2018 12:14, edited 1 time in total.
MrSwiss
Posts: 2764
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Jan 20, 2018 12:06

Sorry, grindstone but, IMHO the worst idea, in the context is, to start with "outdated"
technologies (Win-XP, aswell as Parallel Port).

I'd have a first look at cheap MicroProcessor's such as ARDUINO, as I/O device at first.
Later on, those can also be used, for simple Robotics ... (they are modular built).

With only the Chips, they can be built on a BreadBoard too, later on (in HW class).
(All the construction plan's/diagram's are "Open Source".)

(Only drawback is, that they have to be programmed in C, alternatively there is a
BASIC Compiler available, but not for free.)
h4tt3n
Posts: 669
Joined: Oct 22, 2005 21:12
Location: Denmark

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

Postby h4tt3n » Jan 20, 2018 12:27

grindstone wrote:Great project! I've done a lot of such stuff in the past and I'd like to offer you my support (including the derivation of the Bresenham algo from the line equation).

First of all: To keep things easy you will need a computer with a parallel port and for Win >= XP a driver called "inpout32.dll".

For now a few links:
https://www.codeproject.com/articles/4981/i-o-ports-uncensored-controlling-leds-light-emit
https://kartikmohta.com/tech/parallelport/
http://electronics-diy.com/stepper_motors.php
http://www.globu.net/pp/english/pp/ne555.htm
http://electrosofts.com/parallel/lcd.html


Thanks a ton man! This is exactly the kind of things I've imagined. As MrSWISS mentions, I know controlling stuff on an old PC with a parallel port is a bit outdated, but this is exactly something we can manage by ourselves with a few wires and a soldering iron. I want to get as far away from the shiny (and very expensive) educational robot sets you can buy. I want my students to experience a feeling of ownership about the stuff they are doing, so I'll have them make as much of it themselves, with duct tape, plastic cups and wooden sticks if we have to. Having said that, the stuff you can do with the Arduino, Raspberry pi and similar is pretty amazing too.

Cheers, Mike
grindstone
Posts: 555
Joined: May 05, 2015 5:35
Location: Germany

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

Postby grindstone » Jan 20, 2018 12:29

MrSwiss wrote:Sorry, grindstone but, IMHO the worst idea, in the context is, to start with "outdated"
technologies (Win-XP, aswell as Parallel Port).
On the contrary. That "outdated" hardware is going cheap and that old OSes (I'd even recommend DOS for the first steps) are quite easy to handle. Later on you can use more sophisticated hardware.
jj2007
Posts: 848
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

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

Postby jj2007 » Jan 20, 2018 12:32

Instead of buying a new PC with a parallel port (might be difficult to find one), you could check if USB->X converters could do the job. See e.g. My New Laptop Does Not Have Any RS232 Ports. If you search for USB to Printer DB25 25-Pin Parallel Port Cable Adapter on the website of a well-known online seller who doesn't pay taxes and reminds me of a Brasilian river, you will find a little gadget that costs just 4 bucks.
MrSwiss
Posts: 2764
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Jan 20, 2018 12:35

h4tt3n wrote:I know controlling stuff on an old PC with a parallel port is a bit outdated
NO, its not just "outdated", it is in ICT terms: "Dinosaur-technologies".
And, your pupils will be the first, to tell you all about it!

@grindstone, we are talking about young kids here (not "old" people).
h4tt3n
Posts: 669
Joined: Oct 22, 2005 21:12
Location: Denmark

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

Postby h4tt3n » Jan 20, 2018 12:45

MrSwiss wrote:
h4tt3n wrote:I know controlling stuff on an old PC with a parallel port is a bit outdated
NO, its not just "outdated", it is in ICT terms: "Dinosaur-technologies".
And, your pupils will be the first, to tell you all about it!

@grindstone, we are talking about young kids here (not "old" people).


Well okay then, but what realistic alternatives are there? The students needs to be able to build and program everything themselves and it needs to be doable on a limited budget.
h4tt3n
Posts: 669
Joined: Oct 22, 2005 21:12
Location: Denmark

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

Postby h4tt3n » Jan 20, 2018 12:47

jj2007 wrote:Instead of buying a new PC with a parallel port (might be difficult to find one), you could check if USB->X converters could do the job. See e.g. My New Laptop Does Not Have Any RS232 Ports. If you search for USB to Printer DB25 25-Pin Parallel Port Cable Adapter on the website of a well-known online seller who doesn't pay taxes and reminds me of a Brasilian river, you will find a little gadget that costs just 4 bucks.


Thanks, I will take a look. Seems like a reasonable workaround.
grindstone
Posts: 555
Joined: May 05, 2015 5:35
Location: Germany

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

Postby grindstone » Jan 20, 2018 12:55

@jj2007: If you know how to control single lines of such a USB to parallel cable, please let me share your wisdom. I'm trying in vein to figure out how that can be done since more than a year.

MrSwiss wrote:@grindstone, we are talking about young kids here (not "old" people).
That's exactly the point. Those young people can operate their smartphones perfectly, but have hardly any clue how they work.
MrSwiss
Posts: 2764
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Jan 20, 2018 13:07

grindstone wrote:Those young people can operate their smartphones perfectly, but have hardly any clue how they work.
And, you want to explain it, with a not any longer existing Parallel Port, you surely must be joking!
Every Smartphone has a USB-Port, nowadays ...

h4tt3n wrote:Well okay then, but what realistic alternatives are there?
Basically, the first question to answer, would be: do you want to start off, with HW or SW?

More into the details:
First step, work out a Agenda/Time-Line, before going into technical details.
Second step, remember that humans, tend to think analogue vs. machines, digital.

Therefore, I think that, before going into hardware, you'd have to teach some digital
concepts, like Gate operations theory, etc. (which in turn helps, to understand some
SW concepts, such as: Boolean operators/logic/variables and so on).
grindstone
Posts: 555
Joined: May 05, 2015 5:35
Location: Germany

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

Postby grindstone » Jan 20, 2018 15:11

Another alternative would be a cheap USB-to-RS232 converter (e.g. with FT232R). It can be accessed by freeBasic via a virtual COM port (usually COM4) and provides 6 TTL lines. Nevertheless it's not suitable for driving stepper motors, because the timing is too unprecise.
MrSwiss
Posts: 2764
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Jan 20, 2018 16:19

The base problem, seems to me is (at this point in Time) that, OP has to decide first:
what he/she wants to pack into those lessions, aswell as the priorities.

Currently it looks to be, 3 different subjects:
  • Electronics (all the soldering related stuff)
  • HW, only theory? (or coupled, with above?)
  • SW, related to HW
As long as there is no further clarification, it's moot to speculate, on "best" HW (for the task(s)).

I'd cut out, the complete Electronics part, by using a pre-built cirquit, as a Arduino since,
they are quite cheap to buy (aswell as minimising, all the "going up in smoke", issues).
BasicCoder2
Posts: 3298
Joined: Jan 01, 2009 7:03

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

Postby BasicCoder2 » Jan 20, 2018 20:59

h4tt3n wrote:So, my question is: Since I haven't worked with hardware interfaces since the happy Commodore 64 days, could someone here provide blueprints or simply a link to some good resources about this topic? I would like to be able to do simple stuff like turning LED's / low voltage electric motors on and off, read data from a feedback switch / electromagnetic coil / light sensitive resistor, and perhaps control a stepper motor for more advanced stuff.

I have interfaced electronics to all the computers I owned. TRS80, C64, Sorcerer, Amiga and the PC bidirectional ports.
The problem with using FreeBASIC is the lack of anyone capable of writing the software to read from and write to a usb port.
If you could find a C .dll capable of doing it and if you have the ability to write the code required to call the routines from FreeBASIC....
The Python community provides a lot of support for interfacing to hardware and would probably be my choice of language.
For my robot I used escapi.bi for webcam vision and K8055.bi for controlling motors and reading sensors both were provided by D.J.Peters
Last edited by BasicCoder2 on Jan 21, 2018 9:32, edited 1 time in total.
MrSwiss
Posts: 2764
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Jan 20, 2018 21:28

BasicCode2 wrote:The problem with using FreeBASIC is the lack of anyone capable of writing the software to read from and write to a usb port.
Once again, many USB-Devices provide VCP (virtual COM port), which means, they can
easily be controlled, with ordinary Serial-Interfacing, from FB! (as Arduino does)

Open COM and the like ... this then means: nobody needs to be able, to program USB directly!

What you've been underestimating was: the Arduino must be programmed (first), before any sort
of communication, can be established (which you never understood!), by: FB / C or otherwise.

Your "stupid" Velleman Device is just able to do, what it was built for. A Micro-Controller can do,
whatever you program it, to do (far more versatile, and cheaper, on top of it).

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 2 guests