Author Topic: Input output methods and hardware opinions  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

Offline Parkland

  • Newbie
  • Posts: 51
Input output methods and hardware opinions
« on: March 13, 2022, 11:19:26 pm »
Hi everyone.
Long time no see.

First off apologies if this is the wrong section, logged in on my phone and can't view the site as well as my laptop.

I'm just wondering if anyone has experience with connecting i/o expansion boards to a PC and using qb64 to access those?
Looking to be able to sample voltage at high speed using something like the USB daq I have into qb64. Maybe with 4 inputs or maybe slower speeds with more inputs. Something to read the voltages from things like thermocouples.
Also a breakout board for inputs from momentary circuit closures from buttons mounted on an enclosure. So possibly a gang of pins and a way to read them.
Essentially something similar to what a raspberry pi does but for a PC running qb64.

Has anyone done this or have ideas what the easiest or best way is to go about it?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Input output methods and hardware opinions
« Reply #1 on: March 14, 2022, 11:56:14 am »
I think you might need to see this:
 https://qb64forum.alephc.xyz/index.php?topic=2378.msg115999#msg115999
Not the same as Internet connecting but similar I am pretty sure.

Or search Wiki for TCP/IP communications. I know people have connected and run Basic programs to machining equipment for a long time. But not I.

Offline mdijkens

  • Newbie
  • Posts: 34
Re: Input output methods and hardware opinions
« Reply #2 on: March 14, 2022, 12:09:31 pm »
A half solutions that works for me is to connect to an ESP8266 via wifi and use the I/O of the ESP8266 via TCP connections from QB64.
This still does not give you real fast I/O but at least a few hundred reads/writes a second is achieveable
~ 2 million lines of BASIC

Offline Parkland

  • Newbie
  • Posts: 51
Re: Input output methods and hardware opinions
« Reply #3 on: March 14, 2022, 11:37:19 pm »
I do have some tcp ip experience with qb64. Kinda have an on hold project until I figure out how the buffer limitations work 🤔

I didn't consider using a network analog encoder maybe it could work.
I need to read several thermocouples and control a few motors and air relays.

Offline mdijkens

  • Newbie
  • Posts: 34
Re: Input output methods and hardware opinions
« Reply #4 on: March 16, 2022, 04:48:49 am »
I tried to find better (faster) ways to do this and USB serial (at 115k2) is a lot faster then TCP.
See my topic here https://qb64forum.alephc.xyz/index.php?topic=4727.msg141384#msg141384
~ 2 million lines of BASIC

Offline Parkland

  • Newbie
  • Posts: 51
Re: Input output methods and hardware opinions
« Reply #5 on: April 12, 2022, 08:57:00 pm »
After some deliberating, I decided to use an RS485 adapter and ordered modbus RTU relay controllers and sensors.
It looks pretty simple just connect devices to wires and send and receive data back and forth in hexadecimal values.
The default device speeds are all 9600 baud but can be set way faster.
For high speed data acquisition even 56k baud might be too slow but for my purposes this seems perfect.
I imagine I should be able to poll several values a second no problem which is all I need.

I'll update once the stuff shows up if there's any unforeseen issues but it seems pretty straight forward.