Home sensing - directions wanted for a newbie

Hi there,

I've came across Arduino today and it looks like it's exactly what I have been looking for. I'm trying to prototype a X10 alternative solution for a house we are hoping to build next year. I'm only looking at "sensing" part of it at the moment before moving on to actually controlling things. My goal at this stage is to be able to collect information from many sensors in different rooms and be able to consolidate all data within a single database.

I've looked at SDK and samples and they all look very sound - that part I can handle. I'm a total lame in hardware though and have a few questions that can hopefully find answers here:

  1. Say, I wanted to handle around 50 sensors - temp, motion, light, humidity and so on - they all don't have to hook to a single board, I guess I could use a few Arduino Uno + Ethernet shield setup so they each sense their near area and push data to the server over the network. How do I hook sensors to the board - does each one has to be connected individually or I can use a "bus" wire (I am sorry for using wrong terminology here - don't know how it's called) so they all sort of connect to it in parallel? Will the board be able to figure which sensor is sending and will not the signals interfere with each other?

  2. What's the maximum/suggested length of the cables to the sensors? Are there only analogue sensors? Are there digital T sensors for example? Are digital sensors "better" than the other type?

  3. How do I hunt for compatible sensors? I guess you can interface pretty much any sensor but there are sensors that are just "friendlier" in terms of connecting and reading their data and don't require figuring out your own library for parsing its output at a very low level and do all sorts of math around it to get the proper number?

Sorry if the questions above are all stupid, I will appreciate any advise given. Many thanks!

You have to decide the "granularity" of the system, at one end you have a single controller and 50 wires running to sensors around the house. This model is not appropriate IMO.

At the other end you have 50 tiny sensors connected to a bus of some kind. To do this the sensors have to be intelligent and you need a protocol to get readings from each sensor.

In the middle is what i suspect you are suggesting, an Arduino in every room reading 5-10 sensors and a network for them to talk to a central controller.

How do I hook sensors to the board

Most sensors just connect to an analogue input, but many can talk I2C or SPI.

does each one has to be connected individually or I can use a "bus" wire

Either way works, but if you use a bus you have to design some form of protocol so they don't "interfere with each other".

What's the maximum/suggested length of the cables to the sensors

Analogue sensors are prone to noise so long lines should be avoided. But it depends on the accuracy you need.

Are there only analogue sensors?

Most sensors read an analogue event, some report the results as an analogue value, some use digital techniques to report the value to a processor.

Are there digital T sensors for example?

Don't know what a T sensor is. (temperature?) But there are sensors for everything you can imagine and then some.

Are digital sensors "better" than the other type?

If by "digital" you mead the reporting mechanism, IMO yes that's better. Convert analogue to digital as soon as possible.

How do I hunt for compatible sensors?

Just start googling I suppose. Look for "temperature sensor" etc. Or ask here for a specific thing. Most sensors are simple to interface with, normally just needing an analogRead() followed by a small amount of maths to scale the reading. Others use the standard digital comms like I2C and SPI, there are existing libraries to handle that.

A few are really difficult, I would suggest you ask here and link to the data sheet before buying anything.

Whatever you do I would plan to run some Cat5/6 around the house to every nook and cranny, it's cheap and easy to do during the build, damn hard after.


Rob

  1. Say, I wanted to handle around 50 sensors - temp, motion, light, humidity and so on - they all don't have to hook to a single board, I guess I could use a few Arduino Uno + Ethernet shield setup so they each sense their near area and push data to the server over the network.

You could go for the above mentioned or you could use 2 arduinos and Multiplexers, you'll have to search for the appropriate muxes. Mux is a device that switches between sensors so you can hook up say a temp sensor and a light sensor to one analog pin and have them switch between each other. Rest depends entirely upto your imagination.

How do I hook sensors to the board - does each one has to be connected individually or I can use a "bus" wire (I am sorry for using wrong terminology here - don't know how it's called) so they all sort of connect to it in parallel?

Parallel connections in this case would mean switching.

