Some networking fun: 28 arduinos linked in a network

Hi, I am new to the arduino platform. I have been using a Lego Mindstorms NXT with the software that comes with it and have some experience in batch programming. My dad co-ownes a manufacturing company and wants me to design a system for him that can take the data from a switch (SPST and closes when cycles) that counts how many times the machine cycles and put it into a Microsoft Excel spreadsheet with each machine having its own count display. We have a price limit of about $5000-$8000 and want a system that can be expanded upon to around 30 machines easily. The arduino was my natural choice since I have heard of it being used in many projects.

The first thing I want to do is decide what interface to use. I do NOT want to have a few arduino megas that are monitoring multiple machines. It would take out the part of adding to the size easily. I have thought of using XBee modules on some fios, ethernet connection to a large hub dedicated to the arduinos, and coaxial connections. Connecting the Rx and Tx pins together is not an option as the area this will have to cover is a rectangle of about 1000yd by 300yd. Standard RF circuits are also out of the question as they would be interfered by the large 200hp motors and the large collection of other noisy goods. (both physically and RF)

My plans are to first decide a parts list, make a hello world demonstrating that this is possible, and finally buy the rest of the parts to make it possible. You will know when I buy them as stocks of one arduino or another will drop dramatically.

Just remember when you respond, I do not know much about the programming language and am still learning it. I plan to buy two arduinos tomorrow, a couple ethernet shields, and an xbee set. And just out of curiosity, what is the record of the most arduinos connected into a network like the one I'm planing on?

Standard RF circuits are also out of the question as they would be interfered by the large 200hp motors and the large collection of other noisy goods. (both physically and RF)

You do understand that XBee is a radio. It may work but you should probably have a plan B.

For the physical connection... RS-485 (RS-422) is generally used in industrial environments. Ethernet is usually a reasonable choice. CANBUS is an excellent choice.

I figured that since the Xbee runs in the ghz range it would be less susceptible to RF interference by motors. Can I get a small list of pros and cons of each of the three connection types you posted? Oh and btw my dad also wants the data to be live on the spreadsheet. I am not sure if that is possible. Does anybody know?

Some fairly inexpensive radio transceivers ( RFM22B or the SIM20 433 MHz, or the 2.4 GHz RFD21733 ) can be connected as a mesh with multiroutes, aknowledge, and autoresend.

I get 500m from the SIM20 outdoors, but it might be better using the 2.4 GHz does WiFi work OK in the factory ? its basically the same frequency.

Connecting the Rx and Tx pins together is not an option as the area this will have to cover is a rectangle of about 1000yd by 300yd

That's not a problem depending on speed and network topology, use RS-485 as has been mentioned. It's specifically designed for such environments.

I'll leave those who know about wireless to argue for that.


Rob

RyanF121:
Oh and btw my dad also wants the data to be live on the spreadsheet.

What is the spreadsheet for? I mean, what calculations is it performing and what is being done with the results?

Although you've specified that the results must be displayed in a spreadsheet, use of a spreadsheet is a solution not a requirement; the fact you're also asking for 'live' updates make me suspect the spreadsheet is not actually suitable for you. What is the actual requirement here?

Do you want a tabular display of the counters in some order? Over some period? Any of that user-defined? Charts of the rate of change or absolute values over time? The real requirements will imply the most appropriate way to store and present the data, and it may not be a spreadsheet.

And just out of curiosity, what is the record of the most arduinos connected into a network like the one I'm planing on?

I haven't done it yet but I'm planning a project that will do 254 Arduinos over (theoretically) 300km (wired).

Not sure how the heck I'll test it. XD


Rob

I'm planning a project that will do 254 Arduinos over (theoretically) 300km

Solenoid released puffs of smoke from BBQ's ? It worked for the Souix !

Seriously though, has anyone modulated laser pointers? and what range is possible? Of course there would be environmental interference from rain and mist, but I have a specific project I want to test sometime.

Thanks for the responses.

Boffin1:
Some fairly inexpensive radio transceivers ( RFM22B or the SIM20 433 MHz, or the 2.4 GHz RFD21733 ) can be connected as a mesh with multiroutes, aknowledge, and autoresend.

I get 500m from the SIM20 outdoors, but it might be better using the 2.4 GHz does WiFi work OK in the factory ? its basically the same frequency.

A standard RF circuit will not work in the environment I plan to implement. Have you seen the inside of your standard cereal factory? Think of all the motors that drive the lines and multiply their HP by around 30-600 and you get what I'm working in. The factory manufactures puzzles so we have a large amount of motors and controls running an this will be the first arduino ever present in the factory. Almost all the systems there are industrial-grade PLC's from Allem Bradley or Mitsubishi.

