With the ‘Internet of Things’ being talked about around the internet everyone wants to have their devices connected to something, somehow. We have been looking into a couple of projects recently, both internal and external, that require fast, secure and more importantly reliable connection to a network and out to the big bad world via the Internet.
Internet of Things
There are many ways of getting your device to be part of the Internet of Things (IoT). We have used various RF solutions such as 802.11a/b/g/n and IEEE 802.15 based protocols and standard wired Ethernet, and have been successful in connecting things together easily and quickly. Going down the RF route to get your device connected is a quick and easy approach, give it some power and access to your WiFi router and all is good, however what do you do if you need to ensure that the connection is as reliable as possible, especially in an electrically noisy environment?
Going Old School
Going wired is probably the safest way of connecting things together in a noisy environment, assuming the cabling is correctly managed. There are many different wired connection types available that have been around for decades and provide a stable (if slow) connection for a remote device, a lot of these can’t give your device direct access to the internet on their own but throw in a suitable gateway and you are good to go. For example you could use RS232 or RS485 serial connection and run PPP over it but this will be slow and painful if you want to send anything larger than a few bytes. You will also need point to point connections unless you want to get fancy and design some sort of arbitration/cdma scheme for a multi drop RS485 link. However if your data is small then a serial link will suffice and has been used for many years in thousands of products we have successfully used this pattern in products a few time using Modbus and proprietary protocols You will however be limited to relatively slow data rates and your ‘Internet of Things’ will need an extra box to translate your serial traffic into something that can interact with the world via your favourite web browser.
Ethernet is the obvious connection that comes to mind when you want to put your device on the Internet. Its ubiquitous and most devices have some way of connecting them to an Ethernet network, be that an in-built MAC or a simple SPI connection to the trusty ENC28J60. You can get the bits for next to nothing and have something running in no time, sending your sensor readings to a remote server or serving them up via an in-built http server. The only problem with this is that you still need a point to point connection and you have a single point of failure. This probably isn’t a problem if you just want to use the connection for logging purposes, but what happens if you want to ensure that you can send something back reliably and synchronised to external events?
This is the problem that we faced for an internal project, we wanted to ensure that we could send a control signal to an ARM based system reliably, and within a few milliseconds as well as having the system connected to the rest of our network and accessible via the internet. We also wanted to keep costs down and allow for a scalable system, up-to around 150 nodes. Costs for doing this using standard Ethernet would soon mount up and require large, expensive hardware to ensure that we could reliably keep traffic latency at a manageable level. So what do we do?
To keep costs down we decided to use a ring topology, this would allow us to remove the need for a central hub/repeater/switch at the expense of adding a few pence to the device. We can connect each device to the next and eventually back to the first device to give us a ring. Great, so how do we do it? Anybody who knows anything about Ethernet networks knows that if you create a ring on your network you will be in trouble. Hopefully your Ethernet hardware will detect it and shut the ring down, some will simply send your network into a meltdown as it constantly tries to forward your frames around the link. So we need a clever method of connecting the devices together and this is where our new hardware design comes in. Using a managed 3 port switch embedded on our new hardware device we could configure the switch in such as way as to drop frames that originate from one of it’s own ports. This means that a frame sent from one device will make it around the loop once and then be dropped by the originating device. Management, Control and Monitoring traffic can be proiritised using IEEE 802.1p QoS and IEEE 802.1Q VLANs
The next step is to provide protection for the system so that it can recover from a break anywhere in the ring – the subject of the next blog entry!