How to design hardware to connect with a Web Server ( With Ethernet)  - Page 1
Forum section: electronics / beginners

author: Rigolon
author_rank: Regular Contributor
timestamp: December 05, 2019, 04:31:59 pm
content: Hey guys,I may have a chance to work on a project to design a product for a company. The equipment is suppose to control velocity and direction of a motor. Can't really discuss more than that. It's pretty simple do that and I know I can do this with ease.But here is the catch, this company sells the machine that has this motor across the nation and they want to control this from the internet. And that's what I don't have any idea on how to do. So from the web I would choose the device I want to connect to and increase/decrease velocity for example.I know that I will need a web server and found a lot of material on how to build one, but I have no idea on what I will need to do with the hardware and how to configure it to connect with the web server. I'm having trouble on how to search on the web, so this is what I want help with.Any links or terms that I can use to search for references?Some dude suggested that I use the module usr-tcp232-t2, for now I have the Ethernet Shield for arduino to start learning.Are there any other module you guys suggest?PS.: The company asked for the connection be by ethernet and not Wi-Fi

author: rstofer
author_rank: Super Contributor
timestamp: December 05, 2019, 04:40:35 pm
content: There are many embedded web server projects on the Internet. A minimalist server is coded on each client machine.Search for 'embedded web server'https://www.allaboutcircuits.com/projects/using-an-arduino-as-a-web-server/Even Arduinos can do it!I would use an mbed compatible LPC1768 board because the only thing you need to add to the hardware is a MagJack to get wired ethernet.https://www.mbed.com/en/https://os.mbed.com/platforms/mbed-LPC1768/There are dozens, if not hundreds, of platforms that can do this kind of thing.

author: stoyanoff
author_rank: Contributor
timestamp: December 05, 2019, 07:58:14 pm
content: Are you sure you want an expansion module? You can just use an interface iC + RJ-45 shielded connector?! It is cheeper, you will have controll over the quality of the RJ-45 connector(this could be important in some ways) and you will have control over the TCPIP stack and how your system is going to work...Best regards!

author: rstofer
author_rank: Super Contributor
timestamp: December 05, 2019, 08:56:22 pm
content: This project is a lot like the millions of IoT projects and MOST of them are gigantic security leaks. You have an unprotected web port open to the universe with no real control over what happens to it. You might research IoT security. If the mothership can contact the web server, so can the kid living in his grandmother's basement.I think I would spend more time worrying about security and less time worrying about the application. I don't know if SSH has been implemented on a low end uC and this alone might drive the project toward a Raspberry Pi and Linux. Since, presumably, there are a very limited number of authorized users who can contact the widget over the Ethernet, it might be worth developing a custom application for the users and using a very secure link.An open Port 80 will be discovered in minutes. Use a firewall like SmoothWall and see how often your router gets hammered.in the end, no matter what you do, somebody is going to break through your security. It may take minutes, it may take an hour but it won't take more than that. If what can be done over the Internet can result in a safety hazard, I would run away from this project as fast as my feet could take me. Somebody is going to get the blame when a user gets injured and liability insurance almost certainly woudn't cover the damages.

author: capt bullshot
author_rank: Super Contributor
timestamp: December 05, 2019, 09:13:36 pm
content: If you don't know how to make a web server on a MCU or arduino, I'd recommend to use e.g. a Raspberry Pi board to set up the web server, this would allow to use all the common knowledge and tools to do so and doesn't require hardware design. Then you'd have to find a way to connect the Raspi to your motor controller and issuing commands to the motor controller. One of the simplest ways to do would be to use a serial port, or some GPIOs.

author: ToniGodoy
author_rank: Contributor
timestamp: December 05, 2019, 09:41:27 pm
content: I'm with rstofer.I'm a very rookie in electronics but an old engineer of networking and security systems.All clients have dreams about science and want to implant science fiction systems in their organizations. Be very careful! You are the one responsible for setting their feet on the ground and you will be the one responsible for any damage suffered by the company due to your design.My advise is to have an external web server, a laptop or a computer, for doing all the work a web server must do (firewall, web server, user access control, and everything else) and then to design an interface (it may be ethernet, of course) for the motor to receive/send control and data packets to the web server.Another very different thing is when the web server is meant to connect the system to a single computer or to an internal network.Note:I have been the designer and the only responsible for building such systems in the past. Linacs which could kill a patient if any intrusion happened and I don't have enough words to prevent you of taking such jobs without taking all precautions you can.