PeterH:
What is the spreadsheet for? I mean, what calculations is it performing and what is being done with the results?

Although you've specified that the results must be displayed in a spreadsheet, use of a spreadsheet is a solution not a requirement; the fact you're also asking for 'live' updates make me suspect the spreadsheet is not actually suitable for you. What is the actual requirement here?

Do you want a tabular display of the counters in some order? Over some period? Any of that user-defined? Charts of the rate of change or absolute values over time? The real requirements will imply the most appropriate way to store and present the data, and it may not be a spreadsheet.

My dad wants it in spreadsheet because that's what his employees know how to manipulate. He wants it to be user friendly. I told him repeatedly that Spreadsheet isn't designed for this stuff, especially with it being live. I'm thinking I will have to make a web interface that the arduinos link into with actual live data rather than programming a batch file to reopen a spreadsheet file every 5 minutes. Just another thought, if I got a Mux shield linked to an arduino and connected that to the PC, would that be about ideal for something like this or would it be more of a hassle to do that? I'm thinking of how hard it will be to integrate all the connections from the different arduinos to one page.

Boffin1:
Seriously though, has anyone modulated laser pointers? and what range is possible? Of course there would be environmental interference from rain and mist, but I have a specific project I want to test sometime.

Lazer pointers have been modulated before with an extremely simple circuit containing an op-amp and an audio transformer connected to the lazer. I tried it with some success. It would have been better if I had an op-amp though. The range was fairly limited since I couldn't keep it aimed correctly for more than 10 minutes. I have heard of some people using small telescopes with a photoresistor/photodiode connected to the eyepiece. They would take a light bulb like you would find in a scrolling billboard with the light grids and turn it on and off with amps designed for speakers. They were successful at transmitting audio with a half-decent quality of sound.

And a side note, my dad is going by Radioshack to get an arduino for me to start learning. I already have a breadboard so no issues there.

A standard RF circuit will not work in the environment I plan to implement. Have you seen the inside of your standard cereal factory? Think of all the motors that drive the lines and multiply their HP by around 30-600 and you get what I'm working in. The factory manufactures puzzles so we have a large amount of motors and controls running an this will be the first arduino ever present in the factory. Almost all the systems there are industrial-grade PLC's from Allem Bradley or Mitsubishi.

Say what? What have you actually done to measure the RF noise in the factory? Most industrial motors are probably three phase squirrel cage induction types that may not produce much RF issues. What does the HP rating of a motor have to do with its potential RF production?

zoomkat:
Say what? What have you actually done to measure the RF noise in the factory? Most industrial motors are probably three phase squirrel cage induction types that may not produce much RF issues. What does the HP rating of a motor have to do with its potential RF production?

We have taken radios that are tuned to a good strong radio station and brought them inside the building and the signal degrades to the point you can barely hear the music over the static. My point is that radio won't work in there. There are too many metal structures in there that would block the radio signal. We would get into issues of the signal getting blocked by the 2-ton presses and all the other things in between.

Update: arduinos bought from Fry's Electronics and my dad is getting the ethernet shields from Radioshack.

Well if you write off wireless that only leave Ethernet and RS-485.


Rob

I don't know anything about RS-485 (will start to read on wikipedia now) but I wrote some info if you would go the Ethernet way:

