Hi Terry

On 06/06/18 13:53, Terry Coles wrote:
Pros and Cons of I2C and 1-wire Interfaces:
This is to communicate with multiple devices connected to a Raspberry Pi.  Two
fundamental elements are relevant.  I2C (literally Inter-Integrated Circuit) is 
only good for
short distances, but has the advantage of allowing addressing as part of the 
protocol and
sensor design.   1-Wire has longer range, but the devices arrive with their 
unique identifier
hard coded into them by the manufacturer.   After last night, I was unsure 
whether we
would be able to implement a level sensor with 1-wire capability, since they 
tend to be very
expensive and aimed at specific industries and therefore expensive.  Our 
current level
sensors are using hall-effect devices with a bit per level, so we clearly want 
to multiplex
that data into a serial bus of some kind.  This appears fairly easy with I2C, 
but not so easy
(because of the unique ID requirement) with 1-wire.  The jury's still out.


With I2C you are typically limited to just a small number of identical devices on the same bus, as they come preprogrammed with a 7-bit identifier, with the ability to change perhaps 1 or 2 of those bits (but if there are no spare pins available on the device, it won't be possible to select any address bits). 1-Wire devices come with a 64-bit identification code (8 bit family code, 48 bit serial number, 8 bit CRC). This allows multiple identical devices to hang off the same bus and be uniquely identified. Identification of all devices on the bus is via a search routine implemented in the master.

One problem with 1-Wire is that it requires time-critical pulse generation and measurement. The DS2282-100 IIC to 1-Wire bridge allows you to avoid time-critical stuff on the master processor.

In terms of multiplexing several Hall effect sensors, you could use a PISO shift register (eg 74HC165) and clock the bits out as with SPI.

For longer distances, I'd suggest a single chip micro to read the Hall devices and send the data over asynchronous serial (RS232, RS485 etc). An MC9S08SH8 is available in DIL package and a USBDM programmer can be bought on Ebay for around £20.


Cheers

Tim

--
Next meeting:  Bournemouth, Tuesday, 2018-07-03 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:[email protected] / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to