i2c over 3,5mm stereo jack - Page 1
Forum section: electronics / beginners

author: bryce1
author_rank: Regular Contributor
timestamp: February 13, 2014, 04:32:03 pm
content: Has anyone tried this before? The idea is to daisy-chain i2c components (mainly sensors) together.Do you have advice on how to protect the uC side of things?

author: fcb
author_rank: Super Contributor
timestamp: February 13, 2014, 04:49:05 pm
content: You could use I2C, but you would have to figure out how to power the sensors (4 pole 3.5mm jack perhaps).Much better would be to use 0v, Vcc and a 1 wire protocol (I'd homebrew a protocol specifically for this, probably using RS232 9600 bps timing so it could be jammed into a USB<>UART IC like a FT230X).

author: Rerouter
author_rank: Super Contributor
timestamp: February 13, 2014, 07:35:31 pm
content: if the chain isn't very long (sub 5 meters) you can rectify the clock line to provide power for each of your sensors (assuming they work off uA not 10's of mA) while not the most common usage, a system we use at work does this for external eeprom key dongles, at a distance of 1.5m

author: bryce1
author_rank: Regular Contributor
timestamp: February 14, 2014, 07:45:43 am
content: Thats a good idea! Might it also be possible to use some transistor to get more power on the clock line?How would I rectify SCL? Just put a 100nF cap and a resistor on there?

author: Rerouter
author_rank: Super Contributor
timestamp: February 14, 2014, 09:45:29 am
content: you use close to the minimum reccomended pull up resistance values for your choice of chips, you then rectify the clock line through a decent capacitor (1uF +) and rectify the clock line via a diode, that way when the clock line is idle it charges it up, wheverver it pulls it low it doesnt hold it down,equally lower pullup values are reccomended for long lines (you can trylowerhigher values but it will take longer to charge up every sensors cap 5 time constants before you start reliable communication,)

author: amyk
author_rank: Super Contributor
timestamp: February 14, 2014, 10:17:40 pm
content: Reminds me of this:https://www.eevblog.com/forum/projects/reverse-engieneering-the-interface-to-a-usb9097-1-wire-adapter/http://owfs.org/index.php?page=usb-usb9097

author: mariush
author_rank: Super Contributor
timestamp: February 14, 2014, 11:00:08 pm
content: I wouldn't use a stereo jack, too much risk to short something when plugging the jack in.What's wrong with a 5 pin header like the ones used on usb headers .. cheap and basically keyed so you can't put them the other way around.. do something like gnd - voltage - data1 - key - data2plastic housings are cheap, metal contacts are super cheap, you can buy ribbon by 100 feet rolls or plain wire..Alternatively, for one wire data you could buy tons of old style analogue audio cd cables like here:http://www.digikey.com/product-detail/en/810-10052-00050/1175-1260-ND/3064991and you have ground, voltage and data (but you may want to be careful not to insert them the other way around if your sensors don't have protections

author: fcb
author_rank: Super Contributor
timestamp: February 16, 2014, 01:32:21 am
content: I think a stereo jack is a great way of doing this - you just have to design round the shorting issue (which isn't difficult!).Rectification of of the SDA/SCL is quite a good way of doing things - but you'll need to pay close attention to power consumption. If you can find IC's that will run off 3v3 and tolerate 5v I2C then you might have a neat solution.

author: vk6zgo
author_rank: Super Contributor
timestamp: February 16, 2014, 02:22:58 am
content: I would be very wary of 3.5mm stereo jacks,unless you can find very high quality ones.The usual ones available in Jaycar,etc,in Oz are quite flimsy.In all fairness,they do sell better ones as well,but I feel that even with those,it would be incredibly easy tolose connection at the worst possible time.I normally hate mini-DIN connectors,but I think they would be a better choice in this case---they don't take up much more real estate,& won't fall out!

author: bryce1
author_rank: Regular Contributor
timestamp: February 27, 2014, 09:13:51 am
content: Quote from: fcb on February 16, 2014, 01:32:21 amthanks for encouraging me :-) I cant think of a way to prevent the shorting issue.

author: lapm
author_rank: Frequent Contributor
timestamp: February 27, 2014, 09:44:30 am
content: I would be worried about cable length more then anything. I2C is meant for withing pcb communication originally. So signal reflections,etc. might come into play here. Not to mention those 3.5mm stereo connectors are good for audio, not so good for digital signals..Longer the cable more power it takes to drive it withing acceptale DV/Dt change times.But if you decide to try it, i sure would be interested hearing how it worked and what challenges you eventually run into... Short ranges almost anything works, longer the range needed, well more challenging things comes...

author: fcb
author_rank: Super Contributor
timestamp: February 27, 2014, 01:01:20 pm
content: Just work out the effecting of momentary shorting on your circuit and design around it.

author: granz
author_rank: Regular Contributor
timestamp: February 27, 2014, 04:30:38 pm
content: As others have mentioned, 3.5mm audio jacks are probably a bad choice for something like I2C. These type of connectors can freely rotate, and this will cause noise on your clock and data lines. Hardware implementations of I2C are state-machine based, and it's easy to get things into funny states on your various chips if you have noise. You can overcome this with reset logic in a microcontroller, but many dedicated chips that use I2C will easily get confused and you might need to reset them externally. Hot-plug/unplug could be handled, but movement of a connection in a round plug will be a nightmare.I've successfully used I2C at 100kHz at something like 2 meters (with solid connections), so you should be fine in that regard.Best of luck with your project!

author: cybermaus
author_rank: Frequent Contributor
timestamp: February 27, 2014, 04:43:34 pm
content: You know, a friend of mine asked me the same thing, to wire various i2c sensors, and at first we were also thinking 3.5mmBut then wethought of rj12

author: granz
author_rank: Regular Contributor
timestamp: February 27, 2014, 04:52:33 pm
content: Quote from: cybermaus on February 27, 2014, 04:43:34 pmYes, those work well for I2C. Actually, some commercial data loggers, such as those from Vernier (www.vernier.com) actually use phone-type connectors (British I think??) for their plug-in sensors. What they call digital sensors are actually using I2C for communication. Some home fairly long cables.