author: rstofer
author_rank: Super Contributor
timestamp: December 05, 2019, 10:21:42 pm
content: Quote from: ToniGodoy on December 05, 2019, 09:41:27 pmThe 'internal network' idea works right up until some manager simply MUST dual-home his PC because he is so very important. Somebody, somewhere, will bridge the internal and external network.I installed the infrastructure for a rather large company (I worked for them) and the network was said to be 'internal' at that point in time EXCEPT for a unknown link that went to another site and their network connected to the Internet. There were a lot of frowns when I pointed out that I could get to the Internet despite their assurances. It wasn't supposed to happen! It was discussed endlessly in meetings. It took about 5 minutes to pop their balloon.There's a lot of work on securing IoT projects and I'm not up to speed on the latest techniques. And that's the point! If the OP doesn't already know how to embed a web server, chances are he isn't up to speed on this stuff either.They couldn't pay me enough to do this job. Of course, being retired for 16 years means nobody has tested my determination to never work again!

author: KE5FX
author_rank: Super Contributor
timestamp: December 05, 2019, 11:16:53 pm
content: You probably want an embeddable server module likethese.As others have said, don't try to homebrew something from scratch if you're not already highly experienced at this stuff.

author: ToniGodoy
author_rank: Contributor
timestamp: December 05, 2019, 11:40:38 pm
content: @rstofer:Lots of anecdotes like yours. Some ones funny and some ones very unpleasant.The point here is that in our former jobs you were just one step from going to jail if you are not very very cautious and don't know very well which clients you choose . On the other hand, he could build the circuit and let all the networking and programming stuff to his client's company. That's what most of the manufacturers do. This doesn't free you of all the responsibilities though, but might be a good balance.

author: pcmad
author_rank: Regular Contributor
timestamp: December 05, 2019, 11:45:33 pm
content: why ot use a rpi as its based o liux and over 90% of webservers use linux so you wont have to worry about scuritty as much as you ca do updates

author: ToniGodoy
author_rank: Contributor
timestamp: December 06, 2019, 12:14:43 am
content: @pcmad:All that servers you are talking about cost only a penny when compared with all the security stuff that surround them.

author: forrestc
author_rank: Unknown
timestamp: December 06, 2019, 12:39:07 am
content: Quote from: Rigolon on December 05, 2019, 04:31:59 pmThe protocol you're going to want to use is likely MQTT. MQTT pretty much is available on any modern ethernet-connected microcontroller. For example, Microchip Technologies has MQTT support in both their MCC (8/16 bit) and Harmony (32 bit) library stacks. In general what you do is configure some certificates on your device to uniquely identify it (often using an encryption coprocessor to store the keys), and then provision a MQTT server somewhere on the internet with those MQTT keys. After that is done, you can send messages between the server and the end device. Often MQTT is implemented in a way which both the server and the end device have a set of shared variables and messages are sent between the devices to keep both ends synchronized.Tools from microchip in the lower-end processor space:https://www.microchip.com/developmenttools/ProductDetails/AC164164https://www.microchip.com/DevelopmentTools/ProductDetails/AC164160(and others are available).You're going to need to come up with someone on your team which understands how to do the web server piece. If I was doing this part I'd set up a serverless infrastructure using AWS-IoT or Google IoT which all of the devices connect to. Then you'd need to write the web server piece that interoperates with this. A good web developer should be able to knock this out fairly quickly, possibly something one could contract out.