Would it be possible to use ethernet network? To skip any type of radio completely?
Switches for this would be cheap if you can get them 2nd hand. 10 Mbps (10Base-T) switches are so obsolete than there only value are the raw materials they are made of. But 10 Mbps would be more than enough for a network where Arduinos sends small data packets to some central machine.
But don't use ethernet hubs (switches are not hubs). It won't create separate collision domains and regarding the size of the plant you might actually hit the wall there (I don't remember the exact numbers). And all packets would bounce around to all Arduinos.
The actual cabling perhaps should be done by a professional network installer.
And for when the deployment takes place perhaps you should buy the Arduino Ethernet (without PoE) which will save you some money (and you only need one interface card for programming them).

The sink for all data I think should be a PC. For ethernet it will be piece of cake as PC:s have the network interface or can be extended with more if you need. I don't have much knowledge at all about xBee but I saw interfaces for PCs via USB are available. Don't put an Arduino as data collector.

And if you are forced into that option I think the easiest way is to produce a .csv file (comma-separated values) that excel can load.

Regarding the programming, well it is a lot different from batch files, don't assume it will help you.

Edit:
Okay so RS-485 is preferable used as a bus network and over large distances can not have so much speed. And it will be large distance if all the machines would be hooked up on a single long line.

The ethernet idea I proposed is to get a good stock of ethernet switches and place them around the factory, connect the switches in a line and have a star topology of cables out to Arduinos in the vicinity of the switch.

If I had to roll up data from 200+ devices, I'd use a Redis database (http://redis.io) to receive and stage the data. Then it's easy to write small programs that can grab the data from the database and format it for spreadsheet and web display.

Any database would work, of course. But if you go the Ethernet route, you can use the (free) Bitlash Redis client to make the Arduino part of the problem very simple. Count pulses, report up the line to the server every N seconds. It's a couple of lines of Bitlash. This approach reduces the software problem to database reporting and format conversion.

Be sure to get a big bottle of aspirin for the practical problems that go with managing so many devices. Consider staging a small pilot project with just one arduino, and then scale it to a dozen machines before you rewire the whole factory...

-br

Redis: http://redis.io
Bitlash: http://bitlash.net
Bitlash redis client: bitlash/BitlashRedisClient.pde at master · billroy/bitlash · GitHub

You can use RS-485 with nodes daisy-chained, with that topology you get 4000' for each link. Normally however it is used as a bus so the 4000-5000' is a max, and that's at ~100kbps.

I know nothing about Ethernet so won't argue for or agin it, except to say that it has to be more expensive I would think.


Rob

No matter what transport system you use (Serial, Network, RF) there could be a lot of traffic (depends on switch frequency) and I worry your going to have either a lot of missed data or network collisions.

The most robust and extendible network for noisy environments is CAN, but it has a steep learning curve. It is an arbitrated, error-checking, asynchronous messaging system that runs at up to 1Mbit over km lengths. Messages normally are continuously resent until correct receipt is acknowledged. It is used in automobiles, earth moving equipment, medical devices, wheelchairs, aerospace. There is a "basic" CAN standard and a wide variety of higher-level overlays that while not easy to implement can provide even higher levels of protection. For example, in the most safety critical flavor of CANopen (think overhead load cranes or atomic submarines) both the message and its complement are sent so that, over and above CRC and so on, if these two don't match the message is rejected. But that's extreme; for most applications, even a wheelchair who's user can't jump out if there's a problem, basic CAN, properly implemented, is very reliable. If you're going to use your network to control machinery and if errors induced by factory noise might put people at risk, I would seriously consider learning CAN. If your network is only going to be monitoring information, then RS-485 or ethernet should be fine. Ciao, Lenny

Very intersting project. I hope you'll keep us updated :slight_smile:

My 2 cents worth of advice is about data collection: excel is going to prove a very limiting choice IMHO. You should plan for a data collection program to be run on a (possibly industrial type) pc with an ethernet port or a rs485 interface card, that would put the read values into a database.
A simple table with timestamp, sensor number and sensor value would probably be enough, at least at the beginning. From there on you have endless possibilities regarding graphs, averages, etc.

(I'm sure there are countless commercial packages that can do this already - haven't done any search yet - but as always it comes down to choosing the balance point between time-to-completion and DIY fun :wink: )

RyanF121:
Can I get a small list of pros and cons of each of the three connection types you posted?

RS-485
Least expensive. Assuming you use proper cables, you will be able to span the distance you mentioned (3132 feet) using a "low" baud rate. Differential signal provides a reasonable immunity to electrical noise. You are responsible for the on-wire signal. Need a CRC on that packet? You do it. Need a way of addressing nodes? You do it.

Ethernet
Most expensive. There is no way you can cover that distance without repeaters or using fiber optic cable. Differential signal provides a reasonable immunity to electrical noise. Ethernet controller is responsible for the on-wire signal.

CANBUS
A bit more than RS-485. Assuming you use proper cables, you will be able to span the distance you mentioned (3132 feet) using a "low" baud rate. Highly resistant to electrical noise and cable faults. CANBUS controller is responsible for the on-wire signal.

@LROBBINS' reply above is spot-on (with one exception: you can have high speed or long distance but not both).

If "CRC", "address", or "state machine" are unfamiliar terms, Ethernet or CANBUS are better choices unless you have the time and inclination to learn the gritty details about network protocols.

If you can afford it, fiber optic cable is usually a slightly better choice in a factory. All three can be made to work over fiber optic cable.

Thanks everyone. I have decided on ethernet. We already have a 24 port gigabit switch that we can mount in the ceiling of the center of the building. From there we can go the furthest distance the ethernet cables will go and then just use two wires from the arduino to the switch. Simple, right? I have been playing with some of the stuff at home with our apple time machine to connect the arduino to the LAN, but for some reason the computers don't recognize it as a web page even though I'm running the examples included in the arduino programming software. Is this due to the network collisions? Its using just 8' of cable right now. And one more issue, my 2nd arduino doesn't want to accept software. I select upload and the computer compiles the program and starts uploading but stops and this shows up:
avrdude: stk500_getsync(): not in sync: resp=0x00
Does anybody know how to fix this issue? I have re-installed the driver repeatedly but still cant get it to work.