Will the board be able to figure which sensor is sending and will not the signals interfere with each other?

The data being sent by arduino is pure bits and bytes. So you have to label that in such a way that you can differentiate between what is being streamed. As far as signals interference is concerned, only one type of data is being sent over once and that too a separate channel. So say as mentioned earlier you're using a temp sensor and light sensor you have a variable

int temp = analogRead(temp_pin);
          switch_sensor(temp,light);
          int light = analogRead(light_pin); 
// note that light_pin and temp_pin are essentially the same pin, you need to differentiate at your own end as the analogRead function will just give you ADC //values, its how you trap it and process it that labels it
  1. What's the maximum/suggested length of the cables to the sensors? Are there only analogue sensors? Are there digital T sensors for example? Are digital sensors "better" than the other type?

Usually sensors involving PWM need to have a short length cable, infact that goes for almost all the devices. So, in order to get an extension and do extensive wiring I would suggest using the ethernet cable. Twisted pair CAT -6 cable. Its very effective. But it won't be able to handle large amounts of current so if you have say a servo you might want to keep the supply different and the PWM signals coming from the arduino different (through the cable).

  1. How do I hunt for compatible sensors? I guess you can interface pretty much any sensor but there are sensors that are just "friendlier" in terms of connecting and reading their data and don't require figuring out your own library for parsing its output at a very low level and do all sorts of math around it to get the proper number?

You just need to go about in this fashion. What kind of input does arduino take -> PWM, Analog, Serial etc. what's the voltage level on this 0-5v only. So now you have output parameters set. You can check Digikey, Mouser, Adafruit, Sparkfun, RS components for sensors having 0-5V operational range and are based on Serial or PWM or whatever you want.
common Temperature sensors are LM35 etc. So you can search other parameters similar to LM35. Its upto you really.
You can also google: temperature+Arduino, this will definitely lead to some prebuilt arduino projects involving temperature sensing etc. Remember to use the existing code than to re-invent the wheel. You can study it and reuse it. That's why its opensource, to help you.

Another option is to go wireless. xBee radios work well for this, there's an excellent intro in this book:

You can have an xBee on each sensor (no need for a micro-controller if the sensor just outputs analog or digital data - the xBee has digital and analog input pins) and then have one (or more) Arduino (or even a PC) act as the data gatherer/processor for the system. Same thing (in reverse) for control - the Arduino/PC sends signals, and the digital out pins on the xBees trigger relays, etc.

A few thoughts to get you started.

There's a confusing variety of interfaces being used for sensors. Two of the most popular low-cost ones supported by the Arduino (I2C and SPI) are only good for very short wires (a foot or two).

The Dallas Semi (now part of Maxim) 1Wire interface is still relatively cheap, and good for longer wires. In addition to the ICs still made by Maxim, entrepreneurs have made some sensors for the home automation market. Be sure you read the application notes on maxim-ic.com about wire lengths and other concerns when hooking multiple sensors to a 1Wire bus.

For temp and humidity, consider buying one of those "home weather stations" with wireless remote sensors. I believe some of them have been hacked and interfaced to micros.

You're not sending lots of data, so you don't really need Ethernet. For a lower-cost alternative, look at some of the projects people have done using Cat5 for low-cost distribution of power and serial data using RS-485.

Hi,

I have a rudimentary version of what you are trying to build up and working. I have several Dallas one-wire temperatures located throughout my house. I ran Cat5e between the sensor locations and my "phone closet". In the phone closet I have an Arduino with an ethernet shield that reads the sensors (via OneWire) and posts to Pachube.

I am also a newbie and it's been relatively easy to setup. I have 3 sensors active now and am having trouble getting a fourth to work properly. Not sure yet if its hardware or software but I will figure it out.

The good news my sensors are located all across my house (attic, crawlspace,garage) and I am not having trouble with distance (yet) because the signals are sent digitally.

Have you settled on a design approach or are you still looking. I'd love to hear where you are at with the project.

kms

The Dallas 1-Wire line will seem a bit daunting at first, but it may well be just what you want.