1. Taking the red pill...
- Posted by katsmeow Jun 12, 2021
- 2922 views
Over the last couple of years, there's been an explosion of inexpensive devices on ebay(etc) to convert ethernet, usb, RS-422, RS-232, RS-485, etc back and forth. Previously these devices were large, slow, and expensive, now they are dongles or small cable warts, fast, and as cheap as $10, from hundreds of sellers. For examples:
https://www.ebay.com/itm/131833025902
https://www.ebay.com/itm/353453817112
It should also be possible to interface tiny computers, such as the cheapest Raspi or Arduino, on lan or usb to allow bytes to flow in and out of the computer.
The ebay(etc) descriptions don't say much about how to actually operate the devices, how to command the device to send one bit or one byte or 64k bytes to the computer, or how the software on the computer is to detect this action, or initiate a transaction.
Has anyone built anything like this, using OE (etc) to access this data? From the user's perspective, did your device resemble a hard drive, a static ram, an array bits on pins, a smart RS-422 port? Did it have analog inputs? Did it have command pins like a PIO chip, or software command ports? Did OE(etc) access each pin separately, or were global packets of data glommed? The protocols will be different tween the ethernet and usb, there's significant pros and cons for each system, what did you use and why?
Can you share or sell your solution?
Kat
PS: "red pill" is 1999 Matrix movie reference, referring to the real world outside the computer.
2. Re: Taking the red pill...
- Posted by katsmeow Jun 15, 2021
- 2770 views
I can offer a bounty, make me an offer.
Kat
3. Re: Taking the red pill...
- Posted by ryanj Jun 15, 2021
- 2783 views
For Euphoria, i wouldn't feel confident about getting devices with chips other than FTDI, because of euphoria's lack of multi-threading and difficult C/C++ dll wrapping. It is unknown how usable they would be without seeing details on driver installation and API documentation.
I know FTDI drivers work with euphoria because they have a very simple non-blocking API that takes only basic C wrapping.
This week, i'm busy finishing the design of my audio PCB. Next week, I will plan on looking at my FTDI wrapper and see what needs to be finished so i can release it to the public. I probably just need to wrap a few more functions, clean up the code, and write documentation and a demo program. I'll post an update here as soon as i have one!
The way FTDI devices work, you can either have virtual COM port numbers for legacy software, or you can get a list of FTDI devices connected to the USB bus and address them by ID so it doesn't matter which port you plug them in to (that's the way i prefer to do it). It's like opening a file, except you have to set a baud rate (and other options). It's simple to read/write series of bytes and close when you're done. You can also set/get pins like RTS, CTR, etc. When you read input, it returns however many bytes of data are buffered (or returns 0 bytes immediately if no data) so it never blocks. If you suddenly plug or unplug USB devices, it can cleanly handle that.
4. Re: Taking the red pill...
- Posted by ghaberek (admin) Jun 16, 2021
- 2752 views
Over the last couple of years, there's been an explosion of inexpensive devices on ebay(etc) to convert ethernet, usb, RS-422, RS-232, RS-485, etc back and forth. Previously these devices were large, slow, and expensive, now they are dongles or small cable warts, fast, and as cheap as $10, from hundreds of sellers. For examples:
You could also get a PCI RS-485/RS-422 interface card, although they are a bit more expensive.
https://www.ebay.com/itm/193926281281
That one is about $50 and I know StarTech makes one that's more like $100.
It should also be possible to interface tiny computers, such as the cheapest Raspi or Arduino, on lan or usb to allow bytes to flow in and out of the computer.
Most Raspberry Pi models include built-in Ethernet and all models support USB-to-Ethernet adapters. Several models also have Wi-Fi.
For Arduino you could get a pre-made Ethernet shield, which is basically the RS-485 to Ethernet device you listed above, but assembled into an easier package for Arduino.
In order to get a RS-485/RS-422 port on Raspberry Pi you'd have to use a GPIO-to-serial or USB-to-serial adapter as there's no native serial interface on those devices.
The ebay(etc) descriptions don't say much about how to actually operate the devices, how to command the device to send one bit or one byte or 64k bytes to the computer, or how the software on the computer is to detect this action, or initiate a transaction.
The first device you listed is just a USB-to-serial adapter for RS-485/RS-422. When you plug it in it should just show up as a new "COMx" port on Windows or "/dev/ttySx" device on Linux.
The second device is the actual Ethernet device which you would command and control via its proprietary serial (text-based) protocol. Their website has a PDF describing this: http://www.hi-flying.com/eport-e20 (see "Software Funtion" [sic] document).
Has anyone built anything like this, using OE (etc) to access this data? From the user's perspective, did your device resemble a hard drive, a static ram, an array bits on pins, a smart RS-422 port? Did it have analog inputs? Did it have command pins like a PIO chip, or software command ports? Did OE(etc) access each pin separately, or were global packets of data glommed? The protocols will be different tween the ethernet and usb, there's significant pros and cons for each system, what did you use and why?
I haven't per se, but I've worked with a variety of RS-485 devices and they all seem to operate as basic non-seekable text files. You write a command and read the result. You do have to use the operating system API for opening files since you have to configure the "file" as a serial port before it will actually operate correctly (see baud rate, parity, etc.)
Windows: https://www.xanthium.in/Serial-Port-Programming-using-Win32-API
Linux: https://blog.mbedded.ninja/programming/operating-systems/linux/linux-serial-ports-using-c-cpp/
Can you share or sell your solution?
Unfortunately I don't have an existing solution to offer but I can try to answer questions and point you in the right direction.
-Greg
5. Re: Taking the red pill...
- Posted by katsmeow Jun 16, 2021
- 2704 views
The second device is the actual Ethernet device which you would command and control via its proprietary serial (text-based) protocol. Their website has a PDF describing this: http://www.hi-flying.com/eport-e20 (see "Software Funtion" [sic] document).
Like https://www.ebay.com/itm/253522532645 ?
The description is it's for linux networks. And uses a MIPS MCU , and says i must "Use FreeRTOS Operation System" on it. As i know no linux, MIPS, or FreeRTOS, this sets me back to about 1994 on the learning curve, and it's not worth it, especially as that doesn't include the learning curve for OE on linux, or buying a new desktop computer to run the linux on.
Kat
6. Re: Taking the red pill...
- Posted by ghaberek (admin) Jun 17, 2021
- 2687 views
The second device is the actual Ethernet device which you would command and control via its proprietary serial (text-based) protocol. Their website has a PDF describing this: http://www.hi-flying.com/eport-e20 (see "Software Funtion" [sic] document).
The first eBay item you posted was this one: https://www.ebay.com/itm/353453817112 and the label on that device says "Eport-E20" so that's what I googled and to find the link I provided: http://www.hi-flying.com/eport-e20. This one you just posted now is: https://www.ebay.com/itm/253522532645 and that label says "Eport Pro-E20" which I found here: http://www.hi-flying.com/eport-pro-ep20.
The description is it's for linux networks. And uses a MIPS MCU , and says i must "Use FreeRTOS Operation System" on it.
It's all from Chinese manufacturers so most of it's in Engrish and has to be deciphered. The devices that say "FreeRTOS" are running that directly on the microcontroller. The ones that say "Linux" look like they're running OpenWRT which is a tiny Linux operating system for network devices. Neither of these seem to require knowledge of the actual operating system per se. Most of the configuration is done via a web or telnet interface, or directly via a serial console (like PuTTY).
As i know no linux, MIPS, or FreeRTOS, this sets me back to about 1994 on the learning curve, and it's not worth it, especially as that doesn't include the learning curve for OE on linux, or buying a new desktop computer to run the linux on.
I don't think you need to know any of those things to work with one of these devices. But you would need a compatible RS-485/RS-422 serial port, which is not included on typical PCs as those use RS-232 if they even do have a serial port at all. That 2 in 1 USB to RS422 to RS485 Converter you posted should work. Then you'd need to wire the pins for RS-485 to the Ethernet device and then you should be able to send serial commands to the device to make it do things.
I'm curious what your end goal is here. If you're hooking this all up to a PC then at the end of the day you're just building a really slow network adapter that works over serial, which a simple $5 USB network adapter would provide at a fraction of the cost and complexity and a hundred times the speed. These kinds of devices are meant to be attached to or embedded into dedicated real-world widgets that need network connectivity.
Regarding my experience with these things, at my job we work with a lot of devices, like roadside vehicle detectors, that are basic RS-485 serial devices. So we use these types of adapters to make them available over the network where the state's traffic management software can then interface with them directly. In these cases, the adapters are running in a "serial port server" mode where you can send serial commands over TCP and the adapter just relays the content back-and-forth between network and serial. The only thing we ever have to do directly on the device is program the IP address to get it online. We typically Wavetronix devices which are big and expensive but they're meant for long-term use in severe outdoor conditions. Those devices on eBay are just the stripped-down guts of these bigger devices.
-Greg
7. Re: Taking the red pill...
- Posted by katsmeow Jun 17, 2021
- 2648 views
The first eBay item you posted was
My frustration at not meeting the end goal is leading me to not care about which device is used. The features of any one device don't match the computer, OS, driver, interface version, programming language, speed, protocol, extensibility, cost vs quantity, power consumption, etc etc..
I'm curious what your end goal is here.
Same as it was in the early 1990's: examine, monitor, log the "real world", and be able to program decisions to respond. For example: it's smokey outside, so close the windows. Per a conversation on irc last night, i am not the only one needing this particular rule.
In terms of "old style", wire the sensors to the user port of an olde Commodore, and peek/poke the port. Or wire up a couple 74xx688 chips and a 74xx245, and plug that into the expansion port, and peek/poke it. Or get complicated and use a serial port. Unfortunately, this still doesn't get the data into a modern computer and the benefits it could provide. And the olde computers are not lasting forever.
If you're hooking this all up to a PC then at the end of the day you're just building a really slow network adapter that works over serial, which a simple $5 USB network adapter would provide at a fraction of the cost and complexity and a hundred times the speed. These kinds of devices are meant to be attached to or embedded into dedicated real-world widgets that need network connectivity.
Well, it's been 30 years, and i may resort to 1970's hardwiring rules on cards, because every time i look into software again, something has changed, something is now obsolete, something needs a driver, etc etc etc..
Kat
8. Re: Taking the red pill...
- Posted by ghaberek (admin) Jun 17, 2021
- 2669 views
Same as it was in the early 1990's: examine, monitor, log the "real world", and be able to program decisions to respond. For example: it's smokey outside, so close the windows. Per a conversation on irc last night, i am not the only one needing this particular rule.
In terms of "old style", wire the sensors to the user port of an olde Commodore, and peek/poke the port. Or wire up a couple 74xx688 chips and a 74xx245, and plug that into the expansion port, and peek/poke it. Or get complicated and use a serial port. Unfortunately, this still doesn't get the data into a modern computer and the benefits it could provide. And the olde computers are not lasting forever.
I'm confident you can accomplish all of this with modern and inexpensive hardware, but like any other enthusiast community, it's grown significantly in the past 30-40 years. It's not that the options are bad, just that there are a lot more options and it's hard to wade through all the noise if you're coming into this without having watched it develop in real time. We've basically got two major categories of devices to work with: programmable microcontrollers like Arduino, Teensy, and the new Raspberry Pi Pico, and system-on-a-chip computers like Raspberry Pi, NanoPi, and Pine64. And yes, those SoC boards typically run Linux. Some can run an embedded "IoT" version of Windows 10 but that's its own complicated ball of wax that I wouldn't recommend.
The devices you first posted use RS-485 but that's not natively supported on most of these boards. However there are plenty of options that utilize the wire protocols that are available, like UART, I2C, or SPI. And there are plenty devices that may utilize various protocols underneath (like RS-485), but they might also come packaged into a "hat" or "shield" which is a pre-made and easier-to-use device that packages the raw chips and circuits with something that will work natively with the microcontroller board. Someone might have already combined that Ethernet device with an RS-485 to UART adapter and baked it all into a board that plugs into the top of an Arduino, and now you've got an Ethernet Shield, which also happens to include a microSD card reader.
The Arduino boards are the de facto standard for making "things" that do "stuff" and interact with the real world. So using your example of monitoring for smoke, here's a project that uses an Arduino board for Smoke Detection using MQ-2 Gas Sensor. Combine that with Send Email with ESP8266 and Arduino or Add push notifications to your hardware and now you've at least got something that will tell you "hey it's smokey outside!" You could get super fancy and combine that with a few contact sensors and a motor controller and have it actually close your windows via Control a Large Linear Actuator With Arduino.
Getting back to part of your original question though: does any of this use Euphoria? Not really, no. You can run Euphoria on Linux a Raspberry Pi and then interface with its GPIO pins directly via the kernel or using the wiringPi library (which is now dead, unfortunately). For Arduino and other microcontrollers, somebody would have to make a Euphoria assembler to directly output the AVR instruction set binaries that you could then load into the chip. The Arduino IDE uses a "flavor" of not-quite-C. I think the Raspberry Pi Pico uses MicroPython but I haven't experimented with any of that yet.
-Greg
9. Re: Taking the red pill...
- Posted by irv Jun 17, 2021
- 2664 views
Fortunately (or not) the $2 programmable chip has replaced nearly all the custom-designed dedicated stuff.
The most common way to interface sensors with a computer is with a $6.50 ESP8266 via wifi. Can be used on a network or directly as its own server. Inputs can be serial, parallel or I2C. If your sensors use RS-232 you will need a level converter from +-12 v. to 0-3.3 v. There's also one analog input 0-1.0 v.
https://www.amazon.com/HiLetgo-Internet-Development-Wireless-Micropython/dp/B010O1G1ES https://iotbyhvm.ooo/gpio-pins-esp8266/
Those do require some minor C programming, but there is example code all over the internet. I was able to figure it out, and you are a better programmer than I am.
On the Euphoria side of things, loading and parsing an html web page from the 8266 should be straightforward. Other protocols such as ftp are also possible.
If you need to control relays or such, you can connect them to the digital IO pins on the 8266 and control them from links on the web page(s). The 8266 can parse the query string to switch things off and on. That way, they can be controlled from a browser, phone, etc. or from a Euphoria program without needing a browser at all.
10. Re: Taking the red pill...
- Posted by katsmeow Jun 17, 2021
- 2634 views
I see a patch to correct someone else's mistake, it's 180 lines of C. There's a downloadable driver for windows, it's for win10, i don't have anything compatable with win10. There's talk of re-flashing the eeprom, but not how. There's a whole new ecosystem around Arduino, Pi, etc.. There is talk of how efficient this, that, and the other is, and i see nothing about how effective it is. Each time you post, it seems more complicated!
This is how simple it should be: if it's $2 or $6 or $10 or $50, why can't i buy it already set up for $300? I mean really, i didn't pay $300 for any of the complete working computers i have! How can an add-on gpio port cost more than two or three working 3Ghz i7 wintel computers??
I am WAY too distracted to learn multiple new computer languages and OSs. The bounty i offered was for a card that works, with whatever OE/win7 software it requires. I cannot understand how i cannot communicate that. Lets just pretend i never asked for anything.
Kat
11. Re: Taking the red pill...
- Posted by irv Jun 17, 2021
- 2637 views
OK, just remember this is something middle-school kids do all the time.
If you must avoid programming, such stuff is available off the shelf, ready to just plug in: https://www.mccdaq.com/
These are in the $100 to $300 range.
But the chances of it working with Euphoria are slim and none.
12. Re: Taking the red pill...
- Posted by ghaberek (admin) Jun 21, 2021
- 2469 views
I see a patch to correct someone else's mistake, it's 180 lines of C. There's a downloadable driver for windows, it's for win10, i don't have anything compatable with win10. There's talk of re-flashing the eeprom, but not how. There's a whole new ecosystem around Arduino, Pi, etc.. There is talk of how efficient this, that, and the other is, and i see nothing about how effective it is. Each time you post, it seems more complicated!
Yeah as it turns out computers and electronics are a lot more complex and nuanced than they were thirty years ago. I don't know what else to tell you there.
This is how simple it should be: if it's $2 or $6 or $10 or $50, why can't i buy it already set up for $300?
I think you're going to find the Venn diagram of "hobbyist electronics" and "ready-made products" to be two circles that don't touch. You were asking how to do this with off-the-shelf components. There's probably a hundred different ways to do it.
I mean really, i didn't pay $300 for any of the complete working computers i have!
How can an add-on gpio port cost more than two or three working 3Ghz i7 wintel computers??
Oh c'mon Kat, you know very well how much those computers cost brand new and it's not $300. That isn't a valid comparison.
I am WAY too distracted to learn multiple new computer languages and OSs. The bounty i offered was for a card that works, with whatever OE/win7 software it requires. I cannot understand how i cannot communicate that. Lets just pretend i never asked for anything.
I've re-read this thread several times now and it's seemed to me like you were offering a bounty for a solution as in, "here are all the parts I used and here's what I did to make it work."
And I guess the short answer to that is: No. Nobody here has anything built that they could just pack up and sell to you. The best I could do is offer a rough sketch of how you could do it.
This also isn't primarily a forum for these types of things and you'll quickly reach the knowledgeable limits of those capable of offering any type of response. Perhaps a more dedicated forum would yield better results. But I think you're going to find that the community surrounding hobby electronics to be mostly a "teach a person to fish" philosophy.
If you want a ready-made out-of-the-box solution, then maybe you should go look for a ready-made commercial solution. But expect to pay the cost for a commercial equivalent. But good luck finding support for Windows 7 since Microsoft doesn't support it and vendors don't like offering things for unsupported systems.
-Greg
13. Re: Taking the red pill...
- Posted by petelomax Jun 21, 2021
- 2489 views
See https://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=11540398 for a collection of possibly relevant articles recently posted on codeproject for IoT/arduino/raspberry pi.
No doubt absolutely nothing in there will be anywhere near to your liking, but it cannot hurt (that much) to have a little look-see.
14. Re: Taking the red pill...
- Posted by katsmeow Jun 24, 2021
- 2362 views
See https://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=11540398 for a collection of possibly relevant articles recently posted on codeproject for IoT/arduino/raspberry pi.
Thanks, Pete. Suggested the raspi on the lan for it's ready internet access and built in io ports, as well as (iirc) someone wrote a lib for OE on the raspi to bitbang a set of pins as a 8bit gpio port. I keep being told it isn't feasable. It is prolly the priciest option, but it's also a standalone computer.
I keep saying "sensors" and "motor controllers", i guess i should be saying "IoT".
There's so many events that occur, if allowed to complete will cause various damages, such as a small grass fire. Or make for enjoyable bird watching or steam engine monitoring or solar panel state or running an array of model trains. Or remind me at 10pm that breakfast cooked at 8am is still in the microwave. Making OE/Phix IoT-friendly, to munge data and control the lil things in the real world, might be the Next Big Thing. Dismissing the idea might just be another nail in OE's coffin.
Kat
15. Re: Taking the red pill...
- Posted by katsmeow Jun 24, 2021
- 2344 views
If you want a ready-made out-of-the-box solution, then maybe you should go look for a ready-made commercial solution. But expect to pay the cost for a commercial equivalent.
I have offered $300 for one instance of the working solution. I think i've already hit "commercial".
But good luck finding support for Windows 7 since Microsoft doesn't support it and vendors don't like offering things for unsupported systems.
Not my problem, it should have been done 10 years ago when win7 was more relavant.
Kat
16. Re: Taking the red pill...
- Posted by ryanj Jun 25, 2021
- 2308 views
If you want a ready-made out-of-the-box solution, then maybe you should go look for a ready-made commercial solution. But expect to pay the cost for a commercial equivalent.
I have offered $300 for one instance of the working solution. I think i've already hit "commercial".
But good luck finding support for Windows 7 since Microsoft doesn't support it and vendors don't like offering things for unsupported systems.
Not my problem, it should have been done 10 years ago when win7 was more relavant.
Kat
I'm working on a solution today. Just taking a break to explain my idea.
There are USB to RS485 adapters based on FTDI chips, and i already have a mostly-finished FTDI wrapper for Euphoria. My plan is to design a simple, low-cost PCB for the DIP-40 version of the Propeller micro controller with an RS485 transceiver. I'll write an "OS" to run on the propeller chip and a Euphoria library to communicate with the propeller chip. The software could let you configure I/O assignments and modes for different functions such as: controlling LEDs/MOSFETs/relays, generating frequencies (making a piezo beep), reading buttons/switches, reading/writing variables in RAM or data on EEPROM, communicating with i2c/spi/serial chips such as LED controllers, sensors, battery monitors, ADCs, etc., or modify the source code to make your own custom features.
I'm designing the PCB in a way that it would be really easy to connect the I/O pins to a bread board or whatever. And, it will have footprints to easily add pull up/down resistors. Also, i'm thinking i could make about 25-50 of these to reduce the per-unit cost, and solder on the basic supporting components along with a DIP-40 socket. Then, Propeller chips can be bought separately as needed.
OK, back to work now...i'll let you know how it goes.