1
\$\begingroup\$

I am developing a data logger for use in high schools like ( http://www.pasco.com ). The main difference is that mine is primary supposed to be used with an iPad. I have a connection between a micro controller and an iPad up and running, but I have a question regarding the communication between sensors and the 'hub' which is the part that makes it possible to connect up to 3 sensors to the iPad.

On the prototype level my hub consists of an Atmega328 (arduino) and the sensors are just connected directly to the A/D converter pins.

But because this system is supposed to support a variety of sensors this solution is not generic enough (i.e.. if a distance sensors should be connected, it would not work on the anlog pin, because it would be the difference between 2 timestamps). So I am thinking of adding a micro controller in every sensor and let that microcontroller communicate with the micro controller of the hub, which then will transmit the data to the iPad.

Which protocols should be used to communicate between these micro controllers? And is at all the way to go?

  1. The length of the wire would be maximum 2m.
  2. The maximum amount of wires is 4 and it should include +5 and GND to the sensor.
  3. The readings should in some cases be fast 20hz or preferably even more.
  4. It should be possible to send some sort of identification along to the hub, so the hub knows which kind of sensors is attached.

It is possible to see a video of the prototype here.

\$\endgroup\$
2
\$\begingroup\$

For multiple sensors, an assortment of analog and digital, a simple solution would be to use an Arduino Mega with a "Mega Sensor Shield" (bottom of page) ($11-12) attached to it. DfRobot offers a Mega Sensor Shield with XBee connector on board ($18-20), which might be even more useful:

Mega Sensor Shield with xBee connector

This combination allows different sensors to be plugged in, as each of the 54 digital and 16 analog IOs of the Arduino Mega are brought out to separate 3-pin headers consisting of signal, ground and Vcc (5 volts). Thus sensors which need power would also receive it from the Sensor Shield.

As the Arduino boards themselves cannot provide more than 200 to 500 mA per board, depending on the board specifics, the Sensor Shield also has a connector to accept power from a wall-wart. The Arduino is then powered off the shield, as are all the sensors.

The reason to recommend the XBee connector is that incorporating remote data logging, via a Bluetooth or WiFi XBee module, becomes easy. This is especially valuable in an environment where long cables from sensor / logger location to a computer for data visualization or long term storage bears risks of damage.

Sensor shields are also available with an SD card module on board, or connectors provided for one. This again might be useful if the data logger needs to store large volumes of data locally.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

20hz is not particularly fast - 20khz should be achievable in normal conditions.

Obvious options are:

  • Generic serial
  • I2C
  • Dallas 1-Wire (actually one wire + ground)
  • USB

The first two are available on most microcontrollers. I2C wasn't really designed for running down wires, but works quite well anyway. You can put several devices on one line with various techniques. Some sensors (eg. temperature) are available with I2C interfaces built in. It's designed for polling by the master device, which also chooses the clock speed for the transmission.

Serial UART is the easiest to use and debug.

1-Wire is proprietary and harder to implement yourself, but makes the wiring trivial. It's slower than I2C.

USB has all the autodetection and ease of interfacing to a PC, but requires special hardware on the microcontroller and is generally much more demanding. It's also the fastest by a long way.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks. How fast would it be possible to get the data from 3 sensors over I2C? \$\endgroup\$ – Morten Y Nov 12 '12 at 12:10
  • \$\begingroup\$ I'd expect a bus speed of 100khz to work fine; how many readings that translates into depends on the protocol, but it will be many thousands per second. \$\endgroup\$ – pjc50 Nov 12 '12 at 12:54
  • \$\begingroup\$ I tried to set it up with an I2C network with two arduinos which are working fine. But because there is a variety of sensors how would I be able to request data from the the 3 ports on the hub? They would need to have an ID which I can request data from, and these would need to be unique. I dont see how it would be possible to use I2C really. \$\endgroup\$ – Morten Y Nov 13 '12 at 9:23
  • \$\begingroup\$ If each link from the hub was point-to-point, all the slave devices could have the same I2C ID. (IE three separate buses, each of which only has two devices. The master device would have to do its bus implementation in software for some of the ports) \$\endgroup\$ – pjc50 Nov 13 '12 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.