author: pcmad
author_rank: Regular Contributor
timestamp: December 06, 2019, 02:04:00 am
content: Quote from: ToniG odoy on December 06, 2019, 12:14:43 amwhen looking at security on the linux box its self needs to be configured with security regardless of the other securty stuff surround themmy linux server has that security stuff that surround them how ever i still secure my server on the box as ever day i get 1000s of bots trying to find away inthis is why IoT suff has bad security becouse no one considors this and thats why its a bigg issue with IoT

author: rstofer
author_rank: Super Contributor
timestamp: December 06, 2019, 04:05:00 pm
content: It might be worth taking a look at OpenBSD - secure by design. It might be thought that there are too many hands messing with Linux.

author: ToniGodoy
author_rank: Contributor
timestamp: December 06, 2019, 04:34:00 pm
content: In my opinion, forrestc's advise is the best you can follow.I would resume it as follow:1.- You build the hardware for the motors (call it device or publisher) to connect to the server (broker). You do this by means of the tools forrestc pointed above. Yo can do it using the protocols pathway: YourDevice->MQTT->TCP->IP->Ethernet-> toward a router. At the TCP layer you use a pair of certificates from a good known authority.2.- You don't build the server infrastructure but use a well known one like Google or AWT IoT cloud.3.- You or someone else deal with the software for sending/receiving/consulting the control/data toward/from your device and the broker (server) plus the GUI interface, both in the servers of the chosen IoT cloud.4.- Your client connects to the IoT cloud to control or analyze the data by means of the GUI you built (for example a web app in the IoT cloud's server) and the lots of analysis tools the IoT cloud brings to you. Of course, this connection from the client must be secured by another pair of certificates.We didn't have all these tools and infrastructures before and we had to build them for private use using VPNs or private links but it seems to be the correct way nowadays.Cheers to forrestc. He made the good point.

author: Rigolon
author_rank: Regular Contributor
timestamp: December 06, 2019, 05:32:16 pm
content: Well first of all, Thank you all for the help and tips.Thx to you guys I found a lot of material do study. The company is actually trying to create a team to develop this system, so I'm taking part on the selective process and I need to show them that I at least have some ideas on how to solve the problem. They didn't say when the project must be finished yet, next stage of the selective process is next week (12/12). Is down to 17 candidates and they will hire at least 4.I will let you guys know how is it going.About the security part, I was also worried about that, but my main concern first is to learn a little how to create the application. Since I can't protect something that doesn't even exists.But again, thank you all, and I will take it to heart what you all said about security concerns.

author: ToniGodoy
author_rank: Contributor
timestamp: December 07, 2019, 12:46:22 am
content: I wish you Good luck.

author: Rigolon
author_rank: Regular Contributor
timestamp: December 12, 2019, 04:53:42 pm
content: Update:Didn't get the gig. Thx for all who wished me luck.But I'm learning a lot of interisting stuff. Found some tutorial by Wilfred Nilsen (RealTimeLogic) and will continue on this path.Also found a nice tutorial to create a webserver on an arduino which sends a SMS when moisture of the soil is too low. Will adapt it for some other use, but now I have a start point.For those who might find useful here is the link:https://dzone.com/articles/arduino-esp8266-iot-light-controllerhttps://realtimelogic.com/products/simplemq/https://dzone.com/articles/building-an-iot-system-using-arduino-and-iot-cloud

author: jmelson
author_rank: Super Contributor
timestamp: December 12, 2019, 11:57:53 pm
content: Quote from: Rigolon on December 05, 2019, 04:31:59 pmI have built a number of low-volume devices that are controlled remotely via Ethernet. I used the Beagle Board first, and have now moved to the Beagle Bone. Somewhat more expensive than theArduinos and such, but a very capable computer. It has a 200 MHz microcontroller built in which can be used when a lot of data needs to be pumped in or out. Since it runs a full Linux OS, you can build all the networking and security in that might be needed. (Not clear if this "motor" would be such that it could cause a hazard if operated in the wrong manner.)You can do all the software development right on the Beagle, you don't have to cross-compile and download.If it is some kind of motion control app, then there is Machinekit, which is usually used to run 3D printers and desktop machine tools, but can be used for any application where a programmedpath is required.Jon